tiny-slitaz view step4.php @ rev 18

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