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