mirror of
https://github.com/unraid/webgui.git
synced 2026-05-12 07:10:52 -05:00
Handle $disk['fsType'] possibly having "luks:" prefix which checking file system type.
Don't permit choosing encrypted file system type if there's no encryption keyfile present. (Don't know if this is such as good idea or not, may end up changing this again.)
This commit is contained in:
@@ -36,6 +36,8 @@ function maintenance_mode() {
|
||||
global $var;
|
||||
return ($var['fsState']=="Started" && $var['startMode']=="Maintenance") ? '' : 'disabled';
|
||||
}
|
||||
|
||||
$luks_disabled = file_exists($var['luksKeyfile']) ? '' : 'disabled';
|
||||
?>
|
||||
<script>
|
||||
function doDispatch(form) {
|
||||
@@ -154,17 +156,22 @@ File system type:
|
||||
<?=mk_option($disk['fsType'], "xfs", "xfs")?>
|
||||
<?=mk_option($disk['fsType'], "btrfs", "btrfs")?>
|
||||
<?=mk_option($disk['fsType'], "reiserfs", "reiserfs")?>
|
||||
<?=mk_option($disk['fsType'], "luks:xfs", "xfs - encrypted")?>
|
||||
<?=mk_option($disk['fsType'], "luks:btrfs", "btrfs - encrypted")?>
|
||||
<?=mk_option($disk['fsType'], "luks:reiserfs", "reiserfs - encrypted")?>
|
||||
<?=mk_option($disk['fsType'], "luks:xfs", "xfs - encrypted", $luks_disabled)?>
|
||||
<?=mk_option($disk['fsType'], "luks:btrfs", "btrfs - encrypted", $luks_disabled)?>
|
||||
<?=mk_option($disk['fsType'], "luks:reiserfs", "reiserfs - encrypted", $luks_disabled)?>
|
||||
</select>
|
||||
|
||||
> Enter the desired file system type. Changing the file system type of a device will permit you to reformat
|
||||
> that device using the new file system. Be aware that **all existing data on the device will be lost**.
|
||||
>
|
||||
> The encrypted file system types may only be selected when an [encryption key](/Settings/EncryptionSettings) is present.
|
||||
|
||||
<?elseif ($var['SYS_CACHE_SLOTS']>1):?>
|
||||
File system type:
|
||||
: <select id="diskFsType" name="diskFsType.<?=$disk['idx'];?>" size="1" <?=$disabled?>>
|
||||
<?=mk_option($disk['fsType'], "auto", "auto")?>
|
||||
<?=mk_option($disk['fsType'], "btrfs", "btrfs")?>
|
||||
<?=mk_option($disk['fsType'], "luks:btrfs", "btrfs - encrypted")?>
|
||||
<?=mk_option($disk['fsType'], "luks:btrfs", "btrfs - encrypted", $luks_disabled)?>
|
||||
</select>
|
||||
|
||||
<?endif;?>
|
||||
@@ -208,7 +215,7 @@ btrfs filesystem show:
|
||||
: <?echo "<pre>".shell_exec("/sbin/btrfs filesystem show {$disk['uuid']}")."</pre>";?>
|
||||
|
||||
<?endif;?>
|
||||
<?if ($disk['fsType']=="btrfs"):?>
|
||||
<?if (strpos($disk['fsType'],"btrfs")):?>
|
||||
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-balance-scale"></i>Balance Status</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($disk['fsStatus']=="Mounted"):?>
|
||||
@@ -259,7 +266,7 @@ btrfs balance status:
|
||||
<?endif;?>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?if ($disk['fsType']=="btrfs"):?>
|
||||
<?if (strpos($disk['fsType'],"btrfs")):?>
|
||||
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-paint-brush"></i>Scrub Status</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($disk['fsStatus']=="Mounted"):?>
|
||||
@@ -301,7 +308,7 @@ btrfs scrub status:
|
||||
<?endif;?>
|
||||
</form>
|
||||
<?endif?>
|
||||
<?if ($disk['fsType']=="btrfs"):?>
|
||||
<?if (strpos($disk['fsType'],"btrfs")):?>
|
||||
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
|
||||
@@ -349,7 +356,7 @@ btrfs check status:
|
||||
<?endif;?>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?if ($disk['fsType']=="reiserfs"):?>
|
||||
<?if (strpos($disk['fsType'],"reiserfs")):?>
|
||||
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
|
||||
@@ -398,7 +405,7 @@ reiserfsck status:
|
||||
<?endif;?>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?if ($disk['fsType']=="xfs"):?>
|
||||
<?if (strpos($disk['fsType'],"xfs")):?>
|
||||
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
|
||||
<?if ($var['fsState']=="Started" && $var['startMode']=='Maintenance'):?>
|
||||
|
||||
@@ -201,7 +201,7 @@ foreach ($devices as $device) {
|
||||
exec("smartctl -a $type ".escapeshellarg("/dev/$dev")." 2>/dev/null|todos >".escapeshellarg("/$diag/smart/$name-$date.txt"));
|
||||
}
|
||||
// create cache pool information
|
||||
if (is_dir('/mnt/cache') && $disks['cache']['fsType']=='btrfs') {
|
||||
if (is_dir('/mnt/cache') && strpos($disks['cache']['fsType'],'btrfs')) {
|
||||
exec("/sbin/btrfs filesystem usage /mnt/cache 2>/dev/null|todos >".escapeshellarg("/$diag/system/btrfs-usage.txt"));
|
||||
}
|
||||
// create resulting zip file and remove temp folder
|
||||
|
||||
@@ -236,7 +236,7 @@ foreach ($disks as $disk) {
|
||||
if ($disk['numErrors']>0) $errors[] = "$text - $info (errors {$disk['numErrors']})";
|
||||
// check file system of cache pool
|
||||
$item = 'pool';
|
||||
if ($name=='cache' && $disk['fsType']=='btrfs') {
|
||||
if ($name=='cache' && strpos($disk['fsType'],'btrfs')) {
|
||||
$attr = 'missing';
|
||||
if (exec("/sbin/btrfs filesystem show {$disk['uuid']} 2>/dev/null|grep -c 'missing'")>0) {
|
||||
if (empty($saved[$item][$attr])) {
|
||||
|
||||
Reference in New Issue
Block a user