1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 16:40:07 -07:00

kiss: Make backup of rm command.

This commit is contained in:
Dylan Araps 2019-07-22 11:14:05 +03:00
parent ba19a358fe
commit 3fe96921f8

9
kiss
View File

@ -693,6 +693,9 @@ pkg_install() {
[ -f "$KISS_ROOT/$pkg_db/$pkg_name/manifest" ] && [ -f "$KISS_ROOT/$pkg_db/$pkg_name/manifest" ] &&
cp -f "$KISS_ROOT/$pkg_db/$pkg_name/manifest" "$cac_dir/m-$pkg_name" cp -f "$KISS_ROOT/$pkg_db/$pkg_name/manifest" "$cac_dir/m-$pkg_name"
# Make a backup of the `rm` command so it isn't removed below.
cp "$(command -v rm)" "$cac_dir"
# Install the package by using 'rsync' and overwrite any existing files # Install the package by using 'rsync' and overwrite any existing files
# (excluding '/etc/'). # (excluding '/etc/').
rsync -HKav --exclude etc -- "$tar_dir/" "$KISS_ROOT/" rsync -HKav --exclude etc -- "$tar_dir/" "$KISS_ROOT/"
@ -706,7 +709,7 @@ pkg_install() {
awk 'NR==FNR{lines[$0];next}!($0 in lines)' \ awk 'NR==FNR{lines[$0];next}!($0 in lines)' \
"$KISS_ROOT/$pkg_db/$pkg_name/manifest" "$cac_dir/m-$pkg_name" | "$KISS_ROOT/$pkg_db/$pkg_name/manifest" "$cac_dir/m-$pkg_name" |
while read -r file; do while read -r file; do
[ -f "$KISS_ROOT/$file" ] && rm -f "$KISS_ROOT/$file" [ -f "$KISS_ROOT/$file" ] && "$cac_dir/rm" -f "$KISS_ROOT/$file"
done done
# Install the package again to fix any non-leftover files being # Install the package again to fix any non-leftover files being
@ -795,7 +798,7 @@ pkg_clean() {
rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir"
# Remove temporary files. # Remove temporary files.
(set +f; rm -f "$cac_dir/c-"* "$cac_dir/m-"*) (set +f; rm -f "$cac_dir/c-"* "$cac_dir/m-"* "$cac_dir/rm")
} }
root_check() { root_check() {
@ -965,7 +968,7 @@ args() {
# Print version and exit. # Print version and exit.
v*) v*)
log "kiss 0.5.6" log "kiss 0.5.7"
;; ;;
# Catch all invalid arguments as well as # Catch all invalid arguments as well as