From 7b2290139d7a52e2a77b76dcae6a524c1d959ecd Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 12 Nov 2012 15:41:36 -0500 Subject: Add button to switch between read/write and read-only on Diag > NanoBSD; Add setting to keep the media read/write at all times; Add indication of ro/rw status on Dashboard. --- usr/local/www/diag_nanobsd.php | 51 ++++++++++++++++++++++ .../widgets/widgets/system_information.widget.php | 3 +- 2 files changed, 53 insertions(+), 1 deletion(-) (limited to 'usr/local') diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php index 4289eda..353f9ba 100755 --- a/usr/local/www/diag_nanobsd.php +++ b/usr/local/www/diag_nanobsd.php @@ -108,6 +108,25 @@ if (isset($_POST['dhcpbackup'])) { install_cron_job("/etc/rc.backup_dhcpleases.sh", ($config['system']['dhcpbackup'] > 0), $minute="0", "*/{$config['system']['dhcpbackup']}"); } +if ($_POST['changero']) { + if (is_writable("/")) { + conf_mount_ro(); + } else { + conf_mount_rw(); + } +} + +if ($_POST['setrw']) { + if (isset($_POST['nanobsd_force_rw'])) { + conf_mount_rw(); + $config['system']['nanobsd_force_rw'] = true; + } else { + unset($config['system']['nanobsd_force_rw']); + } + + write_config("Changed Permanent Read/Write Setting"); + conf_mount_ro(); +} if ($savemsg) print_info_box($savemsg) @@ -155,6 +174,38 @@ if ($savemsg)   + + + + Current Read/Write Status: + +
+ "; + } else { + echo gettext("Read-Only"); + if (!isset($config['system']['nanobsd_force_rw'])) + echo "
"; + } ?> +
+
+ + + + Permanent Read/Write: + +
+ > +
+
+ + + +   + + diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 2a7055d..82f3415 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -120,11 +120,12 @@ $curcfg = $config['system']['firmware']; global $GLABEL_SLICE, $UFS_ID, $OLD_UFS_ID, $BOOTFLASH; global $BOOT_DEVICE, $REAL_BOOT_DEVICE, $BOOT_DRIVE, $ACTIVE_SLICE; nanobsd_detect_slice_info(); + $rw = is_writable("/") ? "(rw)" : "(ro)"; ?> NanoBSD Boot Slice - / + /

Next Boot:
/ -- cgit v1.1