kiss: Use install for installation

This commit is contained in:
Dylan Araps 2020-04-22 19:29:55 +03:00
parent 6ce01392bd
commit 8a4c642d4b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 12 additions and 18 deletions

30
kiss
View File

@ -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