forked from kiss-community/kiss
sh256: add back checks
This commit is contained in:
parent
2f48bff2e7
commit
2cd3422ff6
8
kiss
8
kiss
@ -141,6 +141,9 @@ sh256() {
|
||||
# All utilities must match 'sha256sum' output.
|
||||
#
|
||||
# Example: '<checksum> <file>'
|
||||
hash=
|
||||
|
||||
if [ ! -d "$1" ] && [ -e "$1" ]; then
|
||||
hash=$(
|
||||
sha256sum "$1" ||
|
||||
sha256 -r "$1" ||
|
||||
@ -151,6 +154,7 @@ sh256() {
|
||||
|
||||
hash=${hash%% *}
|
||||
printf '%s\n' "$hash"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_lint() {
|
||||
@ -627,7 +631,7 @@ pkg_etcsums() {
|
||||
# This can't be a simple 'find -exec' as 'sh256' is a shell function
|
||||
# and not a real command of any kind. This is the shell equivalent.
|
||||
find "$pkg_dir/$1/etc" ! -type d | sort | while read -r line; do
|
||||
[ ! -e "$line" ] || sh256 "$line"
|
||||
sh256 "$line"
|
||||
done > "$pkg_dir/$1/$pkg_db/$1/etcsums"
|
||||
}
|
||||
|
||||
@ -1086,7 +1090,7 @@ pkg_remove_files() {
|
||||
while read -r file; do
|
||||
case $file in /etc/?*[!/])
|
||||
sh256 "$KISS_ROOT/$file" >/dev/null
|
||||
sum_old=$(grep -F "$hash" "$mak_dir/c")
|
||||
sum_old=$(grep -F "${hash:=null}" "$mak_dir/c")
|
||||
|
||||
[ "$hash" = "$sum_old" ] || {
|
||||
printf 'Skipping %s (modified)\n' "$file"
|
||||
|
Loading…
Reference in New Issue
Block a user