" . gettext("If you would like to boot from this newly duplicated slice please set it using the bootup information area."); $class = 'alert-success'; } else { $savemsg = gettext("There was an error while duplicating the slice. Operation aborted."); $class = 'alert-danger'; } // Re-Survey slice info nanobsd_detect_slice_info(); } if ($_POST['changero']) { if (!DEBUG && is_writable("/")) { conf_mount_ro(); } else { conf_mount_rw(); } } if ($_POST['setrw']) { if (!DEBUG) { conf_mount_rw(); if (isset($_POST['nanobsd_force_rw'])) { $savemsg = gettext("Permanent read/write has been set successfully."); $class = 'alert-success'; $config['system']['nanobsd_force_rw'] = true; } else { $savemsg = gettext('Permanent read/write has been cleared successfully.'); $class = 'alert-success'; unset($config['system']['nanobsd_force_rw']); } write_config(gettext("Changed Permanent Read/Write Setting")); conf_mount_ro(); } else { $savemsg = gettext('Saved r/w permanently'); $class = 'alert-success'; } } print_info_box(gettext("The options on this page are intended for use by advanced users only.")); if ($savemsg) { print_info_box($savemsg, $class); } $form = new Form(false); $section = new Form_Section('NanoBSD Options'); $section->addInput(new Form_StaticText( 'Image Size', $NANOBSD_SIZE )); $slicebtn = new Form_Button('bootslice', 'Switch Slice'); $slicebtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); $section->addInput(new Form_StaticText( 'Bootup slice', $ACTIVE_SLICE . ' ' . $slicebtn )); $refcount = refcount_read(1000); if (is_writable("/")) { /* refcount_read returns -1 when shared memory section does not exist */ /* refcount can be zero here when the user has set nanobsd_force_rw */ /* refcount 1 is normal, so only display the count for abnormal values */ if ($refcount == 1 || $refcount == 0 || $refcount == -1) { $refdisplay = ""; } else { $refdisplay = " ". sprintf(gettext("(Reference count %s)"), $refcount); } $lbl = gettext("Read/Write") . $refdisplay; $btnlbl = gettext("Switch to Read-Only"); } else { $lbl = gettext("Read-Only"); $btnlbl = gettext("Switch to Read/Write"); } // Only show the changero button if force read/write is off, or the file system is not in writable state, or there is an unusual refcount. // If force read/write is on, and the file system is in writable state, and refcount is normal then the user has no reason to mess about. if (!isset($config['system']['nanobsd_force_rw']) || !is_writable("/") || ($refcount > 1)) { $robtn = new Form_Button('changero', $btnlbl); $robtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); $lbl .= ' ' . $robtn; } $section->addInput(new Form_StaticText( 'Read/Write status', $lbl ))->setHelp('This setting is only temporary, and can be switched dynamically in the background.'); $section->addInput(new Form_Checkbox( 'nanobsd_force_rw', 'Permanent Read/Write', 'Keep media mounted read/write at all times. ', isset($config['system']['nanobsd_force_rw']) )); $permbtn = new Form_Button('setrw', 'Save'); $permbtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); $section->addInput(new Form_StaticText( null, $permbtn )); $section->addInput(new Form_Input( 'destslice', null, 'hidden', $COMPLETE_PATH )); $dupbtn = new Form_Button('duplicateslice', 'Duplicate ' . $COMPLETE_BOOT_PATH . ' -> ' . $TOFLASH); $dupbtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); $section->addInput(new Form_StaticText( 'Duplicate boot slice', $dupbtn ))->setHelp('This will duplicate the bootup slice to the alternate slice. Use this if you would like to duplicate the known good working boot partition to the alternate.'); $section->addInput(new Form_StaticText( 'RRD/DHCP Backup', 'These options have been relocated to the ' . '' . 'System > Advanced, Miscellaneous tab.' )); if (file_exists("/conf/upgrade_log.txt")) { $viewbtn = new Form_Button('viewupgradelog', 'View log'); $viewbtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); $section->addInput(new Form_StaticText( 'View previous upgrade log', $viewbtn )); } $form->add($section); print($form); if (file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) { ?>