Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions suse-online-update.sysconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,21 @@ IGNORE_SERVICES_FROM_RESTART='dbus udev'
#
INCLUDE_OPTIONAL='no'

## Type: yesno
## Default: no
#
# Exclude recommends packages
#
# If enabled, the script adds the "--no-recommends" parameter
# when calling zypper to install updates w/o recommended packages.
#
EXCLUDE_RECOMMENDS="no"

## Type: string
## Default: non_interactive
#
# Call zypper in specific interactive mode.
# Default global option is '--non-interactive'.
# You can change to value "include_reboot" that use switch '--non-interactive-include-reboot-patches'.
#
INTERACTIVE_MODE="non_interactive"
30 changes: 27 additions & 3 deletions suse.de-online-update
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ZYPPER_UPDATE_TYPE='patch'
RESTART_SERVICES='no'
INCLUDE_OPTIONAL='no'
IGNORE_SERVICES_FROM_RESTART='dbus udev'
EXCLUDE_RECOMMENDS='no'
INTERACTIVE_MODE='non_interactive'
##################################################
LOGDIR=$(dirname "$LOGFILE")
LOGNAME='suse-online-update'
Expand Down Expand Up @@ -95,6 +97,8 @@ function usage(){
echo " -d : print debug output on console (default: $DEBUG)"
echo " -r : restart services (default: $RESTART_SERVICES)"
echo " -o : install optional updates (default: $INCLUDE_OPTIONAL)"
echo " -n : install w/o recommended packages (default: $EXCLUDE_RECOMMENDS)"
echo " -i <mode> : use non interactive global option (default: $INTERACTIVE_MODE)"
echo " -t <type> : use 'type' for $ZYPPER update command (default: $ZYPPER_UPDATE_TYPE)"
echo " supported types: patch, package, pattern, product, srcpackage"
echo " -e <email> : send error messages to this Email address (default: $EMAIL)"
Expand All @@ -106,7 +110,7 @@ function usage(){
echo
}

while getopts 'de:f:l:cphrot:' OPT; do
while getopts 'de:f:l:cphront:i:' OPT; do
case "$OPT" in
d) DEBUG='yes'
;;
Expand All @@ -124,6 +128,10 @@ while getopts 'de:f:l:cphrot:' OPT; do
;;
o) INCLUDE_OPTIONAL='yes'
;;
n) EXCLUDE_RECOMMENDS='yes'
;;
i) INTERACTIVE_MODE="$OPTARGS"
;;
t) ZYPPER_UPDATE_TYPE="$OPTARG"
;;
h) usage; exit 0;
Expand Down Expand Up @@ -194,14 +202,30 @@ case "$START_UPDATE" in
LOG "ERROR: Please set a correct value for ZYPPER_UPDATE_TYPE in $DISTCONFIG. Found: $ZYPPER_UPDATE_TYPE; using 'patch' for now"
;;
esac
case "$INTERACTIVE_MODE" in
'non_interactive')
MODE="--non-interactive"
;;
'include_reboot')
MODE="--non-interactive-include-reboot-patches"
;;
*)
MODE="--non-interactive"
LOG "ERROR: Please set a correct value for INTERACTIVE_MODE in $DISTCONFIG. Found: $INTERACTIVE_MODE; using 'non_interactive; for now"
;;
esac
OPTIONAL=""
if [ x"$INCLUDE_OPTIONAL" == x"yes" ] && [ x"$ZYPPER_UPDATE_TYPE" != x"package" ]; then
OPTIONAL="--with-optional"
fi
NO_RECOMMENDS=""
if [ x"$EXCLUDE_RECOMMENDS" == x"yes" ]; then
NO_RECOMMENDS="--no-recommends"
fi
if [ "$UPDATETYPE" == "patch" ] && [ "$OPTIONAL" == "--with-optional" ] ; then
$ZYPPER --non-interactive --terse $UPDATETYPE --no-confirm $OPTIONAL --skip-interactive 2>"$TMPFILE" 1>/dev/null
$ZYPPER $MODE --terse $UPDATETYPE --no-confirm $OPTIONAL $NO_RECOMMENDS --skip-interactive 2>"$TMPFILE" 1>/dev/null
else
$ZYPPER --non-interactive --terse up --no-confirm -t $UPDATETYPE $OPTIONAL --skip-interactive 2>"$TMPFILE" 1>/dev/null
$ZYPPER $MODE --terse up --no-confirm -t $UPDATETYPE $OPTIONAL $NO_RECOMMENDS --skip-interactive 2>"$TMPFILE" 1>/dev/null
fi
ZYPP_RET=$(echo $?)
case "$ZYPP_RET" in
Expand Down