From 4b365ad1f899df961cca9fed80b682cc4a5c7ece Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:14:33 +0000 Subject: kiss: Add option to show diffs on update FossilOrigin-Name: f27b1c89ae8fca281d3053b3e28abce0f6811885a84e6b81af65a44d668d77ca --- kiss | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kiss b/kiss index 30d158d..0c77e47 100755 --- a/kiss +++ b/kiss @@ -1034,6 +1034,11 @@ pkg_updates() { # shellcheck disable=2046,2086 { IFS=:; set -- $KISS_PATH; IFS=$old_ifs; } + # Where to store repository diffs for the update. + # At the same time, create the file so updates requiring root don't + # overwrite the user's existing permissions over the log. + :> "${log_file:=$log_dir/update-$time-$pid}" + # Update each repository in '$KISS_PATH'. It is assumed that # each repository is 'git' tracked. for repo; do @@ -1065,6 +1070,7 @@ pkg_updates() { if [ -w "$PWD" ] && [ "$(id -u)" != 0 ]; then git fetch + git diff >> "$log_file" git merge else @@ -1078,12 +1084,15 @@ pkg_updates() { # case that the repository is owned by a 3rd user. ( user=$(stat -c %U "$PWD") + pull="git fetch && git diff >>'$log_file' && git merge" [ "$user" = root ] || log "Dropping permissions to $user for pull" - as_root git fetch - as_root git merge + case $su in + su) as_root "$pull" ;; + *) as_root sh -c "$pull" ;; + esac ) fi } @@ -1136,6 +1145,14 @@ pkg_updates() { log "Packages to update: ${outdated% }" + # Show a diff of each new change to the repositories. + # This spawns the user's set PAGER with a fallback to less. + [ -s "$log_file" ] && { + log "Saved update log to $log_file" + + [ "$KISS_AUDIT" ] && "${PAGER:-less}" "$log_file" + } + # Tell 'pkg_build' to always prompt before build. pkg_update=1 -- cgit v1.2.3 From e0738e2487dae46282fa57bde681373287f7d0d9 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:17:35 +0000 Subject: docs: update FossilOrigin-Name: 855177e478872275e79ecdba8872a2e2a5c5cee3766b0881783290430c53364d --- kiss.1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kiss.1 b/kiss.1 index 8c17310..dd3d699 100644 --- a/kiss.1 +++ b/kiss.1 @@ -63,6 +63,14 @@ export KISS_RM=usr/share/doc:usr/share/gtk-doc:usr/share/info:usr/share/polkit-1 # Set it to '1' to force. export KISS_FORCE=0 +# Show diffs on system updates. +# +# This will spawn '$PAGER' (fallback to 'less') with a diff +# of each changed file in the system update. +# +# Set it to '1' to enable. +export KISS_AUDIT=0 + # Hook into kiss through a script. # # This can be used set custom CFLAGS per package, modify builds, -- cgit v1.2.3 From 9b85e2e1a8d8cf37d69f856bd83014a19cf9b043 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:18:13 +0000 Subject: docs: update FossilOrigin-Name: a9142a9783beb22dff0e0147db42520a0f2b16c232a17936e866145d018cab7d --- README.md | 8 ++++++++ kiss.1 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8133259..a8181f7 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,14 @@ export KISS_RM=usr/share/doc:usr/share/gtk-doc:usr/share/info:usr/share/polkit-1 # Set it to '1' to force. export KISS_FORCE=0 +# Show diff on system updates. +# +# This will spawn '$PAGER' (fallback to 'less') with a diff +# of each changed file in the system update. +# +# Set it to '1' to enable. +export KISS_AUDIT=0 + # Hook into kiss through a script. # # This can be used set custom CFLAGS per package, modify builds, diff --git a/kiss.1 b/kiss.1 index dd3d699..53d3213 100644 --- a/kiss.1 +++ b/kiss.1 @@ -63,7 +63,7 @@ export KISS_RM=usr/share/doc:usr/share/gtk-doc:usr/share/info:usr/share/polkit-1 # Set it to '1' to force. export KISS_FORCE=0 -# Show diffs on system updates. +# Show diff on system updates. # # This will spawn '$PAGER' (fallback to 'less') with a diff # of each changed file in the system update. -- cgit v1.2.3 From 1e19ef509402455cff9e25c565e390e43723e424 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:21:40 +0000 Subject: kiss: Prevent Ctrl+C or > 0 exit from pager causing kiss to abort FossilOrigin-Name: c658af6c544ef3818215b492076e4c5b0a050d5a0e00ec6b2e14a3b05abb1f85 --- kiss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index 0c77e47..f1f107a 100755 --- a/kiss +++ b/kiss @@ -1147,11 +1147,16 @@ pkg_updates() { # Show a diff of each new change to the repositories. # This spawns the user's set PAGER with a fallback to less. + # + # Disable this warning as the behavior (C may run when A is true) + # is intentional and fine. It is to prevent pager error from + # causing the package manager to abort. + # shellcheck disable=2015 [ -s "$log_file" ] && { log "Saved update log to $log_file" [ "$KISS_AUDIT" ] && "${PAGER:-less}" "$log_file" - } + } ||: # Tell 'pkg_build' to always prompt before build. pkg_update=1 -- cgit v1.2.3 From 299593b1219f49806f2afccc91f9b7c0cf669dae Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:29:04 +0000 Subject: kiss: Don't keep logs around for updates. git does this for us. FossilOrigin-Name: c93b23820dd58e774c85906801d68ffd72d1b765abae6e00260e648947686320 --- kiss | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/kiss b/kiss index f1f107a..6aa0ce5 100755 --- a/kiss +++ b/kiss @@ -1037,7 +1037,7 @@ pkg_updates() { # Where to store repository diffs for the update. # At the same time, create the file so updates requiring root don't # overwrite the user's existing permissions over the log. - :> "${log_file:=$log_dir/update-$time-$pid}" + :> "$mak_dir/log" # Update each repository in '$KISS_PATH'. It is assumed that # each repository is 'git' tracked. @@ -1070,7 +1070,7 @@ pkg_updates() { if [ -w "$PWD" ] && [ "$(id -u)" != 0 ]; then git fetch - git diff >> "$log_file" + git diff >> "$mak_dir/log" git merge else @@ -1084,7 +1084,7 @@ pkg_updates() { # case that the repository is owned by a 3rd user. ( user=$(stat -c %U "$PWD") - pull="git fetch && git diff >>'$log_file' && git merge" + pull="git fetch && git diff >>'$mak_dir/log' && git merge" [ "$user" = root ] || log "Dropping permissions to $user for pull" @@ -1147,16 +1147,7 @@ pkg_updates() { # Show a diff of each new change to the repositories. # This spawns the user's set PAGER with a fallback to less. - # - # Disable this warning as the behavior (C may run when A is true) - # is intentional and fine. It is to prevent pager error from - # causing the package manager to abort. - # shellcheck disable=2015 - [ -s "$log_file" ] && { - log "Saved update log to $log_file" - - [ "$KISS_AUDIT" ] && "${PAGER:-less}" "$log_file" - } ||: + [ "$KISS_AUDIT" ] && "${PAGER:-less}" "$mak_dir/log" # Tell 'pkg_build' to always prompt before build. pkg_update=1 -- cgit v1.2.3 From 2658dc45f761ddd7a01670dfb1b37bca99b6a2ec Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sun, 9 Feb 2020 09:33:54 +0000 Subject: kiss: only show diffs if file has contents FossilOrigin-Name: a745830474acc6d30160f0097e7a3ae1e911ee7fa34acc23e73365b00f4c169d --- kiss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index 6aa0ce5..f829f2f 100755 --- a/kiss +++ b/kiss @@ -1147,7 +1147,8 @@ pkg_updates() { # Show a diff of each new change to the repositories. # This spawns the user's set PAGER with a fallback to less. - [ "$KISS_AUDIT" ] && "${PAGER:-less}" "$mak_dir/log" + [ -s "$mak_dir/log" ] && [ "$KISS_AUDIT" = 1 ] && + "${PAGER:-less}" "$mak_dir/log" # Tell 'pkg_build' to always prompt before build. pkg_update=1 -- cgit v1.2.3