tiny-slitaz view step4.php @ rev 32
Do not suggest packages twice
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Sep 26 13:55:40 2019 +0200 (2019-09-26) |
parents | 26423b57df46 |
children |
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 $output .= shell_exec("./helper --list-suggested $pkg ".
38 $_POST['tmp_dir']." ".$_POST['packages'].
39 $_POST['already_suggested']);
40 if ($output == "") {
41 shell_exec("sudo ./helper --post-install $pkg ".
42 $_POST['tmp_dir']);
43 continue;
44 }
45 ?>
47 <div class="box">
48 <h3>[Step 4/5] <?php echo $pkg; ?> configuration</h3>
50 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
52 <input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
53 <div class="large">
54 <?php
55 echo $output;
56 post_hidden();
57 ?>
58 </div>
60 <div align="center">
61 <input name="continue" value="Continue" type="submit" />
62 </div>
64 </form>
65 </div>
67 <?php
68 echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']);
69 break;
70 }
72 }
73 ?>