ghostbsd / issues

Issue tracker for GhostBSD
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Add Feature to Detect and Warn About Vital Packages Before Deletion #174

Open ericbsd opened 1 week ago

ericbsd commented 1 week ago

Description

Add functionality to the software-station to detect vital packages associated with installed packages, warn the user about the potential impact of deleting these packages, and ask the user to confirm whether they still wish to proceed with deletion.

Feature Details

  1. Vital Package Detection:

    • Use the pkg query "%V" command to detect whether a package is marked as "vital" before deletion.
    • If a package is detected as vital, prompt the user with a warning indicating that removing the package may affect system stability or other installed packages.
  2. Confirmation Before Deletion:

    • After warning the user, ask for explicit confirmation to proceed with the deletion of the vital package.
    • If the user chooses to proceed, the vital status should be unset before deletion using the command:
      pkg set -v 0 <package-name>
  3. Implementation Steps:

    1. Detect if the package is marked as vital using pkg query "%V".
    2. Add a warning prompt to inform the user of the potential risks associated with deleting a vital package.
    3. Ask the user to confirm whether they want to proceed with deletion.
    4. If the user confirms, run the command pkg set -v 0 to unset the vital status before deleting the package.
    5. Proceed with the deletion only if the vital status is unset, and the user has confirmed the action.

Acceptance Criteria

ericbsd commented 1 week ago

Some documentation: https://man.freebsd.org/cgi/man.cgi?query=pkg-set&sektion=8&manpath=freebsd-release-ports https://man.freebsd.org/cgi/man.cgi?pkg-query(8)