aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-06 12:20:01 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-06 12:20:01 +0000
commit9ad8bbc55527c8d5eb10f7b3f88326a8b6c1a018 (patch)
treeead29176be6c241e614955f1c09359956e32a7a9 /kiss
parent7d7b317fed98723d03ffa08f944f57a7b5bc7876 (diff)
downloadcpt-9ad8bbc55527c8d5eb10f7b3f88326a8b6c1a018.tar.gz
kiss: simplify install
FossilOrigin-Name: 2190250a56fec429dfa8e7bc4b4eb4b6cfdba2c3d36396d2a16e2ad2be930a87
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss45
1 files changed, 20 insertions, 25 deletions
diff --git a/kiss b/kiss
index 4c717b2..7554f2c 100755
--- a/kiss
+++ b/kiss
@@ -939,7 +939,7 @@ pkg_install() {
# If the package is already installed (and this is an upgrade) make a
# backup of the manifest file.
- old_manifest=$(cat "$sys_db/$pkg_name/manifest" 2>/dev/null ||:)
+ cp -f "$sys_db/$pkg_name/manifest" "$mak_dir/m" 2>/dev/null ||:
# This is repeated multiple times. Better to make it a function.
pkg_rsync() {
@@ -987,35 +987,30 @@ pkg_install() {
)
# Remove any leftover files if this is an upgrade.
- [ "$old_manifest" ] && {
- printf '%s\n' "$old_manifest" |
- "$grep" -vFxf "$sys_db/$pkg_name/manifest" - |
-
- while read -r file; do
- # Skip deleting some leftover files.
- case $file in
- /etc/*|*bin/rm|*bin/busybox|*bin/rsync) continue
- esac
+ "$grep" -vFxf "$sys_db/$pkg_name/manifest" "$mak_dir/m" 2>/dev/null |
- file=$KISS_ROOT/$file
+ while read -r file; do
+ file=$KISS_ROOT/$file
- # Remove files.
- if [ -f "$file" ] && [ ! -L "$file" ]; then
- rm -f "$file"
+ # Skip deleting some leftover files.
+ case $file in /etc/*) continue; esac
- # Remove file symlinks.
- elif [ -L "$file" ] && [ ! -d "$file" ]; then
- unlink "$file" ||:
+ # Remove files.
+ if [ -f "$file" ] && [ ! -L "$file" ]; then
+ rm -f "$file"
- # Skip directory symlinks.
- elif [ -L "$file" ] && [ -d "$file" ]; then :
+ # Remove file symlinks.
+ elif [ -L "$file" ] && [ ! -d "$file" ]; then
+ unlink "$file" ||:
- # Remove directories if empty.
- elif [ -d "$file" ]; then
- rmdir "$file" 2>/dev/null ||:
- fi
- done ||:
- }
+ # Skip directory symlinks.
+ elif [ -L "$file" ] && [ -d "$file" ]; then :
+
+ # Remove directories if empty.
+ elif [ -d "$file" ]; then
+ rmdir "$file" 2>/dev/null ||:
+ fi
+ done ||:
# Install the package again to fix any non-leftover files being
# removed above.