kiss: Add support for KISS_ROOT to install

This commit is contained in:
Dylan Araps 2020-04-25 14:03:34 +03:00
parent da605670e0
commit 6bc7deb64b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

14
kiss
View File

@ -818,7 +818,7 @@ pkg_install_files() {
while read -r line; do while read -r line; do
# Grab the octal permissions so that directory creation # Grab the octal permissions so that directory creation
# preserves permissions. # preserves permissions.
perms=$(stat -c %a "$2/$line") rwx=$(stat -c %a "$2/$line")
# Copy files and create directories (preserving permissions), # Copy files and create directories (preserving permissions),
# skipping anything located in /etc/. # skipping anything located in /etc/.
@ -827,17 +827,19 @@ pkg_install_files() {
# for overwrite. # for overwrite.
case $line in /etc/*) ;; case $line in /etc/*) ;;
*/) [ -d "$line" ] || */) [ -d "$line" ] ||
install -o root -g root -m "$perms" -d "$line" ;; install -o root -g root -m "$rwx" \
-d "$KISS_ROOT/$line" ;;
*) test "$1" "$line" || *) test "$1" "$KISS_ROOT/$line" ||
if [ -L "$2/$line" ]; then if [ -L "$2/$line" ]; then
[ -d "$line" ] && continue [ -d "$KISS_ROOT/$line" ] && continue
cp -fPp "$2/$line" "${line%/*}" cp -fPp "$2/$line" "${line%/*}"
chown -h root:root "$line" chown -h root:root "$KISS_ROOT/$line"
else else
install -o root -g root -m "$perms" "$2/$line" "$line" install -o root -g root -m "$rwx" \
"$2/$line" "$KISS_ROOT/$line"
fi fi
esac esac
done done