Skip to content

Commit 82f6e7b

Browse files
author
Marius Burkard
committed
- update script rework
1 parent c89029d commit 82f6e7b

File tree

4 files changed

+13
-117
lines changed

4 files changed

+13
-117
lines changed

server/scripts/ispconfig_update.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,18 @@ function simple_query($query, $answers, $default)
8888
echo "\n\n>> Update \n\n";
8989
echo "Please choose the update method. For production systems select 'stable'. \nWARNING: The update from GIT is only for development systems and may break your current setup. Do not use the GIT version on servers that host any live websites!\nNote: Update all slave server, before you update master server.\n\n";
9090

91-
$method = simple_query('Select update method', array('stable', 'git-stable', 'git-master'), 'stable');
91+
$method = simple_query('Select update method', array('stable', 'nightly', 'git-develop'), 'stable');
9292

9393
if($method == 'stable') {
9494
$new_version = @file_get_contents('https://www.ispconfig.org/downloads/ispconfig3_version.txt') or die('Unable to retrieve version file.');
9595
$new_version = trim($new_version);
96-
if(version_compare($new_version, ISPC_APP_VERSION, '>')) {
97-
passthru('/usr/local/ispconfig/server/scripts/update_stable.sh');
98-
exit;
99-
} else {
96+
if(version_compare($new_version, ISPC_APP_VERSION, '<=') && !in_array('--force', $argv, true)) {
10097
echo "There are no updates available for ISPConfig ".ISPC_APP_VERSION."\n";
98+
echo "If you are sure you want to update to stable anyway, please use --force parameter\n";
99+
echo "DOWNGRADING MAY CAUSE ISSUES!\n";
100+
exit(1);
101101
}
102-
} elseif ($method == 'git-stable') {
103-
passthru('/usr/local/ispconfig/server/scripts/update_from_dev_stable.sh');
104-
exit;
105-
} else {
106-
passthru('/usr/local/ispconfig/server/scripts/update_from_dev.sh');
107-
exit;
108102
}
109103

110-
111-
112-
?>
104+
passthru('/usr/local/ispconfig/server/scripts/update_runner.sh ' . escapeshellarg($method));
105+
exit;

server/scripts/update_from_dev.sh

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

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-
}
3+
echo "This script is no longer used. Please use ispconfig_update.sh instead." ;
124

13-
wget -O ispconfig3-dev.tar.gz "https://git.ispconfig.org/ispconfig/ispconfig3/repository/archive.tar.gz?ref=master"
14-
tar xzf ispconfig3-dev.tar.gz
15-
16-
echo -n "Latest git version: "
17-
ls -1d ispconfig3-master*
18-
cd ispconfig3-master*/install
19-
20-
php -q \
21-
-d disable_classes= \
22-
-d disable_functions= \
23-
-d open_basedir= \
24-
update.php
25-
26-
cd /tmp
27-
rm -rf "${tmpdir}"
28-
29-
exit 0
5+
exit 1;
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
#!/bin/bash
22

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-
}
3+
echo "This script is no longer used. Please use ispconfig_update.sh instead." ;
124

13-
wget -O ispconfig3-dev.tar.gz "https://git.ispconfig.org/ispconfig/ispconfig3/repository/archive.tar.gz?ref=stable-3.1"
14-
tar xzf ispconfig3-dev.tar.gz
15-
16-
echo -n "Latest git version: "
17-
ls -1d ispconfig3-stable*
18-
cd ispconfig3-stable*/install
19-
20-
php -q \
21-
-d disable_classes= \
22-
-d disable_functions= \
23-
-d open_basedir= \
24-
update.php
25-
26-
cd /tmp
27-
rm -rf "${tmpdir}"
28-
29-
exit 0
5+
exit 1;

server/scripts/update_stable.sh

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

3-
_UPD=1
3+
echo "This script is no longer used. Please use ispconfig_update.sh instead." ;
44

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}" ]
23-
then
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 https://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-
51-
fi
52-
53-
exit 0
54-
}
5+
exit 1;

0 commit comments

Comments
 (0)