From beb2aa71a12343e961fbb7acdc0308d76e4554ce Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Wed, 29 Jan 2020 13:03:17 +0000 Subject: kiss: Safeguard against su removal FossilOrigin-Name: 10cfd62c37337abe475fd2a5c566e43e380d59b3b06d70b10ad68ac5748897cb --- kiss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index e6e5116..c98416c 100755 --- a/kiss +++ b/kiss @@ -927,10 +927,16 @@ pkg_remove() { required_by="$required_by'${file##*/}', " done + [ "$required_by" ] && + die "$1" "Package is required by ${required_by%, }" + # Disable globbing. set -f - [ "$required_by" ] && die "$1" "Package is required by ${required_by%, }" + # Ensure that the user leaves their machine in a working state by + # refusing to remove the package which providees 'su'. + grep -q "^$(command -v su)$" "$sys_db/$1/manifest" && + die "$1" "Removing su will break the system." # Block being able to abort the script with 'Ctrl+C' during removal. # Removes all risk of the user aborting a package removal leaving -- cgit v1.2.3