forked from kiss-community/kiss
kiss: Safeguard against su removal
This commit is contained in:
parent
7d2dd76495
commit
318f884cee
8
kiss
8
kiss
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user