1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 08:30:05 -07:00

kiss: simplify pkg_install_files further

This commit is contained in:
Dylan Araps 2021-07-13 23:01:24 +03:00
parent 7481a9dca0
commit 44c39789f7
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

13
kiss
View File

@ -1046,12 +1046,11 @@ pkg_swap() {
mv -f "$mak_dir/.$1" "../installed/$1/manifest"
}
pkg_install_files() {
while read -r file; do
file_rwx() {
# Grab the octal permissions so that directory creation
# preserves permissions.
# See: [2] at top of script.
rwx=$(ls -ld "$2/${file#/}") oct='' b='' o=0
rwx=$(ls -ld "$1") oct='' o=0
# Convert the output of 'ls' (rwxrwx---) to octal. This is simply
# a 1-9 loop with the second digit being the value of the field.
@ -1068,7 +1067,10 @@ pkg_install_files() {
oct=$oct$o o=0
esac
done
}
pkg_install_files() {
while read -r file; do
_file=$KISS_ROOT/${file#/}
# Copy files and create directories (preserving permissions),
@ -1080,7 +1082,10 @@ pkg_install_files() {
*/)
# Skip directories if they already exist in the file system.
# (Think /usr/bin, /usr/lib, etc).
[ -d "$_file" ] || mkdir -m "$oct" "$_file"
[ -d "$_file" ] || {
file_rwx "$2/${file#/}"
mkdir -m "$oct" "$_file"
}
;;
*)