aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-19 15:05:41 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-19 15:05:41 +0000
commitaf1e05923483ed427232c3b56cc24487e393be07 (patch)
treea95548940e8489b7f8901ea203312dfac68d8f79
parent524c4ac8717ba99f88d5ad938829e1dea79e0ac2 (diff)
downloadcpt-af1e05923483ed427232c3b56cc24487e393be07.tar.gz
kiss: add missing case to etcsums. Print information to user.
FossilOrigin-Name: 50133f09c54fa7c1c48b058f599154ed8d9cd65f3d3677fe6cc89570d647048b
-rwxr-xr-xkiss29
1 files changed, 23 insertions, 6 deletions
diff --git a/kiss b/kiss
index d59fc99..24f3c27 100755
--- a/kiss
+++ b/kiss
@@ -952,8 +952,9 @@ pkg_install() {
trap '' INT
# If the package is already installed (and this is an upgrade) make a
- # backup of the manifest file.
+ # backup of the manifest and etcsums files.
cp -f "$sys_db/$pkg_name/manifest" "$mak_dir/m" 2>/dev/null ||:
+ cp -f "$sys_db/$pkg_name/etcsums" "$mak_dir/c" 2>/dev/null ||:
# This is repeated multiple times. Better to make it a function.
pkg_rsync() {
@@ -979,22 +980,38 @@ pkg_install() {
{
sum_new=$(sha256sum "$file")
sum_sys=$(cd "$KISS_ROOT/"; sha256sum "$file")
- sum_old=$("$grep" "$file$" "$sys_db/$pkg_name/etcsums")
+ sum_old=$("$grep" "$file$" "$mak_dir/c")
} 2>/dev/null ||:
+ log "Doing 3-way handshake for $file"
+ printf '%s\n' "Previous: ${sum_old:-null}"
+ printf '%s\n' "System: ${sum_sys:-null}"
+ printf '%s\n' "New: ${sum_new:-null}"
+
# Use a case statement to easily compare three strings at
# the same time. Pretty nifty.
- case ${sum_old:-null}${sum_sys}${sum_new} in
+ case ${sum_old:-null}${sum_sys:-null}${sum_new} in
+ # old = Y, sys = X, new = Y
+ ${sum_new}${sum_sys}${sum_old})
+ log "Skipping $file."
+ continue
+ ;;
+
# old = X, sys = X, new = X
# old = X, sys = Y, new = Y
# old = X, sys = X, new = Y
${sum_old}${sum_old}${sum_old}|\
${sum_old:-null}${sum_sys}${sum_sys}|\
- ${sum_sys}${sum_old}*) new= ;;
+ ${sum_sys}${sum_old}*)
+ log "Installing $file."
+ new=
+ ;;
# All other cases.
- *) log "$pkg_name" "WARN: saving /$file as /$file.new"
- new=.new
+ *)
+ log "($pkg_name) WARN: saving /$file as /$file.new"
+ new=.new
+ ;;
esac
cp -af "$file" "$KISS_ROOT/${file}${new}"