diff options
author | Simon Rettberg | 2018-04-20 13:04:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-04-20 13:04:30 +0200 |
commit | aa4a86d7da14e6929f3dd0cccc7be5ba6b57b967 (patch) | |
tree | b92641cb43d74256c674f2c24b4580a14bbff364 /satellit_upgrader | |
parent | [SSPS] Don't start tftpd-hpa in verbose mode (diff) | |
download | setup-scripts-aa4a86d7da14e6929f3dd0cccc7be5ba6b57b967.tar.gz setup-scripts-aa4a86d7da14e6929f3dd0cccc7be5ba6b57b967.tar.xz setup-scripts-aa4a86d7da14e6929f3dd0cccc7be5ba6b57b967.zip |
[SSUS] Replace atftpd by tftpd-hpa
Diffstat (limited to 'satellit_upgrader')
-rwxr-xr-x | satellit_upgrader/pack-update.sh | 30 | ||||
-rw-r--r-- | satellit_upgrader/updater.template.sh | 75 |
2 files changed, 63 insertions, 42 deletions
diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh index 36e54d0..37b96c1 100755 --- a/satellit_upgrader/pack-update.sh +++ b/satellit_upgrader/pack-update.sh @@ -80,15 +80,19 @@ addpayload () { addinstallfile () { echo -n "Includes $1: " - local FILENAME=$1 + local file=$1 + local path=$(dirname "$file") if [ ! -d "../satellit_installer" ]; then - echo "no (satellit_installer not found)" - elif [ ! -e "../satellit_installer/static_files/$1" ]; then - echo "no (file not found in satellit_installer/static_files)" - elif cp "../satellit_installer/static_files/$1" "files/$1"; then - echo "yes" + echo "NO! (satellit_installer not found)" + elif [ ! -e "../satellit_installer/static_files/$file" ]; then + echo "NO! (file not found in satellit_installer/static_files)" else - echo "...no! (copy failed)" + mkdir -p "files/$path" || echo -n "(mkdir failed) " + if cp "../satellit_installer/static_files/$file" "files/$file"; then + echo "yes" + else + echo "...no! (copy failed)" + fi fi } @@ -116,7 +120,6 @@ addpayload "TGZ_LDADP" "ldap/ad proxy" addpayload "TGZ_DNBD3" "dnbd3-server" if [ -z "$LEAN" ]; then - addinstallfile "atftpd.service" addinstallfile "lighttpd.conf" addinstallfile "lighttpd-auto-ssl.sh" addinstallfile "lighttpd-include-conf-d.sh" @@ -126,10 +129,13 @@ if [ -z "$LEAN" ]; then addinstallfile "patch_lighttpd_phpchildren" # Not quite ideal, watch out for similar names - addinstallfile "dnbd3-server.service" - addinstallfile "is-enabled" - addinstallfile "server.conf" - addinstallfile "rpc.acl" + addinstallfile "dnbd3/dnbd3-server.service" + addinstallfile "dnbd3/is-enabled" + addinstallfile "dnbd3/server.conf" + addinstallfile "dnbd3/rpc.acl" + + addinstallfile "tftpd/tftpd-hpa.service" + addinstallfile "tftpd/tftpd-hpa" # TODO: Unify more source ../satellit_installer/includes/10-sudo_config.inc diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index 2b9ca8f..221ab42 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -106,6 +106,18 @@ diffcp () { return 0 } +# failprint apt-get install foobar +# Only prints command output to stdout if exit code is not 0 +failprint () { + local tf ret + tf=$(mktemp) + "$@" &> "$tf" + ret=$? + [ "$ret" != 0 ] && cat "$tf" + rm -f -- "$tf" + return "$ret" +} + # ** Constants - to be patched by the packaging script declare -rg TARGET_WEBIF_VERSION="%TARGET_WEBIF_VERSION%" declare -rg TGZ_SLXADMIN="%TGZ_SLXADMIN%" @@ -351,20 +363,6 @@ if [ -n "$TGZ_DOZMOD" ]; then echo "dmsd upgrade complete" fi -# ************************** TFTP ************************** -if [ -n "$TGZ_TFTP" ]; then - [ -e "$TMPDIR/$TGZ_TFTP" ] || perror "$TGZ_TFTP missing from payload" - echo "* TFTP" - echo "Extracting" - rm -rf -- "$PATH_TFTP/v4" "$PATH_TFTP/v6" "$PATH_TFTP/ipxelinux.0" "$PATH_TFTP/pxelinux.0" - mkdir -p "$PATH_TFTP" - tar -x -C "$PATH_TFTP" -f "$TMPDIR/$TGZ_TFTP" || perror "Could not extract $TGZ_TFTP to $PATH_TFTP" - fixperms "$PATH_TFTP" taskmanager:taskmanager - echo "Resetting pxe menu" - mysql -e 'UPDATE openslx.property SET value = "invalid" WHERE name = "server-ip"' || pwarning "Could not reset pxe menu status; manual regeneration of menu required" - echo "TFTP upgrade complete" -fi - echo "* Configuring lighttpd" RESTART_LIGHTY= @@ -423,21 +421,38 @@ if ! grep -q -E '^\s*post_max_size = 100M' "$PHPINIFILE"; then RESTART_LIGHTY=ja fi -# ******************* atftpd update ************************ -echo "* Updating atftpd" -if [ "$MAJOR" = 8 ] && [ -s "$FILEDIR/atftpd32.deb" ] && [ "$(uname -m)" == "i686" ]; then - echo "Updating package" - if ! dpkg -i "$FILEDIR/atftpd32.deb" > "$TMPDIR/apt.log" 2>&1; then - cat "$TMPDIR/apt.log" - pwarning "Could not update atftpd." +echo "* TFTP" + +# ************************** TFTP ************************** +if [ -n "$TGZ_TFTP" ]; then + [ -e "$TMPDIR/$TGZ_TFTP" ] || perror "$TGZ_TFTP missing from payload" + echo "Extracting tftp server dir contents" + rm -rf -- "$PATH_TFTP/v4" "$PATH_TFTP/v6" "$PATH_TFTP/ipxelinux.0" "$PATH_TFTP/pxelinux.0" + mkdir -p "$PATH_TFTP" + tar -x -C "$PATH_TFTP" -f "$TMPDIR/$TGZ_TFTP" || perror "Could not extract $TGZ_TFTP to $PATH_TFTP" + fixperms "$PATH_TFTP" taskmanager:taskmanager + echo "Resetting pxe menu" + mysql -e 'UPDATE openslx.property SET value = "invalid" WHERE name = "server-ip"' || pwarning "Could not reset pxe menu status; manual regeneration of menu required" +fi + +# ************* replace atftpd with tftpd-hpa ************** +chg=false +if which "atftpd" &>/dev/null || dpkg-query -W -f='${db:Status-Abbrev}' "atftpd" | grep -q '^ii' \ + || ! which "in.tftpd" &>/dev/null; then + if diffcp "tftpd/tftpd-hpa" "/etc/default/tftpd-hpa"; then + echo "Replacing atftpd with tftpd-hpa" + failprint apt-get remove -y atftpd || pwarning "Could not uninstall atftpd" + failprint apt-get install -y tftpd-hpa || perror "Could not install tftpd-hpa" + chg=true fi fi -# ********************** atftpd.service ******************** -if diffcp "atftpd.service" "/etc/systemd/system/atftpd.service"; then - ln -s -f "../atftpd.service" "/etc/systemd/system/multi-user.target.wants/" +diffcp "tftpd/tftpd-hpa" "/etc/default/tftpd-hpa" && chg=true +diffcp "tftpd/tftpd-hpa.service" "/etc/systemd/system/tftpd-hpa.service" && chg=true +if "$chg"; then + ln -s -f "../tftpd-hpa.service" "/etc/systemd/system/multi-user.target.wants/" systemctl daemon-reload - restart_service atftpd + restart_service tftpd-hpa.service fi # ********************** dmsd.service ********************** @@ -471,7 +486,7 @@ if ! id -u dnbd3 &> /dev/null; then echo "User added" fi -if ! dpkg -l | grep -q "^ii\\s.*$PACKAGE_LIBJANSSON"; then +if ! dpkg -l "$PACKAGE_LIBJANSSON" | grep -q "^ii\\s.*$PACKAGE_LIBJANSSON"; then echo "Installing $PACKAGE_LIBJANSSON" if ! apt-get install -y "$PACKAGE_LIBJANSSON" &> "$TMPDIR/apt.log"; then cat "$TMPDIR/apt.log" @@ -488,9 +503,9 @@ if ! dpkg -l | grep -q "^ii\\s.*$PACKAGE_LIBJANSSON"; then fi # config -diffcp "server.conf" "/etc/dnbd3-server/server.conf" -diffcp "is-enabled" "$PATH_DNBD3/is-enabled" -diffcp "$FILEDIR/rpc.acl" "/etc/dnbd3-server/rpc.acl" +diffcp "dnbd3/server.conf" "/etc/dnbd3-server/server.conf" +diffcp "dnbd3/rpc.acl" "/etc/dnbd3-server/rpc.acl" +diffcp "dnbd3/is-enabled" "$PATH_DNBD3/is-enabled" if [ -n "$TGZ_DNBD3" ]; then echo "Extracting new dnbd3-server binary" @@ -498,7 +513,7 @@ if [ -n "$TGZ_DNBD3" ]; then fi # ********************** dnbd3.service ******************* -if diffcp "dnbd3-server.service" "/etc/systemd/system/dnbd3-server.service"; then +if diffcp "dnbd3/dnbd3-server.service" "/etc/systemd/system/dnbd3-server.service"; then ln -s -f "../dnbd3-server.service" "/etc/systemd/system/multi-user.target.wants/" systemctl daemon-reload echo "Service file replaced" |