rev |
line source |
pascal@0
|
1 <?php
|
pascal@0
|
2
|
pascal@0
|
3 if (isset($_POST['packages']) && !isset($_POST['toconfigure'])) {
|
pascal@0
|
4 $_POST['toconfigure'] = shell_exec("./helper --depends ".
|
pascal@0
|
5 $_POST['tmp_dir']." ".$_POST['packages']);
|
pascal@0
|
6 }
|
pascal@0
|
7
|
pascal@0
|
8 if (isset($_POST['configuring'])) {
|
pascal@0
|
9 $pkg = $_POST['configuring'];
|
pascal@0
|
10 $fp = fopen($_POST['tmp_dir']."vars","w");
|
pascal@0
|
11 foreach ($_POST as $key => $val) {
|
pascal@0
|
12 if (in_array($key, $usedvars)) continue;
|
pascal@14
|
13 if (is_array($val)) $val = implode(",",$val);
|
pascal@0
|
14 fwrite($fp,"export ".$key."='".$val."'\n");
|
pascal@0
|
15 }
|
pascal@0
|
16 fclose($fp);
|
pascal@0
|
17 shell_exec("sudo ./helper --post-install $pkg ".$_POST['tmp_dir']);
|
pascal@0
|
18 }
|
pascal@0
|
19
|
pascal@7
|
20 if (isset($_POST['suggested'])) {
|
pascal@7
|
21 foreach ($_POST['suggested'] as $pkg) {
|
pascal@15
|
22 if (!strstr(" ".$_POST['toconfigure']." ", " ".$pkg." "))
|
pascal@15
|
23 $_POST['toconfigure'] .= " ".$pkg;
|
pascal@7
|
24 }
|
pascal@7
|
25 unset($_POST['suggested']);
|
pascal@7
|
26 }
|
pascal@7
|
27
|
pascal@0
|
28 $output = '';
|
pascal@5
|
29 if (!empty($_POST['toconfigure'])) {
|
pascal@0
|
30 $pkgs = explode(" ",$_POST['toconfigure']);
|
pascal@0
|
31 foreach ($pkgs as $key => $pkg) {
|
pascal@0
|
32 shell_exec("sudo ./helper --pre-install $pkg ".$_POST['tmp_dir']);
|
pascal@0
|
33 $output = shell_exec("./helper --get-form $pkg ".
|
pascal@0
|
34 $_POST['tmp_dir']);
|
pascal@0
|
35 unset($pkgs[$key]);
|
pascal@0
|
36 $_POST['toconfigure'] = implode(" ", $pkgs);
|
pascal@10
|
37 $suggested = shell_exec("./helper --get-suggested $pkg ".
|
pascal@10
|
38 $_POST['tmp_dir']);
|
pascal@16
|
39 if ($suggested != "") {
|
pascal@16
|
40 $sugghead = <<<EOT
|
pascal@16
|
41 <hr />
|
pascal@16
|
42 <p>
|
pascal@16
|
43 You may want to install the following package(s) too:
|
pascal@16
|
44 </p>
|
pascal@16
|
45 <ol>
|
pascal@16
|
46 EOT;
|
pascal@16
|
47 foreach (explode(" ", $suggested) as $sug)
|
pascal@16
|
48 if (!strstr(" ".$_POST['packages']." ",
|
pascal@16
|
49 " ".$sug." ")) {
|
pascal@16
|
50 $output .= $sugghead ;
|
pascal@16
|
51 $sugghead = "";
|
pascal@16
|
52 $output .= <<<EOT
|
pascal@16
|
53 <li>
|
pascal@16
|
54 <input type="checkbox" name="suggested[]" value="$sug" checked="checked" />$sug
|
pascal@16
|
55 </li>
|
pascal@16
|
56 EOT;
|
pascal@16
|
57 }
|
pascal@16
|
58 if ($sugghead == "")
|
pascal@16
|
59 $output .= " </ol>\n";
|
pascal@16
|
60 }
|
pascal@16
|
61 if ($output == "") {
|
pascal@0
|
62 shell_exec("sudo ./helper --post-install $pkg ".
|
pascal@0
|
63 $_POST['tmp_dir']);
|
pascal@0
|
64 continue;
|
pascal@0
|
65 }
|
pascal@0
|
66 ?>
|
pascal@0
|
67
|
pascal@6
|
68 <div class="box">
|
pascal@6
|
69 <h3>[Step 4/5] <?php echo $pkg; ?> configuration</h3>
|
pascal@0
|
70
|
pascal@0
|
71 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
pascal@0
|
72
|
pascal@6
|
73 <input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
|
pascal@6
|
74 <div class="large">
|
pascal@6
|
75 <?php
|
pascal@0
|
76 echo $output;
|
pascal@0
|
77 post_hidden();
|
pascal@16
|
78 ?>
|
pascal@6
|
79 </div>
|
pascal@0
|
80
|
pascal@6
|
81 <div align="center">
|
pascal@6
|
82 <input name="continue" value="Continue" type="submit" />
|
pascal@6
|
83 </div>
|
pascal@0
|
84
|
pascal@0
|
85 </form>
|
pascal@6
|
86 </div>
|
pascal@0
|
87
|
pascal@0
|
88 <?php
|
pascal@0
|
89 echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']);
|
pascal@0
|
90 break;
|
pascal@0
|
91 }
|
pascal@0
|
92
|
pascal@0
|
93 }
|
pascal@0
|
94 ?>
|