#!/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