From 91fca8e7911e02e8faf7990d566d43742285ae64 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 28 Jun 2017 09:27:11 +0000 Subject: [PATCH] pkg-manager.sh: Add -y support to command refresh Signed-off-by: Jan Lindemann --- scripts/pkg-manager.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/pkg-manager.sh b/scripts/pkg-manager.sh index e3d58c0a..57b0b5d2 100644 --- a/scripts/pkg-manager.sh +++ b/scripts/pkg-manager.sh @@ -68,9 +68,26 @@ cmd_install() cmd_refresh() { + local env opts global_opts + local non_interactive + + set -- `getopt 'y' $*` + while [ "$1" != -- ] ; do + case "$1" in + -y) + non_interactive=1 + ;; + esac + shift + done + shift + case $ID in opensuse|suse) - eval run sudo $env zypper $global_opts refresh "$@" + [ "$non_interactive" = 1 ] && { + global_opts="$global_opts --non-interactive --gpg-auto-import-keys --no-gpg-checks" + } + eval run sudo $env zypper $global_opts refresh $opts "$@" ;; debian) eval run sudo $env apt-get $global_opts update "$@"