Add initial support for IPv6 and VNET
This commit is contained in:
@@ -56,7 +56,7 @@ $config_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BASTILLE_CONFIG=' |
|
||||
$default_distfiles = exec("/bin/cat {$config_path} | /usr/bin/grep 'bastille_bootstrap_archives=' | /usr/bin/cut -d'\"' -f2");
|
||||
$jail_dir = "{$rootfolder}/jails";
|
||||
$image_dir = "ext/bastille/images";
|
||||
$thick_jail = exec("/usr/local/bin/bastille create | grep -wo '\[option\]'");
|
||||
$options_support = exec("/usr/local/bin/bastille create | grep -wo '\[option\]'");
|
||||
$reldir = "{$rootfolder}/releases";
|
||||
$zfs_support = exec("/bin/cat {$configfile} | /usr/bin/grep 'ZFS_SUPPORT=' | /usr/bin/cut -d'\"' -f2");
|
||||
|
||||
@@ -174,6 +174,9 @@ function get_jail_infos() {
|
||||
// Set the IPv4 on the running jails.
|
||||
//$r['ip'] = exec("/usr/sbin/jls | /usr/bin/grep {$item} | /usr/bin/awk '{print $2}'");
|
||||
$r['ip'] = exec("/usr/bin/grep -w 'ip4.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
|
||||
if (!$r['ip']):
|
||||
$r['ip'] = exec("/usr/bin/grep -w 'ip6.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
|
||||
endif;
|
||||
if (!$r['ip']):
|
||||
$r['ip'] = "-";
|
||||
endif;
|
||||
|
||||
@@ -81,10 +81,16 @@ if($_POST):
|
||||
$thick_jail = "";
|
||||
endif;
|
||||
|
||||
if ($_POST['nowstart']):
|
||||
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}");
|
||||
if($_POST['vnetjail']):
|
||||
$vnet_jail = "-V";
|
||||
else:
|
||||
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$jname} {$release} {$ipaddr} {$interface}");
|
||||
$vnet_jail = "";
|
||||
endif;
|
||||
|
||||
if ($_POST['nowstart']):
|
||||
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}");
|
||||
else:
|
||||
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface}");
|
||||
endif;
|
||||
|
||||
if ($_POST['Create']):
|
||||
@@ -156,13 +162,14 @@ $document->render();
|
||||
<tbody>
|
||||
<?php
|
||||
html_inputbox2('jailname',gettext('Friendly name'),$pconfig['jailname'],'',true,20);
|
||||
html_inputbox2('ipaddress',gettext('IPv4 Address'),$pconfig['ipaddress'],'',true,20);
|
||||
html_inputbox2('ipaddress',gettext('IP Address'),$pconfig['ipaddress'],'',true,20);
|
||||
$a_action = $l_interfaces;
|
||||
$b_action = $l_release;
|
||||
html_combobox2('interface',gettext('Network interface'),$pconfig['interface'],$a_action,'',true,false,'action_change()');
|
||||
html_combobox2('release',gettext('Base release'),$pconfig['release'],$b_action,'',true,false,'action_change()');
|
||||
if($thick_jail):
|
||||
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('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);
|
||||
endif;
|
||||
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);
|
||||
|
||||
@@ -239,10 +239,10 @@ $document->render();
|
||||
<colgroup>
|
||||
<col style="width:5%">
|
||||
<col style="width:5%">
|
||||
<col style="width:12%">
|
||||
<col style="width:10%">
|
||||
<col style="width:10%">
|
||||
<col style="width:10%">
|
||||
<col style="width:5%">
|
||||
<col style="width:25%">
|
||||
<col style="width:5%">
|
||||
<col style="width:5%">
|
||||
@@ -257,7 +257,7 @@ $document->render();
|
||||
<tr>
|
||||
<th class="lhelc"><?=gtext('Select');?></th>
|
||||
<th class="lhell"><?=gtext('JID');?></th>
|
||||
<th class="lhell"><?=gtext('IPv4 Address');?></th>
|
||||
<th class="lhell"><?=gtext('IP Address');?></th>
|
||||
<th class="lhell"><?=gtext('Hostname');?></th>
|
||||
<th class="lhell"><?=gtext('Release');?></th>
|
||||
<th class="lhell"><?=gtext('Interface');?></th>
|
||||
|
||||
@@ -164,7 +164,7 @@ if ($_POST) {
|
||||
else:
|
||||
if (is_file($backup_file)) {
|
||||
$cmd = ("/usr/local/bin/bastille import '{$filename_trim}'");
|
||||
unset($retval);mwexec($cmd,$retval);
|
||||
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
||||
if ($retval == 0) {
|
||||
$savemsg .= gtext("Container restored successfully.");
|
||||
exec("echo '{$date}: {$application}: Container restored successfully from {$filename_trim}' >> {$logfile}");
|
||||
|
||||
@@ -296,7 +296,7 @@ if($_POST):
|
||||
break;
|
||||
else:
|
||||
if ($_POST['nowstop']):
|
||||
$cmd = ("/usr/local/bin/bastille stop {$item} && /usr/local/bin/bastille destroy {$item}");
|
||||
$cmd = ("/usr/local/bin/bastille destroy -f {$item}");
|
||||
else:
|
||||
$cmd = ("/usr/local/bin/bastille destroy {$item}");
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user