forked from kiss-community/kiss
Compare commits
4 Commits
master
...
fix-file-t
Author | SHA1 | Date | |
---|---|---|---|
|
e6fe686dc9 | ||
|
51a3a26e6f | ||
|
7b6519e326 | ||
|
130fdcf2f6 |
21
kiss
21
kiss
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user