Deprecate nanobsd platform and remove all conditionals that uses it

This commit is contained in:
Renato Botelho 2016-10-12 16:29:07 -03:00
parent 9ed7f8f635
commit dc61252ae4
25 changed files with 87 additions and 407 deletions

View File

@ -44,13 +44,6 @@ if (file_exists("/cf/conf/use_xmlreader")) {
} }
require_once("crypt.inc"); require_once("crypt.inc");
/* read platform */
if (file_exists("{$g['etc_path']}/platform")) {
$g['platform'] = chop(file_get_contents("{$g['etc_path']}/platform"));
} else {
$g['platform'] = "unknown";
}
/* if /debugging exists, lets set $debugging /* if /debugging exists, lets set $debugging
so we can output more information */ so we can output more information */
if (file_exists("/debugging")) { if (file_exists("/debugging")) {

View File

@ -57,13 +57,6 @@ if (file_exists("/cf/conf/use_xmlreader")) {
} }
require_once("crypt.inc"); require_once("crypt.inc");
/* read platform */
if (file_exists("{$g['etc_path']}/platform")) {
$g['platform'] = chop(file_get_contents("{$g['etc_path']}/platform"));
} else {
$g['platform'] = "unknown";
}
/* if /debugging exists, lets set $debugging /* if /debugging exists, lets set $debugging
so we can output more information */ so we can output more information */
if (file_exists("/debugging")) { if (file_exists("/debugging")) {

View File

@ -98,12 +98,8 @@ if (is_numeric($g["product_version_patch"]) && $g["product_version_patch"] != "0
$g['product_version_string'] .= "-p{$g['product_version_patch']}"; $g['product_version_string'] .= "-p{$g['product_version_patch']}";
} }
if (file_exists("/etc/platform")) { /* XXX: Backward compatible */
$g['platform'] = trim(file_get_contents("/etc/platform")); $g['platform'] = $g['product_name'];
} else {
// shouldn't happen but "just in case" no platform were detected
$g['platform'] = 'undetected';
}
if (file_exists("{$g['etc_path']}/default-config-flavor")) { if (file_exists("{$g['etc_path']}/default-config-flavor")) {
$flavor_array = file("{$g['etc_path']}/default-config-flavor"); $flavor_array = file("{$g['etc_path']}/default-config-flavor");

View File

@ -928,7 +928,7 @@ function host_firmware_version($tocheck = "") {
"firmware" => array("version" => $g['product_version']), "firmware" => array("version" => $g['product_version']),
"kernel" => array("version" => $os_version), "kernel" => array("version" => $os_version),
"base" => array("version" => $os_version), "base" => array("version" => $os_version),
"platform" => trim(file_get_contents('/etc/platform', " \n")), "platform" => $g['platform'],
"config_version" => $config['version'] "config_version" => $config['version']
); );
} }
@ -1078,15 +1078,11 @@ function setup_serial_port($when = "save", $path = "") {
$serialspeed = (is_numeric($config['system']['serialspeed'])) ? $config['system']['serialspeed'] : "115200"; $serialspeed = (is_numeric($config['system']['serialspeed'])) ? $config['system']['serialspeed'] : "115200";
$serial_only = false; $serial_only = false;
if (($g['platform'] == "nanobsd") && isset($g['enableserial_force'])) { $specific_platform = system_identify_specific_platform();
if ($specific_platform['name'] == 'RCC-VE' ||
$specific_platform['name'] == 'RCC' ||
$specific_platform['name'] == 'RCC-DFF') {
$serial_only = true; $serial_only = true;
} else {
$specific_platform = system_identify_specific_platform();
if ($specific_platform['name'] == 'RCC-VE' ||
$specific_platform['name'] == 'RCC' ||
$specific_platform['name'] == 'RCC-DFF') {
$serial_only = true;
}
} }
$boot_config_split = explode("\n", $boot_config); $boot_config_split = explode("\n", $boot_config);
@ -1197,8 +1193,7 @@ function is_serial_enabled() {
global $g, $config; global $g, $config;
if (!isset($g['enableserial_force']) && if (!isset($g['enableserial_force']) &&
!isset($config['system']['enableserial']) && !isset($config['system']['enableserial'])) {
($g['platform'] == $g['product_name'])) {
return false; return false;
} }
@ -2383,7 +2378,7 @@ function process_alias_urltable($name, $type, $url, $freq, $forceupdate=false, $
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/RAM_Disk_Store{$urltable_filename}.tgz"); unlink_if_exists("{$g['cf_conf_path']}/RAM_Disk_Store{$urltable_filename}.tgz");
} else { } else {
/* Update the RAM disk store with the new/updated table file. */ /* Update the RAM disk store with the new/updated table file. */
@ -2402,151 +2397,6 @@ function process_alias_urltable($name, $type, $url, $freq, $forceupdate=false, $
return -1; return -1;
} }
} }
function get_real_slice_from_glabel($label) {
$label = escapeshellarg($label);
return trim(`/sbin/glabel list | /usr/bin/grep -B2 ufs/{$label} | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' '`);
}
function nanobsd_get_boot_slice() {
return trim(`/sbin/mount | /usr/bin/grep pfsense | /usr/bin/cut -d'/' -f4 | /usr/bin/cut -d' ' -f1`);
}
function nanobsd_get_boot_drive() {
return trim(`/sbin/glabel list | /usr/bin/grep -B2 ufs/pfsense | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' ' | /usr/bin/cut -d's' -f1`);
}
function nanobsd_get_active_slice() {
$boot_drive = nanobsd_get_boot_drive();
$active = trim(`gpart show $boot_drive | grep '\[active\]' | awk '{print $3;}'`);
return "{$boot_drive}s{$active}";
}
function nanobsd_get_size() {
return strtoupper(file_get_contents("/etc/nanosize.txt"));
}
function nanobsd_switch_boot_slice() {
global $SLICE, $OLDSLICE, $TOFLASH, $COMPLETE_PATH, $COMPLETE_BOOT_PATH;
global $GLABEL_SLICE, $UFS_ID, $OLD_UFS_ID, $BOOTFLASH;
global $BOOT_DEVICE, $REAL_BOOT_DEVICE, $BOOT_DRIVE, $ACTIVE_SLICE;
nanobsd_detect_slice_info();
if ($BOOTFLASH == $ACTIVE_SLICE) {
$slice = $TOFLASH;
} else {
$slice = $BOOTFLASH;
}
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_flush();
}
ob_implicit_flush(1);
if (strstr($slice, "s2")) {
$ASLICE = "2";
$AOLDSLICE = "1";
$AGLABEL_SLICE = "pfsense1";
$AUFS_ID = "1";
$AOLD_UFS_ID = "0";
} else {
$ASLICE = "1";
$AOLDSLICE = "2";
$AGLABEL_SLICE = "pfsense0";
$AUFS_ID = "0";
$AOLD_UFS_ID = "1";
}
$ATOFLASH = "{$BOOT_DRIVE}s{$ASLICE}";
$ACOMPLETE_PATH = "{$BOOT_DRIVE}s{$ASLICE}a";
$ABOOTFLASH = "{$BOOT_DRIVE}s{$AOLDSLICE}";
set_single_sysctl("kern.geom.debugflags", "16");
exec("/sbin/gpart set -a active -i {$ASLICE} {$BOOT_DRIVE}");
exec("/usr/sbin/boot0cfg -s {$ASLICE} -v /dev/{$BOOT_DRIVE}");
// We can't update these if they are mounted now.
if ($BOOTFLASH != $slice) {
exec("/sbin/tunefs -L ${AGLABEL_SLICE} /dev/$ACOMPLETE_PATH");
nanobsd_update_fstab($AGLABEL_SLICE, $ACOMPLETE_PATH, $AOLD_UFS_ID, $AUFS_ID);
}
set_single_sysctl("kern.geom.debugflags", "0");
}
function nanobsd_clone_slice() {
global $SLICE, $OLDSLICE, $TOFLASH, $COMPLETE_PATH, $COMPLETE_BOOT_PATH;
global $GLABEL_SLICE, $UFS_ID, $OLD_UFS_ID, $BOOTFLASH;
global $BOOT_DEVICE, $REAL_BOOT_DEVICE, $BOOT_DRIVE, $ACTIVE_SLICE;
nanobsd_detect_slice_info();
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_flush();
}
ob_implicit_flush(1);
set_single_sysctl("kern.geom.debugflags", "16");
exec("/bin/dd if=/dev/zero of=/dev/{$TOFLASH} bs=1m count=1");
exec("/bin/dd if=/dev/{$BOOTFLASH} of=/dev/{$TOFLASH} bs=64k");
exec("/sbin/tunefs -L {$GLABEL_SLICE} /dev/{$COMPLETE_PATH}");
$status = nanobsd_update_fstab($GLABEL_SLICE, $COMPLETE_PATH, $OLD_UFS_ID, $UFS_ID);
set_single_sysctl("kern.geom.debugflags", "0");
if ($status) {
return false;
} else {
return true;
}
}
function nanobsd_update_fstab($gslice, $complete_path, $oldufs, $newufs) {
$tmppath = "/tmp/{$gslice}";
$fstabpath = "/tmp/{$gslice}/etc/fstab";
mkdir($tmppath);
exec("/sbin/fsck_ufs -y /dev/{$complete_path}");
exec("/sbin/mount /dev/ufs/{$gslice} {$tmppath}");
copy("/etc/fstab", $fstabpath);
if (!file_exists($fstabpath)) {
$fstab = <<<EOF
/dev/ufs/{$gslice} / ufs ro,noatime 1 1
/dev/ufs/cf /cf ufs ro,noatime 1 1
EOF;
if (file_put_contents($fstabpath, $fstab)) {
$status = true;
} else {
$status = false;
}
} else {
$status = exec("/usr/bin/sed -i \"\" \"s/pfsense{$oldufs}/pfsense{$newufs}/g\" {$fstabpath}");
}
exec("/sbin/umount {$tmppath}");
rmdir($tmppath);
return $status;
}
function nanobsd_detect_slice_info() {
global $SLICE, $OLDSLICE, $TOFLASH, $COMPLETE_PATH, $COMPLETE_BOOT_PATH;
global $GLABEL_SLICE, $UFS_ID, $OLD_UFS_ID, $BOOTFLASH;
global $BOOT_DEVICE, $REAL_BOOT_DEVICE, $BOOT_DRIVE, $ACTIVE_SLICE;
$BOOT_DEVICE=nanobsd_get_boot_slice();
$REAL_BOOT_DEVICE=get_real_slice_from_glabel($BOOT_DEVICE);
$BOOT_DRIVE=nanobsd_get_boot_drive();
$ACTIVE_SLICE=nanobsd_get_active_slice();
// Detect which slice is active and set information.
if (strstr($REAL_BOOT_DEVICE, "s1")) {
$SLICE = "2";
$OLDSLICE = "1";
$GLABEL_SLICE = "pfsense1";
$UFS_ID = "1";
$OLD_UFS_ID = "0";
} else {
$SLICE = "1";
$OLDSLICE = "2";
$GLABEL_SLICE = "pfsense0";
$UFS_ID = "0";
$OLD_UFS_ID = "1";
}
$TOFLASH = "{$BOOT_DRIVE}s{$SLICE}";
$COMPLETE_PATH = "{$BOOT_DRIVE}s{$SLICE}a";
$COMPLETE_BOOT_PATH = "{$BOOT_DRIVE}s{$OLDSLICE}";
$BOOTFLASH = "{$BOOT_DRIVE}s{$OLDSLICE}";
}
function nanobsd_friendly_slice_name($slicename) {
global $g;
return strtolower(str_ireplace('pfsense', $g['product_name'], $slicename));
}
function get_include_contents($filename) { function get_include_contents($filename) {
if (is_file($filename)) { if (is_file($filename)) {
@ -3305,7 +3155,7 @@ function restore_aliastables() {
} }
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$file}"); unlink_if_exists("{$file}");
} }
} }

View File

@ -93,8 +93,7 @@ function pkg_env($extra_env = array()) {
$pkg_env_vars['HTTP_PROXY'] = $http_proxy; $pkg_env_vars['HTTP_PROXY'] = $http_proxy;
} }
if ($g['platform'] == "nanobsd" || if (isset($config['system']['use_mfs_tmpvar'])) {
isset($config['system']['use_mfs_tmpvar'])) {
$pkg_env_vars['PKG_DBDIR'] = '/root/var/db/pkg'; $pkg_env_vars['PKG_DBDIR'] = '/root/var/db/pkg';
$pkg_env_vars['PKG_CACHEDIR'] = '/root/var/cache/pkg'; $pkg_env_vars['PKG_CACHEDIR'] = '/root/var/cache/pkg';
} }

View File

@ -42,7 +42,7 @@ function restore_rrd() {
$rrdrestore = ""; $rrdrestore = "";
$rrdreturn = ""; $rrdreturn = "";
if (file_exists("{$g['cf_conf_path']}/rrd.tgz") && (isset($config['system']['use_mfs_tmpvar']) || $g['platform'] != $g['product_name'])) { if (file_exists("{$g['cf_conf_path']}/rrd.tgz") && isset($config['system']['use_mfs_tmpvar'])) {
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) { foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
@unlink($xml_file); @unlink($xml_file);
} }
@ -74,7 +74,7 @@ function restore_rrd() {
unset($rrdrestore); unset($rrdrestore);
@unlink("{$g['tmp_path']}/rrd_restore"); @unlink("{$g['tmp_path']}/rrd_restore");
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz"); unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz");
} }
return true; return true;

View File

@ -480,7 +480,7 @@ function services_dhcpdv4_configure() {
} }
} }
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */ /* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/dhcpleases.tgz"); unlink_if_exists("{$g['cf_conf_path']}/dhcpleases.tgz");
} }
} }
@ -1258,21 +1258,6 @@ function services_dhcpdv6_configure($blacklist = array()) {
return 0; return 0;
} }
if (platform_booting()) {
if ($g['platform'] != $g['product_name']) {
/* restore the leases, if we have them */
if (file_exists("{$g['cf_conf_path']}/dhcp6leases.tgz")) {
$dhcprestore = "";
$dhcpreturn = "";
exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/dhcp6leases.tgz 2>&1", $dhcprestore, $dhcpreturn);
$dhcprestore = implode(" ", $dhcprestore);
if ($dhcpreturn <> 0) {
log_error(sprintf(gettext('DHCP leases v6 restore failed exited with %1$s, the error is: %2$s'), $dhcpreturn, $dhcprestore));
}
}
}
}
$syscfg = $config['system']; $syscfg = $config['system'];
if (!is_array($config['dhcpdv6'])) { if (!is_array($config['dhcpdv6'])) {
$config['dhcpdv6'] = array(); $config['dhcpdv6'] = array();
@ -2335,12 +2320,8 @@ trap := "{$config['snmpd']['trapstring']}"
EOD; EOD;
} }
$platform = trim(file_get_contents('/etc/platform'));
if (($platform == "pfSense") && ($g['product_name'] != "pfSense")) {
$platform = $g['product_name'];
}
$sysDescr = "{$g['product_name']} " . php_uname("n") . $sysDescr = "{$g['product_name']} " . php_uname("n") .
" {$g['product_version']} {$platform} " . php_uname("s") . " {$g['product_version']} {$g['platform']} " . php_uname("s") .
" " . php_uname("r") . " " . php_uname("m"); " " . php_uname("r") . " " . php_uname("m");
$snmpdconf .= <<<EOD $snmpdconf .= <<<EOD

View File

@ -30,10 +30,6 @@ function activate_powerd() {
exec("/usr/bin/killall powerd"); exec("/usr/bin/killall powerd");
} }
if (isset($config['system']['powerd_enable'])) { if (isset($config['system']['powerd_enable'])) {
if ($g["platform"] == "nanobsd") {
exec("/sbin/kldload cpufreq");
}
$ac_mode = "hadp"; $ac_mode = "hadp";
if (!empty($config['system']['powerd_ac_mode'])) { if (!empty($config['system']['powerd_ac_mode'])) {
$ac_mode = $config['system']['powerd_ac_mode']; $ac_mode = $config['system']['powerd_ac_mode'];
@ -2212,11 +2208,6 @@ function system_identify_specific_platform() {
break; break;
} }
/* the rest of the code only deals with 'embedded' platforms */
if ($g['platform'] != 'nanobsd') {
return array('name' => $g['platform'], 'descr' => $g['platform']);
}
if (strpos($hw_model, "PC Engines WRAP") !== false) { if (strpos($hw_model, "PC Engines WRAP") !== false) {
return array('name' => 'wrap', 'descr' => gettext('PC Engines WRAP')); return array('name' => 'wrap', 'descr' => gettext('PC Engines WRAP'));
} }
@ -2245,8 +2236,7 @@ function system_identify_specific_platform() {
} }
unset($dmesg_boot); unset($dmesg_boot);
/* unknown embedded platform */ return array('name' => $g['platform'], 'descr' => $g['platform']);
return array('name' => 'embedded', 'descr' => gettext('embedded (unknown)'));
} }
function system_get_dmesg_boot() { function system_get_dmesg_boot() {

View File

@ -2064,7 +2064,7 @@ function upgrade_054_to_055() {
$rrddbpath = "/var/db/rrd/"; $rrddbpath = "/var/db/rrd/";
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
if ($g['platform'] != $g['product_name']) { if (isset($config['system']['use_mfs_tmpvar'])) {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
@ -2783,7 +2783,7 @@ function upgrade_080_to_081() {
$rrddbpath = "/var/db/rrd/"; $rrddbpath = "/var/db/rrd/";
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
if ($g['platform'] != $g['product_name']) { if (isset($config['system']['use_mfs_tmpvar'])) {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
@ -3255,7 +3255,7 @@ function upgrade_095_to_096() {
$rrddbpath = "/var/db/rrd"; $rrddbpath = "/var/db/rrd";
$rrdtool = "/usr/local/bin/rrdtool"; $rrdtool = "/usr/local/bin/rrdtool";
if ($g['platform'] != $g['product_name']) { if (isset($config['system']['use_mfs_tmpvar'])) {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
@ -4647,7 +4647,7 @@ function upgrade_145_to_146() {
$awkcmd .= " print;\n"; $awkcmd .= " print;\n";
$awkcmd .= "}'"; $awkcmd .= "}'";
if ($g['platform'] != $g['product_name']) { if (isset($config['system']['use_mfs_tmpvar'])) {
/* restore the databases, if we have one */ /* restore the databases, if we have one */
if (restore_rrd()) { if (restore_rrd()) {
/* Make sure to move the rrd backup out of the way. We will make a new one after converting. */ /* Make sure to move the rrd backup out of the way. We will make a new one after converting. */
@ -4866,7 +4866,7 @@ function upgrade_151_to_152() {
require_once("/etc/inc/services.inc"); require_once("/etc/inc/services.inc");
// Remove these cron jobs on full install if not using ramdisk. // Remove these cron jobs on full install if not using ramdisk.
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
install_cron_job("/etc/rc.backup_rrd.sh", false); install_cron_job("/etc/rc.backup_rrd.sh", false);
install_cron_job("/etc/rc.backup_dhcpleases.sh", false); install_cron_job("/etc/rc.backup_dhcpleases.sh", false);
} }

View File

@ -2017,11 +2017,7 @@ function get_memory() {
function mute_kernel_msgs() { function mute_kernel_msgs() {
global $g, $config; global $g, $config;
// Do not mute serial console. The kernel gets very very cranky
// and will start dishing you cannot control tty errors.
if ($g['platform'] == 'nanobsd') {
return;
}
if ($config['system']['enableserial']) { if ($config['system']['enableserial']) {
return; return;
} }
@ -2030,11 +2026,7 @@ function mute_kernel_msgs() {
function unmute_kernel_msgs() { function unmute_kernel_msgs() {
global $g; global $g;
// Do not mute serial console. The kernel gets very very cranky
// and will start dishing you cannot control tty errors.
if ($g['platform'] == 'nanobsd') {
return;
}
exec("/sbin/conscontrol mute off"); exec("/sbin/conscontrol mute off");
} }

View File

@ -32,9 +32,6 @@ HOME=/
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
export HOME PATH export HOME PATH
# Set our operating platform
PLATFORM=`/bin/cat /etc/platform`
# Set our current version # Set our current version
version=`/bin/cat /etc/version` version=`/bin/cat /etc/version`
@ -56,11 +53,9 @@ product=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var product_name pfS
# Setup dumpdev/ddb/savecore" # Setup dumpdev/ddb/savecore"
echo "Configuring crash dumps..." echo "Configuring crash dumps..."
if [ "$PLATFORM" = "${product}" ]; then /etc/rc.dumpon
/etc/rc.dumpon
fi
# Setup ddb on all platforms. On full install it will save the dump, on NanoBSD it will print to console and auto-reboot. # Setup ddb on all platforms.
if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
/sbin/ddb /etc/ddb.conf /sbin/ddb /etc/ddb.conf
fi fi
@ -102,13 +97,6 @@ while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
attempts=$((attempts+1)) attempts=$((attempts+1))
done done
if [ "${PLATFORM}" = "nanobsd" ]; then
# XXX This script does need all filesystems rw!!!!
# Put this workaround for now until better ways are found.
/sbin/mount -u -w -o sync,noatime /
/sbin/mount -u -w -o sync,noatime /cf
fi
# If /conf is a directory, convert it to a symlink to /cf/conf # If /conf is a directory, convert it to a symlink to /cf/conf
if [ -d "/conf" ]; then if [ -d "/conf" ]; then
# If item is not a symlink then rm and recreate # If item is not a symlink then rm and recreate
@ -121,26 +109,22 @@ fi
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar) USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
unset MOVE_PKG_DATA unset MOVE_PKG_DATA
if [ "$PLATFORM" = "${product}" ]; then # If use MFS var is disabled, move files back to place
# If use MFS var is disabled, move files back to place if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then
if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then
MOVE_PKG_DATA=1
rm -rf /var/db/pkg 2>/dev/null
rm -rf /var/cache/pkg 2>/dev/null
mv /root/var/db/pkg /var/db
mv /root/var/cache/pkg /var/cache
# If use MFS var is enabled, move files to a safe place
elif [ "${USE_MFS_TMPVAR}" = "true" -a -f /var/db/pkg/local.sqlite ]; then
MOVE_PKG_DATA=1
/bin/mkdir -p /root/var/db /root/var/cache
mv /var/db/pkg /root/var/db
mv /var/cache/pkg /root/var/cache
fi
elif [ "${PLATFORM}" = "nanobsd" ]; then
MOVE_PKG_DATA=1 MOVE_PKG_DATA=1
rm -rf /var/db/pkg 2>/dev/null
rm -rf /var/cache/pkg 2>/dev/null
mv /root/var/db/pkg /var/db
mv /root/var/cache/pkg /var/cache
# If use MFS var is enabled, move files to a safe place
elif [ "${USE_MFS_TMPVAR}" = "true" -a -f /var/db/pkg/local.sqlite ]; then
MOVE_PKG_DATA=1
/bin/mkdir -p /root/var/db /root/var/cache
mv /var/db/pkg /root/var/db
mv /var/cache/pkg /root/var/cache
fi fi
if [ "${PLATFORM}" = "nanobsd" ] || [ "${USE_MFS_TMPVAR}" = "true" ]; then if [ "${USE_MFS_TMPVAR}" = "true" ]; then
/etc/rc.embedded /etc/rc.embedded
fi fi
@ -158,23 +142,16 @@ fi
/bin/rm -f /root/TRIM_set /bin/rm -f /root/TRIM_set
/bin/rm -f /root/TRIM_unset /bin/rm -f /root/TRIM_unset
if [ "${PLATFORM}" = "nanobsd" ]; then # Handle ZFS read-only case
/sbin/kldstat -qm zfs /sbin/kldstat -qm zfs
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
if [ $ZFSFSAVAILABLE -eq 0 ]; then
/sbin/kldunload zfs /sbin/kldunload zfs
fi elif [ -f /usr/bin/grep ]; then
elif [ "$PLATFORM" = "${product}" ]; then ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
# Handle ZFS read-only case if [ "$ZFSROOT" != "" ]; then
/sbin/kldstat -qm zfs /sbin/zfs set readonly=off $ZFSROOT
if [ $? -eq 0 ]; then
ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
if [ $ZFSFSAVAILABLE -eq 0 ]; then
/sbin/kldunload zfs
elif [ -f /usr/bin/grep ]; then
ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
if [ "$ZFSROOT" != "" ]; then
/sbin/zfs set readonly=off $ZFSROOT
fi
fi fi
fi fi
fi fi
@ -194,7 +171,7 @@ fi
# Use php -n here because we are not ready to load extensions yet # Use php -n here because we are not ready to load extensions yet
varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run") varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run")
if [ "$PLATFORM" = "${product}" ] && [ "${USE_MFS_TMPVAR}" != "true" ]; then if [ "${USE_MFS_TMPVAR}" != "true" ]; then
/sbin/mdmfs -S -M -s 4m md $varrunpath /sbin/mdmfs -S -M -s 4m md $varrunpath
fi fi
@ -207,18 +184,13 @@ echo
/sbin/conscontrol mute off >/dev/null /sbin/conscontrol mute off >/dev/null
if [ "$PLATFORM" = "${product}" ]; then SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1` /sbin/swapon -a 2>/dev/null >/dev/null
/sbin/swapon -a 2>/dev/null >/dev/null /etc/rc.savecore
/etc/rc.savecore
fi
# make some directories in /var # make some directories in /var
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/log/nginx 2>/dev/null /bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/log/nginx 2>/dev/null
/bin/rm -rf $varrunpath/* /bin/rm -rf $varrunpath/*
if [ "$PLATFORM" != "${product}" ]; then
/bin/rm /var/log/* 2>/dev/null
fi
# Cleanup configuration files from previous instance # Cleanup configuration files from previous instance
/bin/rm -rf /var/etc/* /bin/rm -rf /var/etc/*
@ -369,15 +341,8 @@ ln -sf /etc/ssl/openssl.cnf \
/etc/rc.php_ini_setup 2>/tmp/php_errors.txt /etc/rc.php_ini_setup 2>/tmp/php_errors.txt
/usr/local/sbin/php-fpm -c /usr/local/etc/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null /usr/local/sbin/php-fpm -c /usr/local/etc/php.ini -y /usr/local/lib/php-fpm.conf -RD 2>&1 >/dev/null
# Launch external configuration loader for supported platforms # Launch external configuration loader
if [ "$PLATFORM" = "nanobsd" ]; then /usr/local/sbin/fcgicli -f /etc/ecl.php
/usr/local/sbin/fcgicli -f /etc/ecl.php
fi
# Launch external configuration loader for supported platforms
if [ "$PLATFORM" = "${product}" ]; then
/usr/local/sbin/fcgicli -f /etc/ecl.php
fi
if [ -f /etc/rc.custom_boot_early ]; then if [ -f /etc/rc.custom_boot_early ]; then
/bin/echo -n "Launching /etc/rc.custom_boot_early..."; /bin/echo -n "Launching /etc/rc.custom_boot_early...";
@ -393,13 +358,6 @@ echo -n "Launching the init system..."
/bin/rm -f /cf/conf/backup/backup.cache /bin/rm -f /cf/conf/backup/backup.cache
/usr/bin/touch $varrunpath/booting /usr/bin/touch $varrunpath/booting
if [ "${PLATFORM}" = "nanobsd" ]; then
# XXX This script does need all filesystems rw!!!!
# Put this workaround for now until better ways are found.
/sbin/mount -u -f -r -o sync,noatime /
/sbin/mount -u -f -r -o sync,noatime /cf
fi
# Copy custom logo over if it's present # Copy custom logo over if it's present
if [ -d /usr/local/share/${product}/custom_logos ]; then if [ -d /usr/local/share/${product}/custom_logos ]; then
cp -f /usr/local/share/${product}/custom_logos/*png \ cp -f /usr/local/share/${product}/custom_logos/*png \
@ -448,7 +406,7 @@ fi
# Log product version to syslog # Log product version to syslog
BUILDTIME=`cat /etc/version.buildtime` BUILDTIME=`cat /etc/version.buildtime`
ARCH=`uname -m` ARCH=`uname -m`
echo "$product ($PLATFORM) ${version}${version_patch} $ARCH $BUILDTIME" echo "$product ${version}${version_patch} $ARCH $BUILDTIME"
echo "Bootup complete" echo "Bootup complete"

View File

@ -39,18 +39,14 @@ HOME=/; export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH export PATH
# If PLATFORM is $product then remove # Remove temporary files on shutdown from /tmp/
# temporary files on shutdown from /tmp/ find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1
PLATFORM=`cat /etc/platform`
if [ "$PLATFORM" = "${product}" ]; then
find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1
fi
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar) USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'` DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2` DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
# If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot... # If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot...
if [ "${PLATFORM}" != "${product}" ] || [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then if [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
/etc/rc.backup_aliastables.sh /etc/rc.backup_aliastables.sh
/etc/rc.backup_rrd.sh /etc/rc.backup_rrd.sh
/etc/rc.backup_dhcpleases.sh /etc/rc.backup_dhcpleases.sh

View File

@ -300,7 +300,7 @@ if (!$args[0] && !$upgrading) {
} while (!empty($merge_repo)); } while (!empty($merge_repo));
} }
if ($branch == "RESTORE" && $g['platform'] == $g['product_name']) { if ($branch == "RESTORE") {
if (!file_exists("/root/cvssync_backup.tgz")) { if (!file_exists("/root/cvssync_backup.tgz")) {
echo "Sorry, we could not find a previous CVSSync backup file.\n"; echo "Sorry, we could not find a previous CVSSync backup file.\n";
exit(); exit();
@ -480,11 +480,7 @@ $tar_options = '-C ./src';
echo "===> Installing $qty_files_to_copy new files...\n"; echo "===> Installing $qty_files_to_copy new files...\n";
if ($g['platform'] == $g['product_name']) { $command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -Uxpf -)";
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -Uxpf -)";
} else {
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -xpf -) 2>/dev/null";
}
if (!empty($files_to_copy)) { if (!empty($files_to_copy)) {
if(isset($args["--show_command"])) { if(isset($args["--show_command"])) {

View File

@ -358,8 +358,7 @@ if (file_exists("/sbin/shutdown.old")) {
} }
/* Resync / Reinstall packages if need be */ /* Resync / Reinstall packages if need be */
if (file_exists('/conf/needs_package_sync') && if (file_exists('/conf/needs_package_sync')) {
($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd")) {
mark_subsystem_dirty('packagelock'); mark_subsystem_dirty('packagelock');
if (package_reinstall_all()) { if (package_reinstall_all()) {
@unlink('/conf/needs_package_sync'); @unlink('/conf/needs_package_sync');

View File

@ -58,9 +58,6 @@ done
CONFIG="/cf/conf/config.xml" CONFIG="/cf/conf/config.xml"
WORD="https" WORD="https"
# Set our operating platform
PLATFORM=`cat /etc/platform`
# endless loop # endless loop
while : ; do while : ; do

View File

@ -20,7 +20,6 @@
# #
# Set our operating platform # Set our operating platform
PLATFORM=`/bin/cat /etc/platform`
VERSION=`/bin/cat /etc/version` VERSION=`/bin/cat /etc/version`
MIN_REALMEM_FOR_OPCACHE=512 MIN_REALMEM_FOR_OPCACHE=512
@ -70,11 +69,7 @@ else
fi fi
# Set upload directory # Set upload directory
if [ "$PLATFORM" = "nanobsd" ]; then UPLOADTMPDIR="/tmp"
UPLOADTMPDIR=$(/usr/local/sbin/read_global_var upload_path "/root")
else
UPLOADTMPDIR="/tmp"
fi
# Define php modules. Do not add .so, it will # Define php modules. Do not add .so, it will
# be done automatically by the script below. # be done automatically by the script below.

View File

@ -28,18 +28,14 @@ sleep 1
# Read product_name from $g, defaults to pfSense # Read product_name from $g, defaults to pfSense
product=$(/usr/local/sbin/read_global_var product_name pfSense) product=$(/usr/local/sbin/read_global_var product_name pfSense)
# If PLATFORM is $product then remove # Remove temporary files on shutdown from /tmp/
# temporary files on shutdown from /tmp/ rm -rf /tmp/*
PLATFORM=`cat /etc/platform`
if [ "$PLATFORM" = "${product}" ]; then
rm -rf /tmp/*
fi
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar) USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'` DISK_NAME=`/bin/df /var/db/rrd | /usr/bin/tail -1 | /usr/bin/awk '{print $1;}'`
DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2` DISK_TYPE=`/usr/bin/basename ${DISK_NAME} | /usr/bin/cut -c1-2`
# If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot... # If we are not on a full install, or if the full install wants RAM disks, or if the full install _was_ using RAM disks, but isn't for the next boot...
if [ "${PLATFORM}" != "${product}" ] || [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then if [ "${USE_MFS_TMPVAR}" = "true" ] || [ "${DISK_TYPE}" = "md" ]; then
/etc/rc.backup_aliastables.sh /etc/rc.backup_aliastables.sh
/etc/rc.backup_rrd.sh /etc/rc.backup_rrd.sh
/etc/rc.backup_dhcpleases.sh /etc/rc.backup_dhcpleases.sh

View File

@ -43,19 +43,6 @@ foreach ($keys as $key) {
$keyfiles[] = "ssh_host_{$key['suffix']}key.pub"; $keyfiles[] = "ssh_host_{$key['suffix']}key.pub";
} }
/* restore ssh data for nanobsd platform */
if ($g['platform'] == "nanobsd" and file_exists("/conf/sshd/ssh_host_key") and !file_exists("{$sshConfigDir}/ssh_host_key.pub")) {
echo "Restoring SSH from /conf/sshd/";
exec("/bin/cp -p /conf/sshd/* {$sshConfigDir}/");
/* make sure host private key permissions aren't too open so sshd won't complain */
foreach ($keyfiles as $f2c) {
if (file_exists("{$sshConfigDir}/{$f2c}")) {
chmod("{$sshConfigDir}/{$f2c}", 0600);
}
}
}
/* if any of these files are 0 bytes then they are corrupted. /* if any of these files are 0 bytes then they are corrupted.
* remove them * remove them
*/ */
@ -186,12 +173,5 @@ if ($status <> 0) {
echo "done.\n"; echo "done.\n";
} }
// NanoBSD
if ($g['platform'] == "nanobsd") {
if (!is_dir("/conf/sshd")) {
mkdir("/conf/sshd", 0750);
}
$_gb = exec("/bin/cp -p {$sshConfigDir}/ssh_host* /conf/sshd");
}
unset($keys, $keyfiles); unset($keys, $keyfiles);
?> ?>

View File

@ -212,9 +212,7 @@ $system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware"); $system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
$system_menu[] = array(gettext("General Setup"), "/system.php"); $system_menu[] = array(gettext("General Setup"), "/system.php");
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php"); $system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") { $system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
}
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml"); $system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
$system_menu[] = array(gettext("Routing"), "/system_gateways.php"); $system_menu[] = array(gettext("Routing"), "/system_gateways.php");
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php"); $system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
@ -305,11 +303,7 @@ $status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php"); $status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php"); $status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php"); $status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
if ($g['platform'] == $g['product_name']) {
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
}
$status_menu[] = array(gettext("Queues"), "/status_queues.php"); $status_menu[] = array(gettext("Queues"), "/status_queues.php");
$status_menu[] = array(gettext("Services"), "/status_services.php"); $status_menu[] = array(gettext("Services"), "/status_services.php");
$status_menu[] = array(gettext("System Logs"), "/status_logs.php"); $status_menu[] = array(gettext("System Logs"), "/status_logs.php");

View File

@ -155,14 +155,12 @@ if (file_exists("/usr/sbin/swapinfo")) {
## If packages are installed lets resync ## If packages are installed lets resync
if (file_exists('/conf/needs_package_sync')) { if (file_exists('/conf/needs_package_sync')) {
if ($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) { if ($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
if ($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd") { ## If the user has logged into webGUI quickly while the system is booting then do not redirect them to
## If the user has logged into webGUI quickly while the system is booting then do not redirect them to ## the package reinstall page. That is about to be done by the boot script anyway.
## the package reinstall page. That is about to be done by the boot script anyway. ## The code in head.inc will put up a notice to the user.
## The code in head.inc will put up a notice to the user. if (!platform_booting()) {
if (!platform_booting()) { header('Location: pkg_mgr_install.php?mode=reinstallall');
header('Location: pkg_mgr_install.php?mode=reinstallall'); exit;
exit;
}
} }
} else { } else {
@unlink('/conf/needs_package_sync'); @unlink('/conf/needs_package_sync');

View File

@ -313,7 +313,7 @@ $section->addInput(new Form_Select(
$section->addInput(new Form_Checkbox( $section->addInput(new Form_Checkbox(
'disablelocallogging', 'disablelocallogging',
'Local Logging', 'Local Logging',
$g['platform'] == $g['product_name'] ? "Disable writing log files to the local disk" : "Disable writing log files to the local RAM disk", "Disable writing log files to the local disk",
$pconfig['disablelocallogging'] $pconfig['disablelocallogging']
)); ));

View File

@ -255,7 +255,7 @@ if ($_POST) {
// Add/Remove RAM disk periodic backup cron jobs according to settings and installation type. // Add/Remove RAM disk periodic backup cron jobs according to settings and installation type.
// Remove the cron jobs on full install if not using RAM disk. // Remove the cron jobs on full install if not using RAM disk.
// Add the cron jobs on all others if the periodic backup option is set. Otherwise the cron job is removed. // Add the cron jobs on all others if the periodic backup option is set. Otherwise the cron job is removed.
if (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { if (!isset($config['system']['use_mfs_tmpvar'])) {
install_cron_job("/etc/rc.backup_rrd.sh", false); install_cron_job("/etc/rc.backup_rrd.sh", false);
install_cron_job("/etc/rc.backup_dhcpleases.sh", false); install_cron_job("/etc/rc.backup_dhcpleases.sh", false);
} else { } else {
@ -497,7 +497,7 @@ $section->addInput(new Form_Checkbox(
'use_mfs_tmpvar', 'use_mfs_tmpvar',
'Use RAM Disks', 'Use RAM Disks',
'Use memory file system for /tmp and /var', 'Use memory file system for /tmp and /var',
($pconfig['use_mfs_tmpvar'] || $g['platform'] != $g['product_name']) $pconfig['use_mfs_tmpvar']
))->setHelp('Set this to use /tmp and /var as RAM disks (memory file '. ))->setHelp('Set this to use /tmp and /var as RAM disks (memory file '.
'system disks) on a full install rather than use the hard disk. Setting this will '. 'system disks) on a full install rather than use the hard disk. Setting this will '.
'cause the data in /tmp and /var to be lost, including log data. RRD '. 'cause the data in /tmp and /var to be lost, including log data. RRD '.
@ -543,22 +543,20 @@ $section->addInput(new Form_Input(
$form->add($section); $form->add($section);
if ($g['platform'] == "pfSense") { $section = new Form_Section('Hardware Settings');
$section = new Form_Section('Hardware Settings');
$opts = array(0.5, 1, 2, 3, 4, 5, 7.5, 10, 15, 20, 30, 60); $opts = array(0.5, 1, 2, 3, 4, 5, 7.5, 10, 15, 20, 30, 60);
$vals = array( 6, 12, 24, 36, 48, 60, 90, 120, 180, 240, 241, 242); $vals = array( 6, 12, 24, 36, 48, 60, 90, 120, 180, 240, 241, 242);
$section->addInput(new Form_Select( $section->addInput(new Form_Select(
'harddiskstandby', 'harddiskstandby',
'Hard disk standby time', 'Hard disk standby time',
$pconfig['harddiskstandby'], $pconfig['harddiskstandby'],
['' => gettext("Always on")] + array_combine($opts, $vals) ['' => gettext("Always on")] + array_combine($opts, $vals)
))->setHelp("Puts the hard disk into standby mode when the selected number of minutes has elapsed since the last access." . "<br />" . ))->setHelp("Puts the hard disk into standby mode when the selected number of minutes has elapsed since the last access." . "<br />" .
"<strong> Do not set this for CF cards.</strong>"); "<strong> Do not set this for CF cards.</strong>");
$form->add($section); $form->add($section);
}
$section = new Form_Section('Installation Feedback'); $section = new Form_Section('Installation Feedback');

View File

@ -142,7 +142,7 @@ $section->addInput(new Form_Checkbox(
$form->add($section); $form->add($section);
if (file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { if (file_exists("/usr/local/bin/git")) {
$section = new Form_Section('GitSync'); $section = new Form_Section('GitSync');
$section->addInput(new Form_Checkbox( $section->addInput(new Form_Checkbox(

View File

@ -125,25 +125,6 @@ $filesystems = get_mounted_filesystems();
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
<?php if ($g['platform'] == "nanobsd"): ?>
<?php
global $SLICE, $OLDSLICE, $TOFLASH, $COMPLETE_PATH, $COMPLETE_BOOT_PATH;
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)";
?>
<tr>
<th><?=gettext("NanoBSD Boot Slice");?></th>
<td>
<?=htmlspecialchars(nanobsd_friendly_slice_name($BOOT_DEVICE));?> / <?=htmlspecialchars($BOOTFLASH);?><?=$rw;?>
<?php if ($BOOTFLASH != $ACTIVE_SLICE): ?>
<br /><br /><?=gettext('Next Boot')?>:<br />
<?=htmlspecialchars(nanobsd_friendly_slice_name($GLABEL_SLICE));?> / <?=htmlspecialchars($ACTIVE_SLICE);?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<tr> <tr>
<th><?=gettext("CPU Type");?></th> <th><?=gettext("CPU Type");?></th>
<td><?=htmlspecialchars(get_single_sysctl("hw.model"))?> <td><?=htmlspecialchars(get_single_sysctl("hw.model"))?>

View File

@ -36,8 +36,6 @@ oIFS=${IFS}
IFS=" IFS="
" "
PLATFORM=$(cat /etc/platform)
# Process obsolete files # Process obsolete files
if [ -f /etc/%%PRODUCT_NAME%%.obsoletedfiles ]; then if [ -f /etc/%%PRODUCT_NAME%%.obsoletedfiles ]; then
for f in $(cat /etc/%%PRODUCT_NAME%%.obsoletedfiles); do for f in $(cat /etc/%%PRODUCT_NAME%%.obsoletedfiles); do