tiny-slitaz rev 16

Do not configure suggested packages twice (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jul 18 18:49:43 2016 +0200 (2016-07-18)
parents c53990da4741
children af73cc7ea672
files step4.php
line diff
     1.1 --- a/step4.php	Thu Jul 14 23:24:47 2016 +0200
     1.2 +++ b/step4.php	Mon Jul 18 18:49:43 2016 +0200
     1.3 @@ -36,7 +36,29 @@
     1.4  		$_POST['toconfigure'] = implode(" ", $pkgs);
     1.5  		$suggested = shell_exec("./helper --get-suggested $pkg ".
     1.6  					$_POST['tmp_dir']); 
     1.7 -		if ($output == "" && $suggested == "") {
     1.8 +		if ($suggested != "") {
     1.9 +			$sugghead = <<<EOT
    1.10 +	<hr />
    1.11 +	<p>
    1.12 +	You may want to install the following package(s) too:
    1.13 +	</p>
    1.14 +	<ol>
    1.15 +EOT;
    1.16 +			foreach (explode(" ", $suggested) as $sug)
    1.17 +				if (!strstr(" ".$_POST['packages']." ",
    1.18 +				    " ".$sug." ")) {
    1.19 +					$output .= $sugghead ;
    1.20 +					$sugghead = "";
    1.21 +					$output .= <<<EOT
    1.22 +		<li>
    1.23 +		<input type="checkbox" name="suggested[]" value="$sug" checked="checked" />$sug
    1.24 +		</li>
    1.25 +EOT;
    1.26 +			}
    1.27 +			if ($sugghead == "")
    1.28 +				$output .= "	</ol>\n";
    1.29 +		}
    1.30 +		if ($output == "") {
    1.31  			shell_exec("sudo ./helper --post-install $pkg ".
    1.32  				   $_POST['tmp_dir']); 
    1.33  			continue;
    1.34 @@ -53,23 +75,7 @@
    1.35  		<?php
    1.36  		echo $output;
    1.37  		post_hidden();
    1.38 -		if ($suggested != "") {
    1.39 -			$output = "suggested";
    1.40 -?>
    1.41 -	<hr />
    1.42 -	<p>
    1.43 -	You may want to install the following package(s) too:
    1.44 -	</p>
    1.45 -	<ol>
    1.46 -<?php			foreach (explode(" ", $suggested) as $pkg)
    1.47 -				if (!strstr(" ".$_POST['packages']." ",
    1.48 -				    " ".$pkg." ")) { ?>
    1.49 -		<li>
    1.50 -		<input type="checkbox" name="suggested[]" value="<?php echo $pkg; ?>" checked="checked" /> <?php echo $pkg; ?>
    1.51 -		</li>
    1.52 -<?php			} ?>
    1.53 -	</ol>
    1.54 -<?php		} ?>
    1.55 +		?>
    1.56  	</div>
    1.57  
    1.58  	<div align="center">