-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.php
51 lines (39 loc) · 1.66 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
// Server Instant Start installer.
// (C) 2020 CubicleSoft. All Rights Reserved.
if (!isset($_SERVER["argc"]) || !$_SERVER["argc"])
{
echo "This file is intended to be run from the command-line.";
exit();
}
$rootpath = dirname(__FILE__);
require_once $rootpath . "/support/cli.php";
require_once $rootpath . "/scripts/functions.php";
// Normalize the environment.
$prevpath = getenv("PATH");
$path = ($prevpath === false ? "" : $prevpath . ":") . "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin";
putenv("PATH=" . $path);
putenv("DEBIAN_FRONTEND=noninteractive");
if (!file_exists("/etc/apt/sources.list")) CLI::DisplayError("The file '/etc/apt/sources.list' does not exist. Not actually Debian-based?");
if ($argc > 1 && $argv[1] === "reboot-if-required")
{
// Reboot automatically as needed.
if (file_exists("/var/run/reboot-required")) system("reboot");
}
else
{
system("/usr/bin/apt-get update");
system("/usr/bin/apt-get -y install software-properties-common iptables-persistent fail2ban vnstat net-tools htop openssl git wget curl php-gd php-json php-sqlite3 php-curl");
// Now that the environment is normalized, run the main script.
$cmd = escapeshellarg(PHP_BINARY) . " " . escapeshellarg($rootpath . "/scripts/main.php");
for ($x = 1; $x < $argc; $x++) $cmd .= " " . escapeshellarg($argv[$x]);
$options = explode(" ", preg_replace('/\s+/', " ", trim(str_replace(array(",", ";"), " ", (string)getenv("INSTANT_SERVERS")))));
foreach ($options as $opt)
{
if ($opt !== "") $cmd .= " " . escapeshellarg($opt);
}
RunExecutable($cmd);
echo "\nInstallation complete.\n";
}
putenv("PATH=" . $prevpath);
?>