Add ability to create empty containers, minor improvements

This commit is contained in:
Jose
2020-05-20 20:20:17 -04:00
parent 958a3eb245
commit 07f3a1aa5a
3 changed files with 50 additions and 17 deletions
+1
View File
@@ -3,6 +3,7 @@
====================== ======================
Version Description Version Description
1.0.65......Add ability to create empty containers, minor improvements.
1.0.64......Switch back to official bastille repository, simplify initial help banner. 1.0.64......Switch back to official bastille repository, simplify initial help banner.
1.0.63......Always apply required updates after platform check. 1.0.63......Always apply required updates after platform check.
1.0.62......Check/apply required updates to bastille while checking for upgrades. 1.0.62......Check/apply required updates to bastille while checking for upgrades.
+48 -16
View File
@@ -69,28 +69,30 @@ if($_POST):
$jname = $pconfig['jailname']; $jname = $pconfig['jailname'];
$ipaddr = $pconfig['ipaddress']; $ipaddr = $pconfig['ipaddress'];
$release = $pconfig['release']; $release = $pconfig['release'];
$options = "";
if ($_POST['interface'] == 'Config'): if ($_POST['interface'] == 'Config'):
$interface = ""; $interface = "";
else: else:
$interface = $pconfig['interface']; $interface = $pconfig['interface'];
endif; endif;
if($_POST['thickjail']): if($_POST['thickjail'] && $_POST['vnetjail']):
$thick_jail = "-T"; $options = "-T -V";
else: elseif($_POST['thickjail']):
$thick_jail = ""; $options = "-T";
elseif($_POST['vnetjail']):
$options = "-V";
endif; endif;
if($_POST['vnetjail']): if($_POST['emptyjail']):
$vnet_jail = "-V"; // Just create an empty container with minimal jail.conf.
$cmd = ("/usr/local/bin/bastille create -E {$jname}");
else: else:
$vnet_jail = ""; if ($_POST['nowstart']):
endif; $cmd = ("/usr/local/bin/bastille create {$options} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}");
else:
if ($_POST['nowstart']): $cmd = ("/usr/local/bin/bastille create {$options} {$jname} {$release} {$ipaddr} {$interface}");
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}"); endif;
else:
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface}");
endif; endif;
if ($_POST['Create']): if ($_POST['Create']):
@@ -121,6 +123,28 @@ $(window).on("load",function() {
$("#iform").submit(function() { spinner(); }); $("#iform").submit(function() { spinner(); });
$(".spin").click(function() { spinner(); }); $(".spin").click(function() { spinner(); });
}); });
function emptyjail_change() {
switch(document.iform.emptyjail.checked) {
case false:
showElementById('ipaddress_tr','show');
showElementById('interface_tr', 'show');
showElementById('release_tr', 'show');
showElementById('thickjail_tr', 'show');
showElementById('vnetjail_tr', 'show');
showElementById('nowstart_tr', 'show');
showElementById('autostart_tr', 'show');
break;
case true:
showElementById('ipaddress_tr','hide');
showElementById('interface_tr', 'hide');
showElementById('release_tr', 'hide');
showElementById('thickjail_tr', 'hide');
showElementById('vnetjail_tr', 'hide');
showElementById('nowstart_tr', 'hide');
showElementById('autostart_tr', 'hide');
break;
}
}
//]]> //]]>
</script> </script>
<?php <?php
@@ -165,11 +189,14 @@ $document->render();
html_inputbox2('ipaddress',gettext('IP Address'),$pconfig['ipaddress'],'',true,20); html_inputbox2('ipaddress',gettext('IP Address'),$pconfig['ipaddress'],'',true,20);
$a_action = $l_interfaces; $a_action = $l_interfaces;
$b_action = $l_release; $b_action = $l_release;
html_combobox2('interface',gettext('Network interface'),$pconfig['interface'],$a_action,'',true,false,'action_change()'); html_combobox2('interface',gettext('Network interface'),$pconfig['interface'],$a_action,'',true,false);
html_combobox2('release',gettext('Base release'),$pconfig['release'],$b_action,'',true,false,'action_change()'); html_combobox2('release',gettext('Base release'),$pconfig['release'],$b_action,'',true,false);
if($options_support): if($options_support):
html_checkbox2('thickjail',gettext('Create a thick container'),!empty($pconfig['thickjail']) ? true : false,gettext('These containers consume more space, but are self contained.'),'',false); html_checkbox2('thickjail',gettext('Create a thick container'),!empty($pconfig['thickjail']) ? true : false,gettext('These containers consume more space, but are self contained.'),'',false);
html_checkbox2('vnetjail',gettext('Enable VNET(VIMAGE)'),!empty($pconfig['vnetjail']) ? true : false,gettext('VNET-enabled containers are attached to a virtual bridge interface for connectivity(Advanced).'),'',false); html_checkbox2('vnetjail',gettext('Enable VNET(VIMAGE)'),!empty($pconfig['vnetjail']) ? true : false,gettext('VNET-enabled containers are attached to a virtual bridge interface for connectivity(Advanced).'),'',false);
html_checkbox2('emptyjail',gettext('Create an empty container'),!empty($pconfig['emptyjail']) ? true : false,gettext('This are ideal for custom builds, experimenting with unsupported RELEASES or Linux jails.'),'',false,false,'emptyjail_change()');
endif; endif;
html_checkbox2('nowstart',gettext('Start after creation'),!empty($pconfig['nowstart']) ? true : false,gettext('Start the container after creation.'),'',false); html_checkbox2('nowstart',gettext('Start after creation'),!empty($pconfig['nowstart']) ? true : false,gettext('Start the container after creation.'),'',false);
html_checkbox2('autostart',gettext('Auto start on boot'),!empty($pconfig['autostart']) ? true : false,gettext('Automatically start the container at boot time.'),'',false); html_checkbox2('autostart',gettext('Auto start on boot'),!empty($pconfig['autostart']) ? true : false,gettext('Automatically start the container at boot time.'),'',false);
@@ -185,6 +212,11 @@ $document->render();
include 'formend.inc'; include 'formend.inc';
?> ?>
</td></tr></tbody></table></form> </td></tr></tbody></table></form>
<script type="text/javascript">
<!--
emptyjail_change();
//-->
</script>
<?php <?php
include 'fend.inc'; include 'fend.inc';
?> ?>
+1 -1
View File
@@ -1 +1 @@
1.0.64 1.0.65