aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-29 13:03:17 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-29 13:03:17 +0000
commitbeb2aa71a12343e961fbb7acdc0308d76e4554ce (patch)
treef5e83fe644a9de433afff120e7881cc5e09673f7
parent3c41c76bfb8e40aca44235fbac0ac3eff801ab81 (diff)
downloadcpt-beb2aa71a12343e961fbb7acdc0308d76e4554ce.tar.gz
kiss: Safeguard against su removal
FossilOrigin-Name: 10cfd62c37337abe475fd2a5c566e43e380d59b3b06d70b10ad68ac5748897cb
-rwxr-xr-xkiss8
1 files changed, 7 insertions, 1 deletions
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