cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 318f884cee17ec6ff8418782d95495ea4075cbdf
parent 7d2dd76495e877a41701c0695f065971855e606e
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Wed, 29 Jan 2020 15:03:18 +0200

kiss: Safeguard against su removal

Diffstat:
Mkiss | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 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