cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 428a388c3931a082e989795fcd1ff2a3524089d6
parent 1b3260b891f61cc0ea2b784a28dbe84eca3dabe3
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Thu,  6 Feb 2020 14:20:01 +0200

kiss: simplify install

Diffstat:
Mkiss | 45++++++++++++++++++++-------------------------
1 file changed, 20 insertions(+), 25 deletions(-)

diff --git 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.