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() ...@@ -158,10 +158,9 @@ remove_mfs_link()
fi fi
} }
# USE_MFS_TMP also catches and overrides USE_MFS_VAR (pre-16.7 compat) # pre-17.1 compat: use_mfs_tmpvar matches both patterns
# At some point we want to flip use_mfs_tmpvar to use_mfs_var instead. USE_MFS_VAR=`/usr/bin/grep -c 'use_mfs_.*var' /conf/config.xml`
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`
USE_MFS_TMP=`/usr/bin/grep -c use_mfs_tmp /conf/config.xml`
if [ ${USE_MFS_TMP} -ne 0 ]; then if [ ${USE_MFS_TMP} -ne 0 ]; then
mount -t tmpfs -o mode=01777 tmpfs /tmp mount -t tmpfs -o mode=01777 tmpfs /tmp
......
...@@ -79,8 +79,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -79,8 +79,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['crypto_hardware'] = !empty($config['system']['crypto_hardware']) ? $config['system']['crypto_hardware'] : null; $pconfig['crypto_hardware'] = !empty($config['system']['crypto_hardware']) ? $config['system']['crypto_hardware'] : null;
$pconfig['cryptodev_enable'] = isset($config['system']['cryptodev_enable']); $pconfig['cryptodev_enable'] = isset($config['system']['cryptodev_enable']);
$pconfig['thermal_hardware'] = !empty($config['system']['thermal_hardware']) ? $config['system']['thermal_hardware'] : null; $pconfig['thermal_hardware'] = !empty($config['system']['thermal_hardware']) ? $config['system']['thermal_hardware'] : null;
$pconfig['use_mfs_tmpvar'] = isset($config['system']['use_mfs_tmpvar']); /* if the old use_mfs_tmpvar is found, set these flags, too */
$pconfig['use_mfs_tmp'] = isset($config['system']['use_mfs_tmp']); $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['rrdbackup'] = !empty($config['system']['rrdbackup']) ? $config['system']['rrdbackup'] : null;
$pconfig['dhcpbackup'] = !empty($config['system']['dhcpbackup']) ? $config['system']['dhcpbackup'] : null; $pconfig['dhcpbackup'] = !empty($config['system']['dhcpbackup']) ? $config['system']['dhcpbackup'] : null;
$pconfig['netflowbackup'] = !empty($config['system']['netflowbackup']) ? $config['system']['netflowbackup'] : null; $pconfig['netflowbackup'] = !empty($config['system']['netflowbackup']) ? $config['system']['netflowbackup'] : null;
...@@ -138,9 +139,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -138,9 +139,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['thermal_hardware']); unset($config['system']['thermal_hardware']);
} }
if (!empty($pconfig['use_mfs_tmpvar'])) { if (!empty($pconfig['use_mfs_var'])) {
$config['system']['use_mfs_tmpvar'] = true; $config['system']['use_mfs_var'] = true;
} elseif (isset($config['system']['use_mfs_tmpvar'])) { } 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']); unset($config['system']['use_mfs_tmpvar']);
} }
...@@ -421,13 +427,13 @@ include("head.inc"); ...@@ -421,13 +427,13 @@ include("head.inc");
<th colspan="2" valign="top" class="listtopic"><?=gettext("RAM Disk Settings (Reboot to Apply Changes)"); ?></th> <th colspan="2" valign="top" class="listtopic"><?=gettext("RAM Disk Settings (Reboot to Apply Changes)"); ?></th>
</tr> </tr>
<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> <td>
<input name="use_mfs_tmpvar" type="checkbox" id="use_mfs_tmpvar" value="yes" <?=!empty($pconfig['use_mfs_tmpvar']) ? 'checked="checked"' : '';?>/> <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 /tmp and /var"); ?></strong> <strong><?=gettext("Use memory file system for /var"); ?></strong>
<div class="hidden" for="help_for_use_mfs_tmpvar"> <div class="hidden" for="help_for_use_mfs_var">
<?=gettext("Set this if you wish to use /tmp and /var as RAM disks (memory file system disks) " . <?=gettext("Set this if you wish to use /var as a RAM disk (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."); ?> "rather than using the hard disk. Setting this will cause the data /var to be lost on reboot, including log data."); ?>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -437,7 +443,7 @@ include("head.inc"); ...@@ -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"' : '';?>/> <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> <strong><?=gettext('Use memory file system for /tmp'); ?></strong>
<div class="hidden" for="help_for_use_mfs_tmp"> <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> </div>
</td> </td>
</tr> </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