cpt

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

commit ba8a9cffa5bc4874b2fd81c2e96d6aaa0853b17d
parent 133f3849ebc62212d5065791978ad82f0c3ed603
Author: Cem Keylan <cem@ckyln.com>
Date:   Thu, 28 May 2020 11:20:45 +0300

kiss: check manifests before removing directories

Diffstat:
Mkiss | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/kiss b/kiss @@ -1046,6 +1046,13 @@ pkg_remove() { "$sys_db/$1/pre-remove" ||: fi + # Create a temporary list of all directories, so we don't accidentally + # remove anything from packages that create empty directories for a + # purpose (such as baselayout). + manifest_list="$(set +f; pop "$sys_db/$1/manifest" from "$sys_db/"*/manifest)" + # shellcheck disable=2086 + grep -h '/$' $manifest_list | sort -ur > "$mak_dir/dirs" + run_hook pre-remove "$1" "$sys_db/$1" root while read -r file; do @@ -1054,6 +1061,7 @@ pkg_remove() { [ "${file##/etc/*}" ] || continue if [ -d "$KISS_ROOT/$file" ]; then + "$grep" -q "^$file/\$" "$mak_dir/dirs" && continue rmdir "$KISS_ROOT/$file" 2>/dev/null || continue else rm -f "$KISS_ROOT/$file"