From 64e7338bed60d04b248506a57cc7887442d6d256 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 12 Apr 2017 13:45:19 +0000 Subject: [PATCH] projects-dir.mk: Support non-interactive install-prereq-build Support non-interactive install-prereq-build Signed-off-by: Jan Lindemann --- make/projects-dir.mk | 2 +- scripts/pkg-manager.sh | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/make/projects-dir.mk b/make/projects-dir.mk index 9a7d3be8..61e4851c 100644 --- a/make/projects-dir.mk +++ b/make/projects-dir.mk @@ -80,7 +80,7 @@ echo-prereq-build: @python $(MOD_SCRIPT_DIR)/projects.py $(PROJECTS_PY_EXTRA_ARGS) required-pkg $(BUILD_PROJECTS) install-prereq-build: - make --no-print-directory echo-prereq-build 2>/dev/null | xargs -r $(PKG_MANAGER_SH) install + make --no-print-directory echo-prereq-build 2>/dev/null | xargs -r $(PKG_MANAGER_SH) install -y echo-prereq-release: @make --no-print-directory pull.done >/dev/null 2>&1 diff --git a/scripts/pkg-manager.sh b/scripts/pkg-manager.sh index bd29af96..feff9398 100644 --- a/scripts/pkg-manager.sh +++ b/scripts/pkg-manager.sh @@ -26,17 +26,36 @@ usage() run() { log "Running ==== $@" - eval sudo "$@" + eval "$@" } cmd_install() { + 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 zypper in "$@" + [ "$non_interactive" = 1 ] && global_opts="$global_opts --non-interactive" + eval run sudo $env zypper $global_opts install "$@" ;; debian) - eval run apt-get install "$@" + [ "$non_interactive" = 1 ] && { + global_opts="$global_opts -yq" + env="$env DEBIAN_FRONTEND=noninteractive" + } + eval run sudo $env apt-get $global_opts install "$@" ;; *) fatal "Tried to install to unsupported platform \"$ID\""