tiny-slitaz view step4.php @ rev 10
Add suggested support (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 05 19:54:54 2016 +0100 (2016-01-05) |
parents | 69b7df0ddb67 |
children | d076e7a5f3ae |
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 fwrite($fp,"export ".$key."='".$val."'\n");
14 }
15 fclose($fp);
16 shell_exec("sudo ./helper --post-install $pkg ".$_POST['tmp_dir']);
17 }
19 if (isset($_POST['suggested'])) {
20 foreach ($_POST['suggested'] as $pkg) {
21 $_POST['toconfigure'] .= " ".$pkg;
22 }
23 unset($_POST['suggested']);
24 }
26 $output = '';
27 if (!empty($_POST['toconfigure'])) {
28 $pkgs = explode(" ",$_POST['toconfigure']);
29 foreach ($pkgs as $key => $pkg) {
30 shell_exec("sudo ./helper --pre-install $pkg ".$_POST['tmp_dir']);
31 $output = shell_exec("./helper --get-form $pkg ".
32 $_POST['tmp_dir']);
33 unset($pkgs[$key]);
34 $_POST['toconfigure'] = implode(" ", $pkgs);
35 $suggested = shell_exec("./helper --get-suggested $pkg ".
36 $_POST['tmp_dir']);
37 if ($output == "" && $suggested == "") {
38 shell_exec("sudo ./helper --post-install $pkg ".
39 $_POST['tmp_dir']);
40 continue;
41 }
42 ?>
44 <div class="box">
45 <h3>[Step 4/5] <?php echo $pkg; ?> configuration</h3>
47 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
49 <input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
50 <div class="large">
51 <?php
52 echo $output;
53 post_hidden();
54 if ($suggested != "") {
55 $output = "suggested";
56 ?>
57 <hr />
58 <p>
59 You may want to install the following package(s) too:
60 </p>
61 <ol>
62 <?php foreach (explode(" ", $suggested) as $pkg)
63 if (!strstr(" ".$_POST['packages']." ",
64 " ".$pkg." ")) { ?>
65 <li>
66 <input type="checkbox" name="suggested[]" value="<?php echo $pkg; ?>" checked="checked" /> <?php echo $pkg; ?>
67 </li>
68 <?php } ?>
69 </ol>
70 <?php } ?>
71 </div>
73 <div align="center">
74 <input name="continue" value="Continue" type="submit" />
75 </div>
77 </form>
78 </div>
80 <?php
81 echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']);
82 break;
83 }
85 }
86 ?>