tiny-slitaz view step4.php @ rev 7
Add suggested support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 05 17:39:36 2016 +0100 (2016-01-05) |
parents | ac214416e736 |
children | 26cfc967375f |
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 if ($output == "") {
36 shell_exec("sudo ./helper --post-install $pkg ".
37 $_POST['tmp_dir']);
38 continue;
39 }
40 ?>
42 <div class="box">
43 <h3>[Step 4/5] <?php echo $pkg; ?> configuration</h3>
45 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
47 <input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
48 <div class="large">
49 <?php
50 echo $output;
51 post_hidden();
52 $suggested = shell_exec("./helper --get-suggested $pkg ".
53 $_POST['tmp_dir']);
54 if ($suggested != "") {
55 ?>
56 <hr />
57 <p>
58 You may want to install the following package(s) too:
59 </p>
60 <ol>
61 <?php foreach (explode(" ", $suggested) as $pkg) { ?>
62 <li>
63 <input type="checkbox" name="suggested[]" value="<?php echo $pkg; ?>" checked="checked" /> <?php echo $pkg; ?>
64 </li>
65 <?php }
66 echo "</ol>";
67 }
68 ?>
69 </div>
71 <div align="center">
72 <input name="continue" value="Continue" type="submit" />
73 </div>
75 </form>
76 </div>
78 <?php
79 echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']);
80 break;
81 }
83 }
84 ?>