Merge pull request #186 from kisslinux/rm_etc

kiss: Add handling of /etc/ files to removal action.
This commit is contained in:
dylan 2020-09-09 10:49:02 +03:00 committed by GitHub
commit 43a2476f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

17
kiss
View File

@ -986,10 +986,15 @@ pkg_remove_files() {
# installation and package removal. Combining the removals in these two # installation and package removal. Combining the removals in these two
# functions allows us to stop duplicating code. # functions allows us to stop duplicating code.
while read -r file; do while read -r file; do
case $file in /etc/*) case $file in /etc/?*[!/])
printf 'Skipping removal of %s\n' "$file" sum_sys=$(sh256 "$KISS_ROOT/$file")
continue; sum_old=$(grep -F "$sum_sys" "$mak_dir/c")
esac
[ "$sum_sys" = "$sum_old" ] || {
printf 'Skipping %s (modified)\n' "$file"
continue
}
esac 2>/dev/null ||:
file=$KISS_ROOT/$file file=$KISS_ROOT/$file
@ -1085,8 +1090,10 @@ pkg_remove() {
"$sys_db/$1/pre-remove" ||: "$sys_db/$1/pre-remove" ||:
fi fi
log "$1" "Removing package" # Make a backup of the etcsums file (if it exists).
cp -f "$sys_db/$1/etcsums" "$mak_dir/c" 2>/dev/null ||:
log "$1" "Removing package"
pkg_remove_files < "$sys_db/$1/manifest" pkg_remove_files < "$sys_db/$1/manifest"
# Reset 'trap' to its original value. Removal is done so # Reset 'trap' to its original value. Removal is done so