kiss: simplify pkg_etcsums

- Removes subshell usage.
- Removes cd usage.
This commit is contained in:
Dylan Araps 2021-07-03 14:37:26 +00:00
parent 95e3fc8f8e
commit d107c43098
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 4 additions and 8 deletions

12
kiss
View File

@ -580,23 +580,19 @@ pkg_manifest() (
sort -r | sed '/^\.\/$/d;ss.ss' > "$PWD/$pkg_db/$1/manifest"
)
pkg_etcsums() (
pkg_etcsums() {
# Generate checksums for each configuration file in the package's /etc/
# directory for use in "smart" handling of these files.
log "$1" "Generating etcsums"
# This function runs as a sub-shell to avoid having to 'cd' back to the
# prior directory before being able to continue.
[ -d "$pkg_dir/$1/etc" ] || return 0
cd "$pkg_dir/$1"
! [ -d "$pkg_dir/$1/etc" ] ||
# 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 etc ! -type d | sort | while read -r line; do
find "$pkg_dir/$1/etc" ! -type d | sort | while read -r line; do
sh256 "$line"
done > "$pkg_dir/$1/$pkg_db/$1/etcsums"
)
}
pkg_tar() (
# Create a tarball from the built package's files. This tarball also