Add ability to enable ZFS easily
This commit is contained in:
@@ -58,6 +58,7 @@ $jail_dir = "{$rootfolder}/jails";
|
||||
$image_dir = "ext/bastille/images";
|
||||
$thick_jail = 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");
|
||||
|
||||
// Ensure the root directory is configured.
|
||||
if ($rootfolder == "")
|
||||
@@ -77,6 +78,20 @@ function is_dir_empty($reldir) {
|
||||
return (count(scandir($reldir)) == 2);
|
||||
}
|
||||
|
||||
// Check for sane ZFS settings.
|
||||
function get_state_zfs() {
|
||||
global $zfs_support;
|
||||
if ($zfs_support == "YES"):
|
||||
return $getinfo['zfs'] = gettext("Enabled");
|
||||
elseif ($zfs_support == "AVA"):
|
||||
return $getinfo['zfs'] = gettext("Available but not enabled");
|
||||
elseif ($zfs_support == "ERR"):
|
||||
return $getinfo['zfs'] = gettext("Invalid ZFS configuration");
|
||||
else:
|
||||
return $getinfo['zfs'] = gettext("Disabled");
|
||||
endif;
|
||||
}
|
||||
|
||||
// Get all base releases list.
|
||||
function get_all_release_list() {
|
||||
global $rootfolder;
|
||||
|
||||
@@ -118,15 +118,17 @@ else {
|
||||
if ($_POST) {
|
||||
unset($input_errors);
|
||||
|
||||
if (isset($_POST['saveParam']) && $_POST['saveParam']) { // saveParam s/n/v: [[outputs.influxdb]]#urls outputsinfluxdburls ["http://192.168.1.XYZ:8086"]
|
||||
if (isset($_POST['saveParam']) && $_POST['saveParam']) { // saveParam s/n/v
|
||||
$buttonTag = explode("#", $_POST['saveParam']); // buttonTag[0] = section, buttonTag[1] = paramName
|
||||
$hashTag = str_replace(["[", "]", ".", "#"], "", $buttonTag[0]); // create destination to jump to after post
|
||||
$nameTag = str_replace(["[", "]", ".", "#"], "", $_POST['saveParam']); // nameTag = <input title='$nameTag + addParam' ... />
|
||||
$configArray[$buttonTag[0]][$buttonTag[1]] = $_POST[$nameTag]; // save param to section
|
||||
# $savemsg .= "saveParam s/n/v: ".$_POST['saveParam']." ".$nameTag." ".$_POST[$nameTag];
|
||||
#$savemsg .= "saveParam s/n/v: ".$_POST['saveParam']." ".$nameTag." ".$_POST[$nameTag];
|
||||
}
|
||||
|
||||
if (empty($input_errors) && !isset($_POST['loadConfig'])) saveConfigFile($configFile, $configArray, $hashTag);
|
||||
|
||||
# Run bastille-init to update config.
|
||||
exec("bastille-init");
|
||||
}
|
||||
|
||||
bindtextdomain("xigmanas", $textdomain);
|
||||
|
||||
@@ -270,6 +270,10 @@ $(document).ready(function(){
|
||||
<tr>
|
||||
<td class="vncellt"><?=gtext("Extension version");?></td>
|
||||
<td class="vtable"><span name="getinfo_ext" id="getinfo_ext"><?=get_version_ext()?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="vncellt"><?=gtext("ZFS support");?></td>
|
||||
<td class="vtable"><span name="getinfo_zfs" id="getinfo_zfs"><?=get_state_zfs()?></span></td>
|
||||
</tr>
|
||||
<?php html_filechooser("backup_path", gtext("Backup directory"), $backup_path, gtext("Directory to store containers backup archives, use as file chooser for restoring from file."), $backup_path, true, 60);?>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user