From ef39477c9ef4ef365d7f38e8bc261c7b9efb028e Mon Sep 17 00:00:00 2001 From: merakor Date: Wed, 22 Apr 2020 21:03:37 +0000 Subject: kiss: use install instead of cp where possible FossilOrigin-Name: 101e70067bc73239cfc1c525dadbd4971f77989868ae842ba48cbafc15041980 --- kiss | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'kiss') diff --git a/kiss b/kiss index b1fa228..ed631ab 100755 --- a/kiss +++ b/kiss @@ -870,21 +870,18 @@ 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 -Pp "$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. - chown root:root "$line" - - # Preserve permissions by using chmod. This runs after - # chown as chown will reset suid/guid when ownership changes. - # - # This only runs on non-directories as we desire the reset - # behavior mentioned above. - [ -d "$line" ] || chmod "$perms" "$line" - - printf '%s %s (%s)\e[K\r' "$3" "$i/$man_tot" "$line" + printf '%s %s (%s)\e[J\r' "$3" "$i/$man_tot" "$line" done printf '\n' -- cgit v1.2.3