Commit f035b58d authored by Franco Fichtner's avatar Franco Fichtner

system: finally split up use_mfs_tmpvar for good

This is an inplace config migration.  The mount still behaves
the same way and a config save from the page migrates the
options.  We're not in a rush here, but the reason is that
we should have clean options and the new 17.1 images for nano
will depend on the new style.

(cherry picked from commit e413994c)
(cherry picked from commit 3d802a0a)
(cherry picked from commit 393fadce)
parent f077da78
......@@ -158,10 +158,9 @@ remove_mfs_link()
fi
}
# USE_MFS_TMP also catches and overrides USE_MFS_VAR (pre-16.7 compat)
# At some point we want to flip use_mfs_tmpvar to use_mfs_var instead.
USE_MFS_VAR=`/usr/bin/grep -c use_mfs_tmpvar /conf/config.xml`
USE_MFS_TMP=`/usr/bin/grep -c use_mfs_tmp /conf/config.xml`
# pre-17.1 compat: use_mfs_tmpvar matches both patterns
USE_MFS_VAR=`/usr/bin/grep -c 'use_mfs_.*var' /conf/config.xml`
USE_MFS_TMP=`/usr/bin/grep -c 'use_mfs_tmp' /conf/config.xml`
if [ ${USE_MFS_TMP} -ne 0 ]; then
mount -t tmpfs -o mode=01777 tmpfs /tmp
......
......@@ -79,8 +79,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['crypto_hardware'] = !empty($config['system']['crypto_hardware']) ? $config['system']['crypto_hardware'] : null;
$pconfig['cryptodev_enable'] = isset($config['system']['cryptodev_enable']);
$pconfig['thermal_hardware'] = !empty($config['system']['thermal_hardware']) ? $config['system']['thermal_hardware'] : null;
$pconfig['use_mfs_tmpvar'] = isset($config['system']['use_mfs_tmpvar']);
$pconfig['use_mfs_tmp'] = isset($config['system']['use_mfs_tmp']);
/* if the old use_mfs_tmpvar is found, set these flags, too */
$pconfig['use_mfs_var'] = isset($config['system']['use_mfs_tmpvar']) || isset($config['system']['use_mfs_var']);
$pconfig['use_mfs_tmp'] = isset($config['system']['use_mfs_tmpvar']) || isset($config['system']['use_mfs_tmp']);
$pconfig['rrdbackup'] = !empty($config['system']['rrdbackup']) ? $config['system']['rrdbackup'] : null;
$pconfig['dhcpbackup'] = !empty($config['system']['dhcpbackup']) ? $config['system']['dhcpbackup'] : null;
$pconfig['netflowbackup'] = !empty($config['system']['netflowbackup']) ? $config['system']['netflowbackup'] : null;
......@@ -138,9 +139,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['thermal_hardware']);
}
if (!empty($pconfig['use_mfs_tmpvar'])) {
$config['system']['use_mfs_tmpvar'] = true;
} elseif (isset($config['system']['use_mfs_tmpvar'])) {
if (!empty($pconfig['use_mfs_var'])) {
$config['system']['use_mfs_var'] = true;
} elseif (isset($config['system']['use_mfs_var'])) {
unset($config['system']['use_mfs_var']);
}
/* the config used to have this, but we've split it up in 17.1 */
if (isset($config['system']['use_mfs_tmpvar'])) {
unset($config['system']['use_mfs_tmpvar']);
}
......@@ -421,13 +427,13 @@ include("head.inc");
<th colspan="2" valign="top" class="listtopic"><?=gettext("RAM Disk Settings (Reboot to Apply Changes)"); ?></th>
</tr>
<tr>
<td><a id="help_for_use_mfs_tmpvar" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('/tmp and /var RAM disks'); ?></td>
<td><a id="help_for_use_mfs_var" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('/var RAM disk'); ?></td>
<td>
<input name="use_mfs_tmpvar" type="checkbox" id="use_mfs_tmpvar" value="yes" <?=!empty($pconfig['use_mfs_tmpvar']) ? 'checked="checked"' : '';?>/>
<strong><?=gettext("Use memory file system for /tmp and /var"); ?></strong>
<div class="hidden" for="help_for_use_mfs_tmpvar">
<?=gettext("Set this if you wish to use /tmp and /var as RAM disks (memory file system disks) " .
"rather than use the hard disk. Setting this will cause the data /var to be lost on reboot, including log data."); ?>
<input name="use_mfs_var" type="checkbox" id="use_mfs_var" value="yes" <?=!empty($pconfig['use_mfs_var']) ? 'checked="checked"' : '';?>/>
<strong><?=gettext("Use memory file system for /var"); ?></strong>
<div class="hidden" for="help_for_use_mfs_var">
<?=gettext("Set this if you wish to use /var as a RAM disk (memory file system disks) " .
"rather than using the hard disk. Setting this will cause the data /var to be lost on reboot, including log data."); ?>
</div>
</td>
</tr>
......@@ -437,7 +443,7 @@ include("head.inc");
<input name="use_mfs_tmp" type="checkbox" id="use_mfs_tmp" value="yes" <?=!empty($pconfig['use_mfs_tmp']) ? 'checked="checked"' : '';?>/>
<strong><?=gettext('Use memory file system for /tmp'); ?></strong>
<div class="hidden" for="help_for_use_mfs_tmp">
<?= gettext('Set this if you wish to use /tmp as a RAM disk (memory file system disk) rather than use the hard disk.') ?>
<?= gettext('Set this if you wish to use /tmp as a RAM disk (memory file system disk) rather than using the hard disk.') ?>
</div>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment