kiss: fixup etcsums, closes #94 (#97)

```
λ rm -rf /tmp/root
λ KISS_FORCE=1 kiss i iproute2
-> iproute2 Checking for package conflicts
-> iproute2 Installing package (iproute2@5.19.0-1.tar.gz)
-> iproute2 Installed successfully
λ kiss r iproute2
-> iproute2 Checking if package removable
-> iproute2 Removing package
Skipping /etc/iproute2/rt_tables (modified)
Skipping /etc/iproute2/rt_scopes (modified)
Skipping /etc/iproute2/rt_realms (modified)
Skipping /etc/iproute2/rt_protos (modified)
Skipping /etc/iproute2/nl_protos (modified)
Skipping /etc/iproute2/group (modified)
Skipping /etc/iproute2/ematch_map (modified)
Skipping /etc/iproute2/bpf_pinning (modified)
-> iproute2 Removed successfully
λ
λ rm -rf /tmp/root
λ KISS_FORCE=1 $PWD/kiss i iproute2
-> iproute2 Checking for package conflicts
-> iproute2 Installing package (iproute2@5.19.0-1.tar.gz)
-> iproute2 Installed successfully
λ $PWD/kiss r iproute2
-> iproute2 Checking if package removable
-> iproute2 Removing package
-> iproute2 Removed successfully
```

Co-authored-by: git-bruh <e817509a-8ee9-4332-b0ad-3a6bdf9ab63f@aleeas.com>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/97
This commit is contained in:
Pratham 2022-10-26 09:19:25 +02:00
parent 58475f7f29
commit 8a1a88e0d3

15
kiss
View File

@ -935,9 +935,16 @@ pkg_etcsums() {
# Minor optimization - skip packages without /etc/.
[ -d "$pkg_dir/$repo_name/etc" ] || return 0
# Create a list of all files in etc but do it in reverse.
while read -r etc; do case $etc in /etc/*[!/])
set -- "$pkg_dir/$repo_name/$etc" "$@"
etc="$pkg_dir/$repo_name/$etc"
# Always use hash of /dev/null as the hash for symlinks as it's
# possible that they can never be resolved/hashed
# (eg. directory, non-existent path, ...)
# So they leave missing lines in etcsums which breaks removal of all
# other unmodified files in /etc aswell
[ -h "$etc" ] && etc=/dev/null
set -- "$@" "$etc"
esac done < manifest
b3 "$@" > etcsums
@ -1437,7 +1444,7 @@ pkg_remove_files() {
case "${#sum_pkg}" in
64) sh256 "$KISS_ROOT/$file" >/dev/null ;;
66) b3 "$KISS_ROOT/$file" >/dev/null ;;
*) b3 "$KISS_ROOT/$file" >/dev/null ;;
esac
equ "$hash" "$sum_pkg" || {
@ -1475,7 +1482,7 @@ pkg_etc() {
case "${#sum_old}" in
64) sh256 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
66) b3 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
*) b3 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
esac
sum_new=${hash%%"$newline"*}