diff options
author | Simon Rettberg | 2020-12-18 14:21:15 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-12-18 14:21:15 +0100 |
commit | 1d39683412d6237091620c9dfd3dc59536275210 (patch) | |
tree | 31fecad325ee6503230808c54313b446d76f2090 | |
parent | [SSPS] dmsd.service: dmsd needs internet connectivity (diff) | |
download | setup-scripts-1d39683412d6237091620c9dfd3dc59536275210.tar.gz setup-scripts-1d39683412d6237091620c9dfd3dc59536275210.tar.xz setup-scripts-1d39683412d6237091620c9dfd3dc59536275210.zip |
[SSPS] Fix tm-pw-patch, clean up package install
-rw-r--r-- | satellit_installer/includes/10-install_packages.inc | 54 | ||||
-rwxr-xr-x | satellit_installer/static_files/system/root/installer/rclocal_script.sh | 2 |
2 files changed, 21 insertions, 35 deletions
diff --git a/satellit_installer/includes/10-install_packages.inc b/satellit_installer/includes/10-install_packages.inc index 1892ec2..66edbb3 100644 --- a/satellit_installer/includes/10-install_packages.inc +++ b/satellit_installer/includes/10-install_packages.inc @@ -2,53 +2,39 @@ install_package() { # These stacked ifs are just a stopgap until proper trapping. - echo -n "# Installing package $PACKAGE... " - apt-get $INSTALLOPTIONS install ${PACKAGE} - ERR=$? - if [ "$ERR" -ne 0 ]; then + local PACKAGE="$1" + echo "# Installing package $PACKAGE... " + apt-get $INSTALLOPTIONS install "${PACKAGE}" && return 0 + echo + echo "# Could not install package $PACKAGE - Error number $ERR!" + echo "# Trying an apt-get update..." + if ! apt-get update; then echo - echo "# Could not install package $PACKAGE - Error number $ERR!" - echo -n "# Trying an apt-get update..." - apt-get update 2>/dev/null 1>&2 - ERR=$? - if [ "$ERR" -ne 0 ]; then - echo - echo "# apt-get update has thrown error number $ERR. You need to take care" - echo "# of this by hand. Commencing installation." - else - echo " ok." - echo -n "# Retrying installing package $PACKAGE... " - apt-get $INSTALLOPTIONS install ${PACKAGE} 2>/dev/null 1>&2 - ERR=$? - if [ "$ERR" -ne 0 ]; then - perror "Could not install $PACKAGE. Giving up." - else - echo "ok." - fi - fi - else - echo "ok." + 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." } install_packages() { + local PACKAGE local NEEDED_PACKAGES="$2" + local INSTALLOPTIONS= echo "#" echo "# Installing packages. This may take a while." echo "#" case "$1" in - NOREC) INSTALLOPTIONS="-qq -y --no-install-recommends" - for PACKAGE in $NEEDED_PACKAGES; do - install_package - done - ;; - RECOM) INSTALLOPTIONS="-qq -y" - for PACKAGE in $NEEDED_PACKAGES; do - install_package - done + NOREC) INSTALLOPTIONS="-qq -y --no-install-recommends" + ;; + RECOM) INSTALLOPTIONS="-qq -y" + ;; esac + for PACKAGE in $NEEDED_PACKAGES; do + install_package "$PACKAGE" + done } # install_files <module_name> diff --git a/satellit_installer/static_files/system/root/installer/rclocal_script.sh b/satellit_installer/static_files/system/root/installer/rclocal_script.sh index 78bf23c..577a743 100755 --- a/satellit_installer/static_files/system/root/installer/rclocal_script.sh +++ b/satellit_installer/static_files/system/root/installer/rclocal_script.sh @@ -76,7 +76,7 @@ patchfiles "%MYSQL_OPENSLX_PASS%" "$MYSQL_OPENSLX_NEW" "$WWWDIR/slx-admin/co # taskmanager password TASKMANAGER_PASS=$(generate_password) -patchfile "%TM_OPENSLX_PASS%" "$TASKMANAGER_PASS" "$WWWDIR/slx-admin/config.php" "$TASKMANDIR/config/config" +patchfiles "%TM_OPENSLX_PASS%" "$TASKMANAGER_PASS" "$WWWDIR/slx-admin/config.php" "$TASKMANDIR/config/config" echo "+++ Dienste werden aktiviert..." |