mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-25 16:40:07 -07:00
pkg_install_files: fix internal path issue.
When KISS_ROOT is empty path is //path/to/file.
This commit is contained in:
parent
e9a2e3472b
commit
17815b698c
17
kiss
17
kiss
@ -1003,11 +1003,11 @@ pkg_install_files() {
|
|||||||
# going down the tree.
|
# going down the tree.
|
||||||
sort "$2/$pkg_db/${2##*/}/manifest" |
|
sort "$2/$pkg_db/${2##*/}/manifest" |
|
||||||
|
|
||||||
while read -r line; do
|
while read -r file; do
|
||||||
# Grab the octal permissions so that directory creation
|
# Grab the octal permissions so that directory creation
|
||||||
# preserves permissions.
|
# preserves permissions.
|
||||||
# See: [2] at top of script.
|
# See: [2] at top of script.
|
||||||
rwx=$(ls -ld "$2/$line") oct='' b='' o=0
|
rwx=$(ls -ld "$2/${file#/}") oct='' b='' o=0
|
||||||
|
|
||||||
# Convert the output of 'ls' (rwxrwx---) to octal. This is simply
|
# 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.
|
# a 1-9 loop with the second digit being the value of the field.
|
||||||
@ -1023,28 +1023,29 @@ pkg_install_files() {
|
|||||||
[ "$((${c%?} % 3))" = 0 ] && oct=$oct$o o=0
|
[ "$((${c%?} % 3))" = 0 ] && oct=$oct$o o=0
|
||||||
done
|
done
|
||||||
|
|
||||||
|
_file=$KISS_ROOT/${file#/}
|
||||||
|
|
||||||
# Copy files and create directories (preserving permissions),
|
# Copy files and create directories (preserving permissions),
|
||||||
# skipping anything located in /etc/.
|
# skipping anything located in /etc/.
|
||||||
#
|
#
|
||||||
# The 'test' will run with '-e' for no-overwrite and '-z'
|
# The 'test' will run with '-e' for no-overwrite and '-z'
|
||||||
# for overwrite.
|
# for overwrite.
|
||||||
case $line in /etc/*) ;;
|
case $file in /etc/*) ;;
|
||||||
*/)
|
*/)
|
||||||
# Skip directories if they already exist in the file system.
|
# Skip directories if they already exist in the file system.
|
||||||
# (Think /usr/bin, /usr/lib, etc).
|
# (Think /usr/bin, /usr/lib, etc).
|
||||||
[ -d "$KISS_ROOT/$line" ] || mkdir -m "$oct" "$KISS_ROOT/$line"
|
[ -d "$_file" ] || mkdir -m "$oct" "$_file"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
# Skip directories as they're likely symlinks in this case.
|
# Skip directories as they're likely symlinks in this case.
|
||||||
# Pure directories in manifests have a suffix of '/'.
|
# Pure directories in manifests have a suffix of '/'.
|
||||||
[ -d "$KISS_ROOT/$line" ] || test "$1" "$KISS_ROOT/$line" || {
|
[ -d "$_file" ] || test "$1" "$_file" || {
|
||||||
cp -fP "$2/$line" "$KISS_ROOT/$line"
|
cp -fP "$2/${file#/}" "$_file"
|
||||||
|
|
||||||
# Skip changing permissions of symlinks. This prevents
|
# Skip changing permissions of symlinks. This prevents
|
||||||
# errors when the symlink exists prior to the target.
|
# errors when the symlink exists prior to the target.
|
||||||
[ -h "$KISS_ROOT/$line" ] ||
|
[ -h "$_file" ] || chmod "$b$oct" "$_file"
|
||||||
chmod "$b$oct" "$KISS_ROOT/$line"
|
|
||||||
}
|
}
|
||||||
esac
|
esac
|
||||||
done ||:
|
done ||:
|
||||||
|
Loading…
Reference in New Issue
Block a user