Skip to content

Commit 5cd90c6

Browse files
author
Marius Burkard
committed
- moved templates for rspamd to installer location
1 parent 5dab6a9 commit 5cd90c6

22 files changed

+359
-364
lines changed

install/install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
$dist = get_distname();
107107

108108
if($dist['id'] == '') die('Linux distribution or version not recognized.');
109-
if(!is_supported_dist($dist)) die('This distribution is not supported.');
109+
if(!$dist['supported']) die('This distribution is not supported.');
110110

111111
//** Include the autoinstaller configuration (for non-interactive setups)
112112
error_reporting(E_ALL ^ E_NOTICE);

install/lib/install.lib.php

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,44 +34,6 @@
3434

3535
require_once realpath(dirname(__FILE__)) . '/classes/libbashcolor.inc.php';
3636

37-
function is_supported_dist($dist) {
38-
$name = $dist['name'];
39-
$version = $dist['version'];
40-
41-
$min_version = false;
42-
if($name === 'Ubuntu') {
43-
$tmp = explode(" ", $version);
44-
$version = reset($tmp); // Dist name is appended on get_distname
45-
$min_version = '16.04';
46-
$add_versions = array('Testing', 'Unknown');
47-
} elseif($name === 'Debian') {
48-
$min_version = '9';
49-
$add_versions = array('Testing', 'Unknown', 'Stretch', 'Buster');
50-
} elseif($name === 'Devuan') {
51-
$min_version = '1.0';
52-
$add_versions = array('Jessie', 'Ceres');
53-
} elseif($name === 'openSUSE') {
54-
$min_version = '11.2';
55-
$add_versions = false;
56-
} elseif($name === 'Fedora') {
57-
$min_version = '11';
58-
$add_versions = array('Unknown');
59-
} elseif($name === 'CentOS') {
60-
$min_version = '7.0';
61-
$add_versions = array('Unknown');
62-
} elseif($name === 'Gentoo') {
63-
$min_version = '1.0';
64-
}
65-
66-
if($version && $min_version && preg_match('/^[0-9]+/', $version)) {
67-
if(version_compare($version, $min_version, '>=')) return true;
68-
} elseif($version && !preg_match('/^[0-9]+/', $version) && !empty($add_versions)) {
69-
if(in_array($version, $add_versions, true)) return true;
70-
}
71-
72-
return false;
73-
}
74-
7537
//** Get distribution identifier
7638
//** IMPORTANT!
7739
// This is the same code as in server/lib/classes/monitor_tools.inc.php
@@ -86,6 +48,7 @@ function get_distname() {
8648
$distver = '';
8749
$distid = '';
8850
$distbaseid = '';
51+
$distsupported = false;
8952

9053
//** Debian or Ubuntu
9154
if(file_exists('/etc/debian_version')) {
@@ -138,22 +101,27 @@ function get_distname() {
138101
case "18.04":
139102
$relname = "(Bionic Beaver)";
140103
$distconfid = 'ubuntu1804';
104+
$distsupported = true;
141105
break;
142106
case "17.10":
143107
$relname = "(Artful Aardvark)";
144108
$distconfid = 'ubuntu1710';
109+
$distsupported = true;
145110
break;
146111
case "17.04":
147112
$relname = "(Zesty Zapus)";
148113
$distconfid = 'ubuntu1604';
114+
$distsupported = true;
149115
break;
150116
case "16.10":
151117
$relname = "(Yakkety Yak)";
152118
$distconfid = 'ubuntu1604';
119+
$distsupported = true;
153120
break;
154121
case "16.04":
155122
$relname = "(Xenial Xerus)";
156123
$distconfid = 'ubuntu1604';
124+
$distsupported = true;
157125
break;
158126
case "15.10":
159127
$relname = "(Wily Werewolf)";
@@ -266,20 +234,23 @@ function get_distname() {
266234
$distconfid = 'debian90';
267235
$distid = 'debian60';
268236
$distbaseid = 'debian';
237+
$distsupported = true;
269238
swriteln("Operating System: <strong>Debian 9.0 (Stretch)</strong> or compatible\n");
270239
} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) {
271240
$distname = 'Debian';
272241
$distver = 'Testing';
273242
$distid = 'debian60';
274243
$distconfid = 'debiantesting';
275244
$distbaseid = 'debian';
245+
$distsupported = true;
276246
swriteln("Operating System: Debian Testing\n");
277247
} else {
278248
$distname = 'Debian';
279249
$distver = 'Unknown';
280250
$distid = 'debian60';
281251
$distconfid = 'debian90';
282252
$distbaseid = 'debian';
253+
$distsupported = true;
283254
swriteln("Operating System: Debian or compatible, unknown version.\n");
284255
}
285256
}
@@ -297,6 +268,7 @@ function get_distname() {
297268
$distver = 'Ceres';
298269
$distid = 'debiantesting';
299270
$distbaseid = 'debian';
271+
$distsupported = true;
300272
swriteln("Operating System: Devuan Unstable (Ceres) or compatible\n");
301273
}
302274
}
@@ -320,12 +292,14 @@ function get_distname() {
320292
$distver = '11.2';
321293
$distid = 'opensuse112';
322294
$distbaseid = 'opensuse';
295+
$distsupported = true;
323296
swriteln("Operating System: openSUSE 11.2 or compatible\n");
324297
} else {
325298
$distname = 'openSUSE';
326299
$distver = 'Unknown';
327300
$distid = 'opensuse112';
328301
$distbaseid = 'opensuse';
302+
$distsupported = true;
329303
swriteln("Operating System: openSUSE or compatible, unknown version.\n");
330304
}
331305
}
@@ -359,6 +333,7 @@ function get_distname() {
359333
$distver = '5.2';
360334
$distid = 'centos52';
361335
$distbaseid = 'fedora';
336+
$distsupported = true;
362337
swriteln("Operating System: CentOS 5.2 or compatible\n");
363338
} elseif(stristr($content, 'CentOS release 5.3 (Final)')) {
364339
$distname = 'CentOS';
@@ -386,6 +361,7 @@ function get_distname() {
386361
$var=explode(".", $var[3]);
387362
$var=$var[0].".".$var[1];
388363
$distver = $var;
364+
$distsupported = true;
389365
if($var=='7.0' || $var=='7.1') {
390366
$distid = 'centos70';
391367
} else {
@@ -411,6 +387,7 @@ function get_distname() {
411387
$distver = $version[0][0].$version[0][1];
412388
$distid = 'gentoo';
413389
$distbaseid = 'gentoo';
390+
$distsupported = true;
414391
swriteln("Operating System: Gentoo $distver or compatible\n");
415392

416393
} else {
@@ -420,7 +397,7 @@ function get_distname() {
420397
// Set $distconfid to distid, if no different id for the config is defined
421398
if(!isset($distconfid)) $distconfid = $distid;
422399

423-
return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid);
400+
return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'confid' => $distconfid, 'baseid' => $distbaseid, 'supported' => $distsupported);
424401
}
425402

426403
function sread() {

install/lib/installer_base.lib.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,70 +1264,70 @@ public function configure_rspamd() {
12641264
$tpl->setLoop('whitelist_ips', $whitelist_ips);
12651265
wf('/etc/rspamd/local.d/users.conf', $tpl->grab());
12661266

1267-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_groups.conf.master')) {
1268-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf');
1267+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master')) {
1268+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf');
12691269
} else {
1270-
exec('cp '.$conf['rootpath'].'/conf/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf');
1270+
exec('cp tpl/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf');
12711271
}
12721272

1273-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_antivirus.conf.master')) {
1274-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf');
1273+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master')) {
1274+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf');
12751275
} else {
1276-
exec('cp '.$conf['rootpath'].'/conf/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf');
1276+
exec('cp tpl/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf');
12771277
}
12781278

1279-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_classifier-bayes.conf.master')) {
1280-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf');
1279+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master')) {
1280+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf');
12811281
} else {
1282-
exec('cp '.$conf['rootpath'].'/conf/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf');
1282+
exec('cp tpl/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf');
12831283
}
12841284

1285-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_greylist.conf.master')) {
1286-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf');
1285+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master')) {
1286+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf');
12871287
} else {
1288-
exec('cp '.$conf['rootpath'].'/conf/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf');
1288+
exec('cp tpl/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf');
12891289
}
12901290

1291-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_symbols_antivirus.conf.master')) {
1292-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf');
1291+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master')) {
1292+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf');
12931293
} else {
1294-
exec('cp '.$conf['rootpath'].'/conf/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf');
1294+
exec('cp tpl/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf');
12951295
}
12961296

1297-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_override_rbl.conf.master')) {
1298-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf');
1297+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master')) {
1298+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf');
12991299
} else {
1300-
exec('cp '.$conf['rootpath'].'/conf/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf');
1300+
exec('cp tpl/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf');
13011301
}
13021302

1303-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_override_surbl.conf.master')) {
1304-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf');
1303+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master')) {
1304+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf');
13051305
} else {
1306-
exec('cp '.$conf['rootpath'].'/conf/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf');
1306+
exec('cp tpl/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf');
13071307
}
13081308

1309-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_mx_check.conf.master')) {
1310-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf');
1309+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master')) {
1310+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf');
13111311
} else {
1312-
exec('cp '.$conf['rootpath'].'/conf/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf');
1312+
exec('cp tpl/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf');
13131313
}
13141314

1315-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_redis.conf.master')) {
1316-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf');
1315+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master')) {
1316+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf');
13171317
} else {
1318-
exec('cp '.$conf['rootpath'].'/conf/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf');
1318+
exec('cp tpl/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf');
13191319
}
13201320

1321-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_milter_headers.conf.master')) {
1322-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf');
1321+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master')) {
1322+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf');
13231323
} else {
1324-
exec('cp '.$conf['rootpath'].'/conf/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf');
1324+
exec('cp tpl/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf');
13251325
}
13261326

1327-
if(file_exists($conf['rootpath'].'/conf-custom/rspamd_options.inc.master')) {
1328-
exec('cp '.$conf['rootpath'].'/conf-custom/rspamd_options.inc.master /etc/rspamd/local.d/options.inc');
1327+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master')) {
1328+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master /etc/rspamd/local.d/options.inc');
13291329
} else {
1330-
exec('cp '.$conf['rootpath'].'/conf/rspamd_options.inc.master /etc/rspamd/local.d/options.inc');
1330+
exec('cp tpl/rspamd_options.inc.master /etc/rspamd/local.d/options.inc');
13311331
}
13321332

13331333
exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*');
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)