From 7fc02d740319b4fdb4fdaeec69d8fc7b87c87da6 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Sun, 14 Sep 2025 17:47:17 +0800 Subject: upd auto update PKGBUILDs; less empty line in log --- sh/upd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'sh') diff --git a/sh/upd b/sh/upd index 64d9435..195acec 100755 --- a/sh/upd +++ b/sh/upd @@ -193,6 +193,8 @@ userjs () { } misc () { + nv= + "$EDITOR" +PlugClean! +PlugUpdate +qa if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzpp ]; then @@ -200,6 +202,14 @@ misc () { fi if [ "$hostname" = xyzinsp ]; then + # nvchecker pkgctl updated pkgbuilds. Need test, commit, push, and aurpublish. + # Test shows pkgctl version upgrade need 2>&1, else awk not work, not + # sure why, maybe related to pkgctl's pretty outputs. + # Test shows awk need $3 instead of $2, not sure why. + nv="$(pkgctl version upgrade "$HOME/programs/repos/aur/stardict-wikt-en-all" \ + "$HOME/programs/repos/aur/stardict-wikt-en-en" 2>&1 \ + | tee /dev/tty \ + | awk -F'[: ]' '/upgraded/{printf(" %s",$3)}')" sudo hardcode-fixer ssh pp '[ -s "$HOME/.local/share/sdcv_history" ] && cat "$HOME/.local/share/sdcv_history" && rm "$HOME/.local/share/sdcv_history"' >> "$XDG_DATA_HOME/sdcv_history" awk '!a[$0]++' "$XDG_DATA_HOME/sdcv_history" | sponge "$XDG_DATA_HOME/sdcv_history" @@ -225,6 +235,9 @@ misc () { git -C "$HOME/programs/roff/myresume" pull pass git pull fi + + log="${log}nvchecker:$nv +" } pac () { @@ -271,8 +284,7 @@ pac () { # pacdiff default use pacman database, so no need `sudo -E` for find, but will be a little bit slower # [^-] consider util-linux; \(^\|[^-]\) consider linux is the first package, ex: pacout is only 'linux-6.6.6' - log="$log -updated pacman packages: $pacpacs + log="${log}updated pacman packages: $pacpacs updated aur packages: $aurpacs pacdiff: $(pacdiff -o | tr '\n' ' ') checkrebuild: $checkrebuild_pacs @@ -380,7 +392,7 @@ else esac done fi -[ "$log" ] && printf '%s' "$log" | tee "$XDG_DOCUMENTS_DIR/logs/upd.log" +[ "$log" ] && printf '\n%s' "$log" | tee "$XDG_DOCUMENTS_DIR/logs/upd.log" [ "$hostname" = xyzpp ] && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type suspend # `[ "$hostname" = xyzpp ] && ...` if check failed will have exit status of 1, unlike check with `if` # I decided to always `exit 0` if reached end, so commands like `upd -p && ...` can keep running -- cgit v1.2.3-70-g09d2