diff --git a/CHANGELOG b/CHANGELOG index 6c6b8fc..97e7286 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,5 +3,6 @@ ====================== Version Description +1.0.2......Code and regex improvements. 1.0.1......Update paths and minor changes. 1.0.0......First Public Release. diff --git a/gui/bastille_manager-lib.inc b/gui/bastille_manager-lib.inc index 37c0aeb..ffc085f 100755 --- a/gui/bastille_manager-lib.inc +++ b/gui/bastille_manager-lib.inc @@ -54,12 +54,6 @@ $bastille_config = "{$rootfolder}/conf/bastille_config"; $jail_dir = "{$rootfolder}/jails"; $image_dir = "ext/bastille/images"; -$avail_releases = exec("/bin/echo $(/bin/ls {$rootfolder}/releases 2>/dev/null)"); -if ($avail_releases == ''): - $empty_releases = "YES"; - $avail_releases = "No base releases detected!"; -endif; - // Ensure the root directory is configured. if ($rootfolder == "") $input_errors[] = gtext("Extension installed with fault"); diff --git a/gui/bastille_manager_add.php b/gui/bastille_manager_add.php index 1990b57..fbc1451 100644 --- a/gui/bastille_manager_add.php +++ b/gui/bastille_manager_add.php @@ -62,7 +62,7 @@ foreach($a_release as $k_release => $release): $l_release[$k_release] = $k_release; endforeach; -if(!is_dir($jail_dir)): +if(!get_all_release_list()): $errormsg = gtext('No base releases extracted yet.') . ' ' . '' @@ -72,7 +72,6 @@ if(!is_dir($jail_dir)): endif; if($_POST): - global $empty_releases; global $configfile; unset($input_errors); $pconfig = $_POST; @@ -90,26 +89,27 @@ if($_POST): $interface = $pconfig['interface']; endif; - if($empty_releases !== "YES"): - if ($_POST['nowstart']): - $cmd = ("/usr/local/bin/bastille create {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}"); - else: - $cmd = ("/usr/local/bin/bastille create {$jname} {$release} {$ipaddr} {$interface}"); - endif; - else: - $cmd = ""; - endif; + if ($_POST['nowstart']): + $cmd = ("/usr/local/bin/bastille create {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}"); + else: + $cmd = ("/usr/local/bin/bastille create {$jname} {$release} {$ipaddr} {$interface}"); + endif; + if ($_POST['Create']): - if ($_POST['autostart']): - exec("/usr/sbin/sysrc -f {$configfile} {$jname}_AUTO_START=\"YES\""); - endif; - unset($output,$retval);mwexec2($cmd,$output,$retval); - if($retval == 0): - //$savemsg .= gtext("Boot Environment created and activated successfully."); - header('Location: bastille_manager_gui.php'); - exit; + if(get_all_release_list()): + unset($output,$retval);mwexec2($cmd,$output,$retval); + if($retval == 0): + if ($_POST['autostart']): + exec("/usr/sbin/sysrc -f {$configfile} {$jname}_AUTO_START=\"YES\""); + endif; + //$savemsg .= gtext("Boot Environment created and activated successfully."); + header('Location: bastille_manager_gui.php'); + exit; + else: + $errormsg .= gtext("Failed to create container."); + endif; else: - $errormsg .= gtext("Failed to create container."); + $errormsg .= gtext(" <<< Failed to create container."); endif; endif; endif; diff --git a/gui/bastille_manager_tarballs.php b/gui/bastille_manager_tarballs.php index 491238f..dc12879 100644 --- a/gui/bastille_manager_tarballs.php +++ b/gui/bastille_manager_tarballs.php @@ -49,7 +49,7 @@ function get_rel_list() { global $rootfolder; $result = []; if (is_dir("{$rootfolder}/releases")): - $entries = preg_grep('/^([^.])/', scandir("{$rootfolder}/releases")); + $entries = preg_grep('/^[0-9]+\.[0-9]+\-RELEASE/', scandir("{$rootfolder}/releases")); foreach($entries as $entry): $a = preg_split('/\t/',$entry); $r = [];