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
1 changed files with 21 additions and 0 deletions

21
kiss
View File

@ -1384,6 +1384,9 @@ pkg_install_files() {
# Skip directories if they already exist in the file system.
# (Think /usr/bin, /usr/lib, etc).
[ -d "$_file" ] || {
# The file could be a symlink or a regular file
rm -f "$_file"
file_rwx "$2/${file#/}"
mkdir -m "$oct" "$_file"
}
@ -1411,6 +1414,24 @@ pkg_install_files() {
cp -fP "$2$file" "${_file%/*}/."
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
# b) identifiable as related to the package manager.
__tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID