From c30e0b2e08fa68676133c1c3cea9767bca40ca70 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Dec 2020 14:31:48 +0100 Subject: [SSPS] Install all packages at once --- satellit_installer/includes/10-install_packages.inc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'satellit_installer') diff --git a/satellit_installer/includes/10-install_packages.inc b/satellit_installer/includes/10-install_packages.inc index 66edbb3..0d96cfa 100644 --- a/satellit_installer/includes/10-install_packages.inc +++ b/satellit_installer/includes/10-install_packages.inc @@ -1,24 +1,20 @@ #!/bin/bash install_package() { - # These stacked ifs are just a stopgap until proper trapping. - local PACKAGE="$1" - echo "# Installing package $PACKAGE... " - apt-get $INSTALLOPTIONS install "${PACKAGE}" && return 0 + echo "# Installing packages $* ... " + apt-get $INSTALLOPTIONS install "$@" && return 0 echo - echo "# Could not install package $PACKAGE - Error number $ERR!" + echo "# Could not install $*" echo "# Trying an apt-get update..." if ! apt-get update; then - echo perror "apt-get update failed. Abort." fi - echo "# Retrying installing package $PACKAGE... " - apt-get $INSTALLOPTIONS install "${PACKAGE}" && return 0 - perror "Could not install $PACKAGE. Giving up." + echo "# Retrying installing package $* ... " + apt-get $INSTALLOPTIONS install "$@" && return 0 + perror "Could not install $* - Giving up." } install_packages() { - local PACKAGE local NEEDED_PACKAGES="$2" local INSTALLOPTIONS= @@ -32,9 +28,7 @@ install_packages() { RECOM) INSTALLOPTIONS="-qq -y" ;; esac - for PACKAGE in $NEEDED_PACKAGES; do - install_package "$PACKAGE" - done + install_package $NEEDED_PACKAGES # No quotes } # install_files -- cgit v1.2.3-55-g7522