projects-dir.mk: Support non-interactive install-prereq-build

Support non-interactive install-prereq-build

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-04-12 13:45:19 +00:00
commit 64e7338bed
2 changed files with 23 additions and 4 deletions

View file

@ -80,7 +80,7 @@ echo-prereq-build:
@python $(MOD_SCRIPT_DIR)/projects.py $(PROJECTS_PY_EXTRA_ARGS) required-pkg $(BUILD_PROJECTS) @python $(MOD_SCRIPT_DIR)/projects.py $(PROJECTS_PY_EXTRA_ARGS) required-pkg $(BUILD_PROJECTS)
install-prereq-build: 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: echo-prereq-release:
@make --no-print-directory pull.done >/dev/null 2>&1 @make --no-print-directory pull.done >/dev/null 2>&1

View file

@ -26,17 +26,36 @@ usage()
run() run()
{ {
log "Running ==== $@" log "Running ==== $@"
eval sudo "$@" eval "$@"
} }
cmd_install() 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 case $ID in
opensuse|suse) opensuse|suse)
eval run zypper in "$@" [ "$non_interactive" = 1 ] && global_opts="$global_opts --non-interactive"
eval run sudo $env zypper $global_opts install "$@"
;; ;;
debian) 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\"" fatal "Tried to install to unsupported platform \"$ID\""