kiss: Safeguard against su removal

This commit is contained in:
Dylan Araps 2020-01-29 15:03:18 +02:00
parent 7d2dd76495
commit 318f884cee
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

8
kiss
View File

@ -927,10 +927,16 @@ pkg_remove() {
required_by="$required_by'${file##*/}', " required_by="$required_by'${file##*/}', "
done done
[ "$required_by" ] &&
die "$1" "Package is required by ${required_by%, }"
# Disable globbing. # Disable globbing.
set -f 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. # Block being able to abort the script with 'Ctrl+C' during removal.
# Removes all risk of the user aborting a package removal leaving # Removes all risk of the user aborting a package removal leaving