git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/os-patching-adhoc40
1 files changed, 32 insertions, 8 deletions
diff --git a/bin/os-patching-adhoc b/bin/os-patching-adhoc
index ebe8318..0b496be 100755
--- a/bin/os-patching-adhoc
+++ b/bin/os-patching-adhoc
@@ -163,16 +163,36 @@ case "$ID_LIKE" in
# Caution:
# 1. Broken package dependenciers will not be solved
# 2. Orphaned packages will be kept in-place
-
+
+ # global zypper options
+ ZGOPTS=(
+ '-q'
+ # this option also works with non-patching commands:
+ '--non-interactive-include-reboot-patches'
+ # --refresh is only an option to addrepo. Adding --no-refresh to
+ # a refresh action, however, will ignore that flag and toss a warning.
+ # Warnings are not nice, but we'll ignore that over here...
+ '--no-refresh'
+ )
+ # update/upgrade zypper options
+ ZUOPTS=(
+ '-y' '--auto-agree-with-licenses' '--no-allow-downgrade'
+ '--allow-name-change' '--allow-arch-change' '--allow-vendor-change'
+ '--solver-focus' 'Update'
+ )
header 'Refreshing zypper "services"'
mystart="$(/usr/bin/date '+%s')"
- /usr/bin/zypper -q --non-interactive refresh-services && printf 'OK.\n' || exit 110
+ # for now, refresh-services doesn't even display a warning regarding --no-refresh,
+ # but we'll keep it in case that changes. Dang, zypper is a mess at times.
+ /usr/bin/zypper "${ZGOPTS[@]}" refresh-services | grep -v -- '--no-refresh'
+ [ "${PIPESTATUS[0]}" -eq 0 ] && printf 'OK.\n' || exit 110
myend="$(/usr/bin/date '+%s')"
footer "...done ($((myend - mystart)) seconds)."
header 'Refreshing repository cache'
mystart="$(/usr/bin/date '+%s')"
- /usr/bin/zypper -q --non-interactive refresh && printf 'OK.\n' || exit 111
+ /usr/bin/zypper "${ZGOPTS[@]}" refresh | grep -v -- '--no-refresh'
+ [ "${PIPESTATUS[0]}" -eq 0 ] && printf 'OK.\n' || exit 111
myend="$(/usr/bin/date '+%s')"
footer "...done ($((myend - mystart)) seconds)."
@@ -180,16 +200,20 @@ case "$ID_LIKE" in
# installing them. If only the zypper guys were modern in thinking script or automation approaches...
header 'Running update'
mystart="$(/usr/bin/date '+%s')"
- /usr/bin/zypper -q --no-refresh --non-interactive-include-reboot-patches \
- up -y --auto-agree-with-licenses --solver-focus 'Update' && printf 'OK.\n' || exit 112
+ /usr/bin/zypper "${ZGOPTS[@]}" --no-refresh up "${ZUOPTS[@]}" && printf 'OK.\n' || exit 112
myend="$(/usr/bin/date '+%s')"
footer "...done ($((myend - mystart)) seconds)."
header 'Running dist-upgrade'
mystart="$(/usr/bin/date '+%s')"
- /usr/bin/zypper -q --no-refresh --non-interactive-include-reboot-patches \
- dup -y --allow-name-change --allow-arch-change --allow-vendor-change --no-allow-downgrade \
- --auto-agree-with-licenses --solver-focus 'Update' && printf 'OK.\n' || exit 113
+ /usr/bin/zypper "${ZGOPTS[@]}" --no-refresh dup "${ZUOPTS[@]}" && printf 'OK.\n' || exit 113
+ myend="$(/usr/bin/date '+%s')"
+ footer "...done ($((myend - mystart)) seconds)."
+
+ header 'Running "purge-kernels"'
+ # yes, there is no general cleanup actions, there is only "-u" for "rm". But there _is_ purge-kernels.
+ mystart="$(/usr/bin/date '+%s')"
+ /usr/bin/zypper "${ZGOPTS[@]}" --no-refresh purge-kernels && printf 'OK.\n' || exit 114
myend="$(/usr/bin/date '+%s')"
footer "...done ($((myend - mystart)) seconds)."