diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-29 13:03:17 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-29 13:03:17 +0000 |
commit | beb2aa71a12343e961fbb7acdc0308d76e4554ce (patch) | |
tree | f5e83fe644a9de433afff120e7881cc5e09673f7 | |
parent | 3c41c76bfb8e40aca44235fbac0ac3eff801ab81 (diff) | |
download | cpt-beb2aa71a12343e961fbb7acdc0308d76e4554ce.tar.gz |
kiss: Safeguard against su removal
FossilOrigin-Name: 10cfd62c37337abe475fd2a5c566e43e380d59b3b06d70b10ad68ac5748897cb
-rwxr-xr-x | kiss | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 |