forked from kiss-community/kiss
kiss: reduce indentation
This commit is contained in:
parent
ddbefa66b7
commit
fc05246b3b
92
kiss
92
kiss
@ -1149,62 +1149,54 @@ file_rwx() {
|
||||
}
|
||||
|
||||
pkg_install_files() {
|
||||
while read -r file; do
|
||||
_file=$KISS_ROOT$file
|
||||
# Copy files and create directories (preserving permissions).
|
||||
while { read -r file && _file=$KISS_ROOT$file; } do case $file in
|
||||
/etc/*[!/])
|
||||
# Handle /etc/ files in a special way (via a 3-way checksum) to
|
||||
# determine how these files should be installed. Do we overwrite
|
||||
# the existing file? Do we install it as $file.new to avoid
|
||||
# deleting user configuration? etc.
|
||||
#
|
||||
# This is more or less similar to Arch Linux's Pacman with the
|
||||
# user manually handling the .new files when and if they appear.
|
||||
test "$1" "$_file" || pkg_etc "$file" "$_tmp_file_pre_pre"
|
||||
;;
|
||||
|
||||
# Copy files and create directories (preserving permissions),
|
||||
# skipping anything located in /etc/.
|
||||
#
|
||||
# The 'test' will run with '-e' for no-overwrite and '-z'
|
||||
# for overwrite.
|
||||
case $file in
|
||||
/etc/*[!/])
|
||||
# Handle /etc/ files in a special way (via a 3-way checksum) to
|
||||
# determine how these files should be installed. Do we overwrite
|
||||
# the existing file? Do we install it as $file.new to avoid
|
||||
# deleting user configuration? etc.
|
||||
#
|
||||
# This is more or less similar to Arch Linux's Pacman with the
|
||||
# user manually handling the .new files when and if they appear.
|
||||
test "$1" "$_file" || pkg_etc "$file" "$_tmp_file_pre_pre"
|
||||
;;
|
||||
*/)
|
||||
# Skip directories if they already exist in the file system.
|
||||
# (Think /usr/bin, /usr/lib, etc).
|
||||
[ -d "$_file" ] || {
|
||||
file_rwx "$2/${file#/}"
|
||||
mkdir -m "$oct" "$_file"
|
||||
}
|
||||
;;
|
||||
|
||||
*/)
|
||||
# Skip directories if they already exist in the file system.
|
||||
# (Think /usr/bin, /usr/lib, etc).
|
||||
[ -d "$_file" ] || {
|
||||
file_rwx "$2/${file#/}"
|
||||
mkdir -m "$oct" "$_file"
|
||||
}
|
||||
;;
|
||||
*)
|
||||
if [ -d "$_file" ] || test "$1" "$_file"; then
|
||||
# Skip directories as they're likely symlinks in this case.
|
||||
# Pure directories in manifests have a suffix of '/'.
|
||||
continue
|
||||
|
||||
*)
|
||||
if [ -d "$_file" ] || test "$1" "$_file"; then
|
||||
# Skip directories as they're likely symlinks in this case.
|
||||
# Pure directories in manifests have a suffix of '/'.
|
||||
continue
|
||||
elif [ -h "$_file" ]; then
|
||||
# Copy the file to the destination directory overwriting
|
||||
# any existing file.
|
||||
cp -fP "$2$file" "${_file%/*}/."
|
||||
|
||||
elif [ -h "$_file" ]; then
|
||||
# Copy the file to the destination directory overwriting
|
||||
# any existing file.
|
||||
cp -fP "$2$file" "${_file%/*}/."
|
||||
else
|
||||
# Construct a temporary filename which is a) unique and
|
||||
# b) identifiable as related to the package manager.
|
||||
__tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID
|
||||
|
||||
else
|
||||
# Construct a temporary filename which is a) unique and
|
||||
# b) identifiable as related to the package manager.
|
||||
__tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID
|
||||
# Copy the file to the destination directory with the
|
||||
# temporary name created above.
|
||||
cp -fP "$2$file" "$__tmp" &&
|
||||
|
||||
# Copy the file to the destination directory with the
|
||||
# temporary name created above.
|
||||
cp -fP "$2$file" "$__tmp" &&
|
||||
|
||||
# Atomically move the temporary file to its final
|
||||
# destination. The running processes will either get
|
||||
# the old file or the new one.
|
||||
mv -f "$__tmp" "$_file"
|
||||
fi
|
||||
esac || return 1
|
||||
done
|
||||
# Atomically move the temporary file to its final
|
||||
# destination. The running processes will either get
|
||||
# the old file or the new one.
|
||||
mv -f "$__tmp" "$_file"
|
||||
fi
|
||||
esac || return 1; done
|
||||
|
||||
unset _etc_cnt
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user