Fix for jail auto-start settings with names containing dashes
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
======================
|
||||
Version Description
|
||||
|
||||
1.0.69......Fix for jail auto-start settings with names containing dashes.
|
||||
1.0.68......Remove the -q option in utilities page.
|
||||
1.0.67......Fix for properly identify the jail type, thanks to mvdhoeven.
|
||||
1.0.66......Update extension and bastille config files at once.
|
||||
|
||||
@@ -229,7 +229,7 @@ function get_jail_infos() {
|
||||
$r['path'] = "-";
|
||||
endif;
|
||||
// Display auto-start settings.
|
||||
$jail_autostart = exec("/usr/sbin/sysrc -qn -f {$configfile} {$item}_AUTO_START");
|
||||
$jail_autostart = exec("/usr/bin/grep -w {$item}_AUTO_START $configfile | cut -d'=' -f2 | tr -d '\"'");
|
||||
if ($jail_autostart == 'YES') {
|
||||
$r['boot'] = $img_path['ena'];
|
||||
} elseif ($jail_autostart == 'NO') {
|
||||
|
||||
@@ -65,7 +65,7 @@ $jail_config = "$jail_dir/$container/jail.conf";
|
||||
|
||||
// Get some jail system settings.
|
||||
$is_vnet = exec("/usr/bin/grep '.*vnet;' $jail_config");
|
||||
$pconfig['autostart'] = exec("/usr/bin/grep '{$container}_AUTO_START=\"YES\"' $bastille_config");
|
||||
$pconfig['autostart'] = exec("/usr/bin/grep -w '{$container}_AUTO_START=\"YES\"' $bastille_config");
|
||||
|
||||
// Get some jail config parameters.
|
||||
// This could be done with a nice php preg loop in the future.
|
||||
@@ -304,7 +304,7 @@ if ($_POST):
|
||||
if (isset($_POST['autostart']) && $_POST['autostart']):
|
||||
if($jail_name_def !== $jail_name):
|
||||
// Remove obsolete variable.
|
||||
exec("/usr/sbin/sysrc -f $configfile -qx {$jail_name_def}_AUTO_START");
|
||||
exec("/usr/bin/sed -i '' 's/{$jail_name_def}_AUTO_START.*//' $configfile");
|
||||
endif;
|
||||
$cmd = ("/usr/sbin/sysrc -f $configfile {$jail_name}_AUTO_START=\"YES\"");
|
||||
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
||||
@@ -316,9 +316,9 @@ if ($_POST):
|
||||
else:
|
||||
if($jail_name_def !== $jail_name):
|
||||
// Remove obsolete variable.
|
||||
exec("/usr/sbin/sysrc -f $configfile -qx {$jail_name_def}_AUTO_START");
|
||||
exec("/usr/bin/sed -i '' 's/{$jail_name_def}_AUTO_START.*//' $configfile");
|
||||
endif;
|
||||
$cmd = ("/usr/sbin/sysrc -f {$configfile} {$jail_name}_AUTO_START=\"NO\"");
|
||||
$cmd = ("/usr/bin/sed -i '' 's/{$jail_name}_AUTO_START.*//' $configfile");
|
||||
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
||||
if($retval == 0):
|
||||
//$savemsg .= gtext("Autostart changed successfully.");
|
||||
|
||||
Reference in New Issue
Block a user