diff --git a/suse-online-update.sysconfig b/suse-online-update.sysconfig index 3a94e85..26c8c8f 100644 --- a/suse-online-update.sysconfig +++ b/suse-online-update.sysconfig @@ -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" diff --git a/suse.de-online-update b/suse.de-online-update index b3d0de8..67fe968 100644 --- a/suse.de-online-update +++ b/suse.de-online-update @@ -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' @@ -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 : use non interactive global option (default: $INTERACTIVE_MODE)" echo " -t : use 'type' for $ZYPPER update command (default: $ZYPPER_UPDATE_TYPE)" echo " supported types: patch, package, pattern, product, srcpackage" echo " -e : send error messages to this Email address (default: $EMAIL)" @@ -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' ;; @@ -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; @@ -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