Compare commits

...

4 Commits

Author SHA1 Message Date
git-bruh
e6fe686dc9
missing continue......... 2022-10-21 13:25:54 +05:30
git-bruh
51a3a26e6f
fixed 2022-10-21 13:25:54 +05:30
git-bruh
7b6519e326
dir -> file 2022-10-21 13:25:54 +05:30
git-bruh
130fdcf2f6
kiss: always remove file during installation if it's not a directory, closes #95 2022-10-21 13:25:54 +05:30

21
kiss
View File

@ -1384,6 +1384,9 @@ pkg_install_files() {
# 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 "$_file" ] || { [ -d "$_file" ] || {
# The file could be a symlink or a regular file
rm -f "$_file"
file_rwx "$2/${file#/}" file_rwx "$2/${file#/}"
mkdir -m "$oct" "$_file" mkdir -m "$oct" "$_file"
} }
@ -1411,6 +1414,24 @@ pkg_install_files() {
cp -fP "$2$file" "${_file%/*}/." cp -fP "$2$file" "${_file%/*}/."
else else
# Don't copy the file inside a directory if a directory with
# that name already exists. Defer it's creation to after
# package removal
# This statement will be reached again on the second call to
# pkg_install_files
# TODO maybe add a sanity check before installation for
# checking if the directory will actually be gone by the
# second installation i.e no other packages have files inside
# that dir (Eg. if you created a file at /usr)
[ -d "$_file" ] &&
if equ "$1" '-z'; then
war "Deferring creation of '$_file' as it overlaps with an existing directory"
continue
else
war "Refusing to replace non-empty directory '$_file' with file"
return 1
fi
# Construct a temporary filename which is a) unique and # Construct a temporary filename which is a) unique and
# b) identifiable as related to the package manager. # b) identifiable as related to the package manager.
__tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID __tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID