Improved fstab utility, don't allow blank fields

This commit is contained in:
Jose
2019-12-19 13:30:36 -04:00
parent 37cc1ea1b0
commit 188cebfc80
3 changed files with 25 additions and 21 deletions
+1
View File
@@ -3,6 +3,7 @@
====================== ======================
Version Description Version Description
1.0.27......Improved fstab utility, don't allow blank fields.
1.0.26......Improved jail IP search during import. 1.0.26......Improved jail IP search during import.
1.0.25......Add foreign jail import support, improved fstab utility. 1.0.25......Add foreign jail import support, improved fstab utility.
1.0.24......Improved Thick container upgrade process. 1.0.24......Improved Thick container upgrade process.
+23 -20
View File
@@ -244,32 +244,35 @@ if($_POST):
$dir_mode = "rw"; $dir_mode = "rw";
endif; endif;
if (!$paths_exist): if ((!$sourcedir) || (!$targetdir)):
$cmd = ("/bin/echo \"{$sourcedir} {$targetdir} nullfs {$dir_mode} 0 0\" >> {$rootfolder}/jails/{$item}/fstab"); $errormsg .= gtext("Soure/Target directory can't be left blank.");
unset($output,$retval);mwexec2($cmd,$output,$retval); else:
if($retval == 0): if (!$paths_exist):
$cmd = ("/bin/echo \"{$sourcedir} {$targetdir} nullfs {$dir_mode} 0 0\" >> {$rootfolder}/jails/{$item}/fstab");
unset($output,$retval);mwexec2($cmd,$output,$retval);
if($retval == 0):
if ($_POST['createdir']): if ($_POST['createdir']):
if (!is_dir("{$targetdir}")): if (!is_dir("{$targetdir}")):
mkdir("$targetdir"); mkdir("$targetdir");
endif; endif;
if ($_POST['automount']): if ($_POST['automount']):
if ($is_running): if ($is_running):
exec("/sbin/mount_nullfs -o {$dir_mode} {$sourcedir} {$targetdir}"); exec("/sbin/mount_nullfs -o {$dir_mode} {$sourcedir} {$targetdir}");
endif;
endif; endif;
endif; endif;
$savemsg .= gtext("Edited the fstab successfully.");
//header('Location: bastille_manager_gui.php');
//exit;
else:
$errormsg .= gtext("Failed to edit the fstab.");
endif; endif;
$savemsg .= gtext("Edited the fstab successfully.");
//header('Location: bastille_manager_gui.php');
//exit;
else: else:
$errormsg .= gtext("Failed to edit the fstab."); $savemsg .= gtext("Directories already exist in the fstab.");
endif; endif;
else:
$savemsg .= gtext("Directories already exist in the fstab.");
endif; endif;
endif; endif;
break; break;
@@ -431,7 +434,7 @@ $document->render();
$current_release = "-"; $current_release = "-";
endif; endif;
endif; endif;
$pconfig['source_path'] = "/mnt"; $pconfig['source_path'] = "";
$pconfig['target_path'] = "{$rootfolder}/jails/{$pconfig['jailname']}/root/mnt/"; $pconfig['target_path'] = "{$rootfolder}/jails/{$pconfig['jailname']}/root/mnt/";
html_text2('jailname',gettext('Container name:'),htmlspecialchars($pconfig['jailname'])); html_text2('jailname',gettext('Container name:'),htmlspecialchars($pconfig['jailname']));
$a_action = [ $a_action = [
+1 -1
View File
@@ -1 +1 @@
1.0.26 1.0.27