I had the problem, that the automatic update function of YaST doesn’t work like I want it to. I just wanted it to install only those updates, that ain’t interactive, don’t need a service restart and don’t need a reboot.
YaST does only feature an online update that skips “interactive” updates (I’ve never even encountered an interactive update up till now). So I went ahead and wrote a (hackish) script, that achieves what I need.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#!/bin/bash TMPDIR="$( mktemp -d /tmp/autoupdate-XXXXXX )" # Wake up rug rug --quiet ping -a # Get the patchlist from rug rug --terse pch -u | grep "|Needed" | cut -d| -f2 | sed -e "s,sdkp2-,," -e "s,slesp2-,," | sort -u > $TMPDIR/patch-list for package in $( < $TMPDIR/patch-list ); do # Get the patch-details rug --terse patch-info slesp2-$package > $TMPDIR/patch-details # Parse those patch-details for "unwanted" interactions is_interactive="$( cat $TMPDIR/patch-details | grep "^Interactive:" | cut -d " " -f2 )" needs_restart="$( cat $TMPDIR/patch-details | grep "^Restart Required:" | cut -d " " -f3 )" needs_reboot="$( cat $TMPDIR/patch-details | grep "^Reboot Required:" | cut -d " " -f3 )" if [ "$is_interactive" == "No" -a "$needs_restart" == "No" -a "$needs_reboot" == "No" ] ; then tmp_package="$( cat $TMPDIR/patch-details | grep ^atom | cut -d -f2 | sed ':a;N;$!ba;s/n/ /g' )" for i in $tmp_package; do RPM_STATUS=$( rpm -qi $i ) if [ "$RPM_STATUS" != "package $i is not installed" -a "$( rug --terse lu | cut -d| -f4 | grep "$i$" )" ] ; then patch_list="$patch_list $i" fi done fi done rug --quiet install --no-confirm $patch_list rug --quiet clean-cache trap "rm -rf "$TMPDIR" >/dev/null 2>&1" ERR EXIT INT TERM HUP # vim: set tw=80 ts=2 sw=2 et softtabstop=2 |
And just for me, the crontag entry:
1 |
30 22 * * * root /usr/local/sbin/autoupdate |