kiss: Add comments to new install function

This commit is contained in:
Dylan Araps 2020-04-22 09:23:19 +03:00
parent 6e3064d0f8
commit 33cdc64803
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

12
kiss
View File

@ -814,16 +814,28 @@ 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.
awk '{L[n++]=$0}END{while(n--)print L[n]}' "$2/$pkg_db/${2##*/}/manifest" |
while read -r line; do
# Grab the octal permissions so that directory creation
# preserves permissions.
perms=$(stat -c %a "$2/$line")
# Copy files and create directories (preserving permissions),
# skipping anything located in /etc/.
#
# The 'test' will run with '-e' for no-overwrite and '-z'
# for overwrite.
case $line in /etc/*) ;;
*/) [ -d "$line" ] || mkdir -m "$perms" "$line" ;;
*) test "$1" "$line" || cp -fPp "$2/$line" "${line%/*}" ;;
esac
# Set the ownership of the result to root:root. This is
# KISS' method to avoid the whole fakeroot mess.
chown -h root:root "$line"
done
}