aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-16 16:50:56 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-16 16:50:56 +0000
commita2cce399d7d6fe1758e698e752143d31da9fb259 (patch)
tree538bb308cf841c0d76667d3a9b8ade59bdf63347 /kiss
parent9ca70045a914a8e1aa982cc8e554857739167b95 (diff)
downloadcpt-a2cce399d7d6fe1758e698e752143d31da9fb259.tar.gz
kiss: Fix pkg_install if coreutils is reinstalled.
FossilOrigin-Name: 49db3f380a88be385c8d8db302a61f6e67733d9e3a235aba2ddb7f4a74bd603a
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss16
1 files changed, 13 insertions, 3 deletions
diff --git a/kiss b/kiss
index a2edff5..a35f9d0 100755
--- a/kiss
+++ b/kiss
@@ -137,8 +137,13 @@ pkg_tar() {
pkg_install() {
[ -f "$bin_dir/$pkg" ] || args b "$name"
+ # Create a backup of 'tar' so it isn't removed during
+ # package installation.
+ cp "$(command -v tar)" "$cac_dir"
+
pkg_remove "$name"
- tar pxvf "$bin_dir/$pkg" -k -C "$sys_dir/" 2>/dev/null
+ "$cac_dir/tar" kpxvf "$bin_dir/$pkg" -C "$sys_dir/"
+ rm "$cac_dir/tar"
"$sys_db/$name/post-install" 2>/dev/null
@@ -148,13 +153,18 @@ pkg_install() {
pkg_remove() {
pkg_list "$name" || return 1
+ # Create a backup of 'rm' and 'rmdir' so they aren't
+ # removed during package installation.
+ cp "$(command -v rm)" "$cac_dir"
+ cp "$(command -v rmdir)" "$cac_dir"
+
while read -r file; do
[ "${file%/*}" = /etc ] && continue
if [ -d "$sys_dir$file" ]; then
- rmdir "$sys_dir$file" 2>/dev/null || continue
+ "$cac_dir/rmdir" "$sys_dir$file" 2>/dev/null || continue
else
- rm -f -- "$sys_dir$file" || log "Failed to remove $file."
+ "$cac_dir/rm" -f -- "$sys_dir$file" || log "Failed to remove $file."
fi && log "Removed $file"
done < "$sys_db/$name/manifest"
}