-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstep4.php
73 lines (62 loc) · 1.81 KB
/
step4.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
if (isset($_POST['packages']) && !isset($_POST['toconfigure'])) {
$_POST['toconfigure'] = shell_exec("./helper --depends ".
$_POST['tmp_dir']." ".$_POST['packages']);
}
if (isset($_POST['configuring'])) {
$pkg = $_POST['configuring'];
$fp = fopen($_POST['tmp_dir']."vars","w");
foreach ($_POST as $key => $val) {
if (in_array($key, $usedvars)) continue;
if (is_array($val)) $val = implode(",",$val);
fwrite($fp,"export ".$key."='".$val."'\n");
}
fclose($fp);
shell_exec("sudo ./helper --post-install $pkg ".$_POST['tmp_dir']);
}
if (isset($_POST['suggested'])) {
foreach ($_POST['suggested'] as $pkg) {
if (!strstr(" ".$_POST['toconfigure']." ", " ".$pkg." "))
$_POST['toconfigure'] .= " ".$pkg;
}
unset($_POST['suggested']);
}
$output = '';
if (!empty($_POST['toconfigure'])) {
$pkgs = explode(" ",$_POST['toconfigure']);
foreach ($pkgs as $key => $pkg) {
shell_exec("sudo ./helper --pre-install $pkg ".$_POST['tmp_dir']);
$output = shell_exec("./helper --get-form $pkg ".
$_POST['tmp_dir']);
unset($pkgs[$key]);
$_POST['toconfigure'] = implode(" ", $pkgs);
$output .= shell_exec("./helper --list-suggested $pkg ".
$_POST['tmp_dir']." ".$_POST['packages'].
$_POST['already_suggested']);
if ($output == "") {
shell_exec("sudo ./helper --post-install $pkg ".
$_POST['tmp_dir']);
continue;
}
?>
<div class="box">
<h3>[Step 4/5] <?php echo $pkg; ?> configuration</h3>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
<div class="large">
<?php
echo $output;
post_hidden();
?>
</div>
<div align="center">
<input name="continue" value="Continue" type="submit" />
</div>
</form>
</div>
<?php
echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']);
break;
}
}
?>