diff --git a/server/scripts/ispconfig_update.sh b/server/scripts/ispconfig_update.sh index 03c13c9aea52bc3d6bf0916e7c8d4cc597a24380..df8a24a9008a2c81083e9a088d7b50361669e3ea 100644 --- a/server/scripts/ispconfig_update.sh +++ b/server/scripts/ispconfig_update.sh @@ -1,7 +1,25 @@ #!/bin/bash -php -q \ - -d disable_classes= \ - -d disable_functions= \ - -d open_basedir= \ - /usr/local/ispconfig/server/scripts/ispconfig_update.php +_UPD=1 + +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## + +# padding handles script being overwritten during updates +# see https://git.ispconfig.org/ispconfig/ispconfig3/issues/4227 + +{ +if [ -n "${_UPD}" ] +then + exec php -q \ + -d disable_classes= \ + -d disable_functions= \ + -d open_basedir= \ + /usr/local/ispconfig/server/scripts/ispconfig_update.php +fi +} + diff --git a/server/scripts/update_stable.sh b/server/scripts/update_stable.sh index a0566480e5a976dc4fa5e64e12fe51142b0e894b..1ff4cdcfe7105e1e29b7291e9ee1d9e5f563a50a 100644 --- a/server/scripts/update_stable.sh +++ b/server/scripts/update_stable.sh @@ -1,30 +1,53 @@ #!/bin/bash -{ -{ - umask 0077 \ - && tmpdir=`mktemp -dt "$(basename $0).XXXXXXXXXX"` \ - && test -d "${tmpdir}" \ - && cd "${tmpdir}" -} || { - echo 'mktemp failed' - exit 1 -} -wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz -if [ -f ISPConfig-3-stable.tar.gz ] +_UPD=1 + +# padding handles script being overwritten during updates +# see https://git.ispconfig.org/ispconfig/ispconfig3/issues/4227 + +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## +################################################## + +{ +if [ -n "${_UPD}" ] then - tar xvfz ISPConfig-3-stable.tar.gz - cd ispconfig3_install/install/ - php -q \ - -d disable_classes= \ - -d disable_functions= \ - -d open_basedir= \ - update.php - cd /tmp - rm -rf "${tmpdir}" -else - echo "Unable to download the update." - exit 1 + { + umask 0077 \ + && tmpdir=`mktemp -dt "$(basename $0).XXXXXXXXXX"` \ + && test -d "${tmpdir}" \ + && cd "${tmpdir}" + } || { + echo 'mktemp failed' + exit 1 + } + + wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz + if [ -f ISPConfig-3-stable.tar.gz ] + then + tar xvfz ISPConfig-3-stable.tar.gz + cd ispconfig3_install/install/ + php -q \ + -d disable_classes= \ + -d disable_functions= \ + -d open_basedir= \ + update.php + cd /tmp + rm -rf "${tmpdir}" + else + echo "Unable to download the update." + exit 1 + fi + fi exit 0