kiss: only sort manifest once during install

This commit is contained in:
Dylan Araps 2021-07-07 10:34:05 +03:00
parent 001ce0396f
commit 855bda4497
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 8 additions and 8 deletions

16
kiss
View File

@ -1016,11 +1016,6 @@ pkg_swap() {
}
pkg_install_files() {
# Reverse the manifest file so that we start shallow and go deeper as we
# iterate over each item. This is needed so that directories are created
# going down the tree.
sort "$2/$pkg_db/${2##*/}/manifest" > "$mak_dir/if"
while read -r file; do
# Grab the octal permissions so that directory creation
# preserves permissions.
@ -1066,7 +1061,7 @@ pkg_install_files() {
[ -h "$_file" ] || chmod "$b$oct" "$_file"
}
esac
done < "$mak_dir/if" || :
done || :
}
pkg_remove_files() {
@ -1318,8 +1313,13 @@ pkg_install() {
cp -f "$sys_db/$pkg_name/etcsums" "$mak_dir/c" 2>/dev/null ||
: > "$mak_dir/c"
# Reverse the manifest file so that we start shallow and go deeper as we
# iterate over each item. This is needed so that directories are created
# going down the tree.
sort "$tar_dir/$pkg_name/$pkg_db/$pkg_name/manifest" > "$mak_dir/if"
# Install the package's files by iterating over its manifest.
pkg_install_files -z "$tar_dir/$pkg_name"
pkg_install_files -z "$tar_dir/$pkg_name" < "$mak_dir/if"
# Handle /etc/ files in a special way (via a 3-way checksum) to determine
# how these files should be installed. Do we overwrite the existing file?
@ -1341,7 +1341,7 @@ pkg_install() {
# Install the package's files a second time to fix any mess caused by the
# above removal of the previous version of the package.
log "$pkg_name" "Verifying installation"
pkg_install_files -e "$tar_dir/$pkg_name"
pkg_install_files -e "$tar_dir/$pkg_name" < "$mak_dir/if"
# Reset 'trap' to its original value. Installation is done so we no longer
# need to block 'Ctrl+C'.