linutil icon indicating copy to clipboard operation
linutil copied to clipboard

refactor: apt-get with nala and hardcoded package managers

Open jeevithakannan2 opened this issue 5 months ago • 11 comments

Pull Request

Title

Use nala , replace hardcoded package managers, add missing checkEnv and checkEscalationTool, implement posix recommended way of using variables

Type of Change

  • [x] Refactoring

Description

  • Position nala in front in common-script so it would use nala as package manager if found
  • Add nala in some missing scripts
  • Replace hardcoded package managers with PACKAGER variable
  • Added checkEnv in numlock for consistency among scripts
  • Added checkEscalationTool in monitor control for consistency among scripts
  • Gaming setup is not included in this PR as it is getting a rework in https://github.com/ChrisTitusTech/linutil/pull/380

Issue related to PR

  • Closes https://github.com/ChrisTitusTech/linutil/pull/440
  • Closes https://github.com/ChrisTitusTech/linutil/pull/442
  • Closes https://github.com/ChrisTitusTech/linutil/pull/443

Testing

  • Tested in debian12 with nala installed works as expected.
  • Tested other modified scripts in arch works as expected.

Additional Information

[!WARNING] #440 #442 #443 are implemented after this PR. Check those PRs with mine and decide which one to merge

[!CAUTION] The implementation of https://github.com/ChrisTitusTech/linutil/pull/440 is wrong Replacing apt-get with apt is not recommended when using in scripts. Only if we switch nala and apt-get places in common script it will check for nala first if found it will choose nala as the package manager. If not it will check for apt-get. On his implementation it will use apt itself as it checks for apt first.

Checklist

  • [x] My code adheres to the coding and style guidelines of the project.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] My changes generate no errors/warnings/merge conflicts.

jeevithakannan2 avatar Sep 16 '24 14:09 jeevithakannan2