From 8a4c642d4b438db76a725a0685eafe44c48eb98d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 22 Apr 2020 19:29:55 +0300 Subject: [PATCH] kiss: Use install for installation --- kiss | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/kiss b/kiss index 5d5dc31..a8feb8f 100755 --- a/kiss +++ b/kiss @@ -814,10 +814,6 @@ pkg_swap() { } pkg_install_files() { - # Store the total lines in the manifest file for use in the - # installation counter output. - man_tot=$(wc -l < "$2/$pkg_db/${2##*/}/manifest") - # 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. @@ -834,22 +830,19 @@ pkg_install_files() { # 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%/*}" ;; + */) [ -d "$line" ] || + install -o root -g root -m "$perms" -d "$line" ;; + + *) test "$1" "$line" || + + if [ -L "$2/$line" ]; then + cp -fPp "$2/$line" "${line%/*}" + chown -h root:root "$line" + else + install -o root -g root -m "$perms" "$2/$line" "$line" + fi 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" - - # Preserve permissions by using chmod. This runs after - # chown as chown will reset suid/guid when ownership changes. - [ -L "$line" ] || [ -d "$line" ] || chmod "$perms" "$line" - - printf '%s %s (%s)\e[J\r' "$3" "$i/$man_tot" "$line" done - - printf '\n' } pkg_etc() { @@ -1088,6 +1081,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" " Checking file" # Reset 'trap' to its original value. Installation is done so