Skip to content

Commit 2b77ca2

Browse files
author
Till Brehm
committed
Merge branch '4227' into 'stable-3.1'
handle bash script overwrites during update. fixes #4227 See merge request !461
2 parents 7d6dfc5 + 269b2ce commit 2b77ca2

File tree

2 files changed

+70
-29
lines changed

2 files changed

+70
-29
lines changed

server/scripts/ispconfig_update.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
#!/bin/bash
22

3-
php -q \
4-
-d disable_classes= \
5-
-d disable_functions= \
6-
-d open_basedir= \
7-
/usr/local/ispconfig/server/scripts/ispconfig_update.php
3+
_UPD=1
4+
5+
##################################################
6+
##################################################
7+
##################################################
8+
##################################################
9+
##################################################
10+
##################################################
11+
12+
# padding handles script being overwritten during updates
13+
# see https://git.ispconfig.org/ispconfig/ispconfig3/issues/4227
14+
15+
{
16+
if [ -n "${_UPD}" ]
17+
then
18+
exec php -q \
19+
-d disable_classes= \
20+
-d disable_functions= \
21+
-d open_basedir= \
22+
/usr/local/ispconfig/server/scripts/ispconfig_update.php
23+
fi
24+
}
25+

server/scripts/update_stable.sh

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,53 @@
11
#!/bin/bash
2-
{
3-
{
4-
umask 0077 \
5-
&& tmpdir=`mktemp -dt "$(basename $0).XXXXXXXXXX"` \
6-
&& test -d "${tmpdir}" \
7-
&& cd "${tmpdir}"
8-
} || {
9-
echo 'mktemp failed'
10-
exit 1
11-
}
122

13-
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
14-
if [ -f ISPConfig-3-stable.tar.gz ]
3+
_UPD=1
4+
5+
# padding handles script being overwritten during updates
6+
# see https://git.ispconfig.org/ispconfig/ispconfig3/issues/4227
7+
8+
##################################################
9+
##################################################
10+
##################################################
11+
##################################################
12+
##################################################
13+
##################################################
14+
##################################################
15+
##################################################
16+
##################################################
17+
##################################################
18+
##################################################
19+
##################################################
20+
21+
{
22+
if [ -n "${_UPD}" ]
1523
then
16-
tar xvfz ISPConfig-3-stable.tar.gz
17-
cd ispconfig3_install/install/
18-
php -q \
19-
-d disable_classes= \
20-
-d disable_functions= \
21-
-d open_basedir= \
22-
update.php
23-
cd /tmp
24-
rm -rf "${tmpdir}"
25-
else
26-
echo "Unable to download the update."
27-
exit 1
24+
{
25+
umask 0077 \
26+
&& tmpdir=`mktemp -dt "$(basename $0).XXXXXXXXXX"` \
27+
&& test -d "${tmpdir}" \
28+
&& cd "${tmpdir}"
29+
} || {
30+
echo 'mktemp failed'
31+
exit 1
32+
}
33+
34+
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
35+
if [ -f ISPConfig-3-stable.tar.gz ]
36+
then
37+
tar xvfz ISPConfig-3-stable.tar.gz
38+
cd ispconfig3_install/install/
39+
php -q \
40+
-d disable_classes= \
41+
-d disable_functions= \
42+
-d open_basedir= \
43+
update.php
44+
cd /tmp
45+
rm -rf "${tmpdir}"
46+
else
47+
echo "Unable to download the update."
48+
exit 1
49+
fi
50+
2851
fi
2952

3053
exit 0

0 commit comments

Comments
 (0)