aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-22 08:14:05 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-22 08:14:05 +0000
commit6d8d0671b783c0cab2bbf524445b3522ac16db05 (patch)
treedf4aef3bfa55fbeaa8acce4778f978d4dba3d198 /kiss
parent018b10576e47cc57277751b95044f507b16bf3de (diff)
downloadcpt-6d8d0671b783c0cab2bbf524445b3522ac16db05.tar.gz
kiss: Make backup of rm command.
FossilOrigin-Name: d6d69f42381d6a2cb63b78b6cdc55a6a4355cc1c9804705a93b2503cfc471209
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss9
1 files changed, 6 insertions, 3 deletions
diff --git a/kiss b/kiss
index 07d6bb5..dc7b5e2 100755
--- a/kiss
+++ b/kiss
@@ -693,6 +693,9 @@ pkg_install() {
[ -f "$KISS_ROOT/$pkg_db/$pkg_name/manifest" ] &&
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
# (excluding '/etc/').
rsync -HKav --exclude etc -- "$tar_dir/" "$KISS_ROOT/"
@@ -706,7 +709,7 @@ pkg_install() {
awk 'NR==FNR{lines[$0];next}!($0 in lines)' \
"$KISS_ROOT/$pkg_db/$pkg_name/manifest" "$cac_dir/m-$pkg_name" |
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
# 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"
# 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() {
@@ -965,7 +968,7 @@ args() {
# Print version and exit.
v*)
- log "kiss 0.5.6"
+ log "kiss 0.5.7"
;;
# Catch all invalid arguments as well as