diff options
25 files changed, 87 insertions, 407 deletions
diff --git a/src/etc/inc/config.gui.inc b/src/etc/inc/config.gui.inc index f41b912..3ed814c 100644 --- a/src/etc/inc/config.gui.inc +++ b/src/etc/inc/config.gui.inc @@ -44,13 +44,6 @@ if (file_exists("/cf/conf/use_xmlreader")) { } 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 so we can output more information */ if (file_exists("/debugging")) { diff --git a/src/etc/inc/config.inc b/src/etc/inc/config.inc index ae1dc22..aa33214 100644 --- a/src/etc/inc/config.inc +++ b/src/etc/inc/config.inc @@ -57,13 +57,6 @@ if (file_exists("/cf/conf/use_xmlreader")) { } 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 so we can output more information */ if (file_exists("/debugging")) { diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index 4ecca7c..733d06e 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -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']}"; } -if (file_exists("/etc/platform")) { - $g['platform'] = trim(file_get_contents("/etc/platform")); -} else { - // shouldn't happen but "just in case" no platform were detected - $g['platform'] = 'undetected'; -} +/* XXX: Backward compatible */ +$g['platform'] = $g['product_name']; if (file_exists("{$g['etc_path']}/default-config-flavor")) { $flavor_array = file("{$g['etc_path']}/default-config-flavor"); diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 17dc051..cd67ccf 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -928,7 +928,7 @@ function host_firmware_version($tocheck = "") { "firmware" => array("version" => $g['product_version']), "kernel" => array("version" => $os_version), "base" => array("version" => $os_version), - "platform" => trim(file_get_contents('/etc/platform', " \n")), + "platform" => $g['platform'], "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"; $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; - } 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); @@ -1197,8 +1193,7 @@ function is_serial_enabled() { global $g, $config; if (!isset($g['enableserial_force']) && - !isset($config['system']['enableserial']) && - ($g['platform'] == $g['product_name'])) { + !isset($config['system']['enableserial'])) { 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 (($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"); } else { /* 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; } } -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) { 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 (($g['platform'] == $g['product_name']) && !isset($config['system']['use_mfs_tmpvar'])) { + if (!isset($config['system']['use_mfs_tmpvar'])) { unlink_if_exists("{$file}"); } } diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index d498511..4ab9c4c 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -93,8 +93,7 @@ function pkg_env($extra_env = array()) { $pkg_env_vars['HTTP_PROXY'] = $http_proxy; } - if ($g['platform'] == "nanobsd" || - isset($config['system']['use_mfs_tmpvar'])) { + if (isset($config['system']['use_mfs_tmpvar'])) { $pkg_env_vars['PKG_DBDIR'] = '/root/var/db/pkg'; $pkg_env_vars['PKG_CACHEDIR'] = '/root/var/cache/pkg'; } diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc index 2539af3..183f84a 100644 --- a/src/etc/inc/rrd.inc +++ b/src/etc/inc/rrd.inc @@ -42,7 +42,7 @@ function restore_rrd() { $rrdrestore = ""; $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) { @unlink($xml_file); } @@ -74,7 +74,7 @@ function restore_rrd() { unset($rrdrestore); @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 (($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"); } return true; diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 600b03b..74459d1 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -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 (($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"); } } @@ -1258,21 +1258,6 @@ function services_dhcpdv6_configure($blacklist = array()) { 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']; if (!is_array($config['dhcpdv6'])) { $config['dhcpdv6'] = array(); @@ -2335,12 +2320,8 @@ trap := "{$config['snmpd']['trapstring']}" 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") . - " {$g['product_version']} {$platform} " . php_uname("s") . + " {$g['product_version']} {$g['platform']} " . php_uname("s") . " " . php_uname("r") . " " . php_uname("m"); $snmpdconf .= <<<EOD diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 1f4a2de..e9ecd96 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -30,10 +30,6 @@ function activate_powerd() { exec("/usr/bin/killall powerd"); } if (isset($config['system']['powerd_enable'])) { - if ($g["platform"] == "nanobsd") { - exec("/sbin/kldload cpufreq"); - } - $ac_mode = "hadp"; if (!empty($config['system']['powerd_ac_mode'])) { $ac_mode = $config['system']['powerd_ac_mode']; @@ -2212,11 +2208,6 @@ function system_identify_specific_platform() { 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) { return array('name' => 'wrap', 'descr' => gettext('PC Engines WRAP')); } @@ -2245,8 +2236,7 @@ function system_identify_specific_platform() { } unset($dmesg_boot); - /* unknown embedded platform */ - return array('name' => 'embedded', 'descr' => gettext('embedded (unknown)')); + return array('name' => $g['platform'], 'descr' => $g['platform']); } function system_get_dmesg_boot() { diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index a0f6b67..0fd7a79 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -2064,7 +2064,7 @@ function upgrade_054_to_055() { $rrddbpath = "/var/db/rrd/"; $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 */ if (restore_rrd()) { /* 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/"; $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 */ if (restore_rrd()) { /* 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"; $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 */ if (restore_rrd()) { /* 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 .= "}'"; - if ($g['platform'] != $g['product_name']) { + if (isset($config['system']['use_mfs_tmpvar'])) { /* restore the databases, if we have one */ if (restore_rrd()) { /* 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"); // 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_dhcpleases.sh", false); } diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 265f62f..53553c4 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -2017,11 +2017,7 @@ function get_memory() { function mute_kernel_msgs() { 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']) { return; } @@ -2030,11 +2026,7 @@ function mute_kernel_msgs() { function unmute_kernel_msgs() { 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"); } diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc index 40d8d36..caa0316 100755 --- a/src/etc/pfSense-rc +++ b/src/etc/pfSense-rc @@ -32,9 +32,6 @@ HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin export HOME PATH -# Set our operating platform -PLATFORM=`/bin/cat /etc/platform` - # Set our current 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" echo "Configuring crash dumps..." -if [ "$PLATFORM" = "${product}" ]; then - /etc/rc.dumpon -fi +/etc/rc.dumpon -# 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 /sbin/ddb /etc/ddb.conf fi @@ -102,13 +97,6 @@ while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do attempts=$((attempts+1)) 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 [ -d "/conf" ]; then # 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) unset MOVE_PKG_DATA -if [ "$PLATFORM" = "${product}" ]; then - # 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 - 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 +# 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 + 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 -if [ "${PLATFORM}" = "nanobsd" ] || [ "${USE_MFS_TMPVAR}" = "true" ]; then +if [ "${USE_MFS_TMPVAR}" = "true" ]; then /etc/rc.embedded fi @@ -158,23 +142,16 @@ fi /bin/rm -f /root/TRIM_set /bin/rm -f /root/TRIM_unset -if [ "${PLATFORM}" = "nanobsd" ]; then - /sbin/kldstat -qm zfs - if [ $? -eq 0 ]; then +# Handle ZFS read-only case +/sbin/kldstat -qm zfs +if [ $? -eq 0 ]; then + ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l) + if [ $ZFSFSAVAILABLE -eq 0 ]; then /sbin/kldunload zfs - fi -elif [ "$PLATFORM" = "${product}" ]; then - # Handle ZFS read-only case - /sbin/kldstat -qm zfs - 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 + 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 @@ -194,7 +171,7 @@ fi # 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") -if [ "$PLATFORM" = "${product}" ] && [ "${USE_MFS_TMPVAR}" != "true" ]; then +if [ "${USE_MFS_TMPVAR}" != "true" ]; then /sbin/mdmfs -S -M -s 4m md $varrunpath fi @@ -207,18 +184,13 @@ echo /sbin/conscontrol mute off >/dev/null -if [ "$PLATFORM" = "${product}" ]; then - SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1` - /sbin/swapon -a 2>/dev/null >/dev/null - /etc/rc.savecore -fi +SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1` +/sbin/swapon -a 2>/dev/null >/dev/null +/etc/rc.savecore # 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/rm -rf $varrunpath/* -if [ "$PLATFORM" != "${product}" ]; then - /bin/rm /var/log/* 2>/dev/null -fi # Cleanup configuration files from previous instance /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 /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 -if [ "$PLATFORM" = "nanobsd" ]; then - /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 +# Launch external configuration loader +/usr/local/sbin/fcgicli -f /etc/ecl.php if [ -f /etc/rc.custom_boot_early ]; then /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 /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 if [ -d /usr/local/share/${product}/custom_logos ]; then cp -f /usr/local/share/${product}/custom_logos/*png \ @@ -448,7 +406,7 @@ fi # Log product version to syslog BUILDTIME=`cat /etc/version.buildtime` ARCH=`uname -m` -echo "$product ($PLATFORM) ${version}${version_patch} $ARCH $BUILDTIME" +echo "$product ${version}${version_patch} $ARCH $BUILDTIME" echo "Bootup complete" diff --git a/src/etc/pfSense-rc.shutdown b/src/etc/pfSense-rc.shutdown index 9e01643..dc6221f 100755 --- a/src/etc/pfSense-rc.shutdown +++ b/src/etc/pfSense-rc.shutdown @@ -39,18 +39,14 @@ HOME=/; export HOME PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH -# If PLATFORM is $product then remove -# temporary files on shutdown from /tmp/ -PLATFORM=`cat /etc/platform` -if [ "$PLATFORM" = "${product}" ]; then - find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1 -fi +# Remove temporary files on shutdown from /tmp/ +find -x /tmp/* -type f -exec rm -f {} \; >/dev/null 2>&1 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_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 [ "${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_rrd.sh /etc/rc.backup_dhcpleases.sh diff --git a/src/etc/phpshellsessions/gitsync b/src/etc/phpshellsessions/gitsync index 04f70c5..269add5 100644 --- a/src/etc/phpshellsessions/gitsync +++ b/src/etc/phpshellsessions/gitsync @@ -300,7 +300,7 @@ if (!$args[0] && !$upgrading) { } while (!empty($merge_repo)); } -if ($branch == "RESTORE" && $g['platform'] == $g['product_name']) { +if ($branch == "RESTORE") { if (!file_exists("/root/cvssync_backup.tgz")) { echo "Sorry, we could not find a previous CVSSync backup file.\n"; exit(); @@ -480,11 +480,7 @@ $tar_options = '-C ./src'; 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 -)"; -} else { - $command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -xpf -) 2>/dev/null"; -} +$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$tar_options} {$files_to_copy} | (cd / ; tar -Uxpf -)"; if (!empty($files_to_copy)) { if(isset($args["--show_command"])) { diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup index 45adad7..83ca627 100755 --- a/src/etc/rc.bootup +++ b/src/etc/rc.bootup @@ -358,8 +358,7 @@ if (file_exists("/sbin/shutdown.old")) { } /* Resync / Reinstall packages if need be */ -if (file_exists('/conf/needs_package_sync') && - ($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd")) { +if (file_exists('/conf/needs_package_sync')) { mark_subsystem_dirty('packagelock'); if (package_reinstall_all()) { @unlink('/conf/needs_package_sync'); diff --git a/src/etc/rc.initial b/src/etc/rc.initial index 9ce1ac8..4dcfcd5 100755 --- a/src/etc/rc.initial +++ b/src/etc/rc.initial @@ -58,9 +58,6 @@ done CONFIG="/cf/conf/config.xml" WORD="https" -# Set our operating platform -PLATFORM=`cat /etc/platform` - # endless loop while : ; do diff --git a/src/etc/rc.php_ini_setup b/src/etc/rc.php_ini_setup index 3701699..f54dcdb 100755 --- a/src/etc/rc.php_ini_setup +++ b/src/etc/rc.php_ini_setup @@ -20,7 +20,6 @@ # # Set our operating platform -PLATFORM=`/bin/cat /etc/platform` VERSION=`/bin/cat /etc/version` MIN_REALMEM_FOR_OPCACHE=512 @@ -70,11 +69,7 @@ else fi # Set upload directory -if [ "$PLATFORM" = "nanobsd" ]; then - UPLOADTMPDIR=$(/usr/local/sbin/read_global_var upload_path "/root") -else - UPLOADTMPDIR="/tmp" -fi +UPLOADTMPDIR="/tmp" # Define php modules. Do not add .so, it will # be done automatically by the script below. diff --git a/src/etc/rc.reboot b/src/etc/rc.reboot index 61f9205..f795dec 100755 --- a/src/etc/rc.reboot +++ b/src/etc/rc.reboot @@ -28,18 +28,14 @@ sleep 1 # Read product_name from $g, defaults to pfSense product=$(/usr/local/sbin/read_global_var product_name pfSense) -# If PLATFORM is $product then remove -# temporary files on shutdown from /tmp/ -PLATFORM=`cat /etc/platform` -if [ "$PLATFORM" = "${product}" ]; then - rm -rf /tmp/* -fi +# Remove temporary files on shutdown from /tmp/ +rm -rf /tmp/* 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_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 [ "${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_rrd.sh /etc/rc.backup_dhcpleases.sh diff --git a/src/etc/sshd b/src/etc/sshd index 48959b9..7c40f2d 100755 --- a/src/etc/sshd +++ b/src/etc/sshd @@ -43,19 +43,6 @@ foreach ($keys as $key) { $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. * remove them */ @@ -186,12 +173,5 @@ if ($status <> 0) { 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); ?> diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index 43c9375..9a3df33 100644 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -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("General Setup"), "/system.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("Routing"), "/system_gateways.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("NTP"), "/status_ntpd.php"); $status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php"); - -if ($g['platform'] == $g['product_name']) { - $status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php"); -} - +$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php"); $status_menu[] = array(gettext("Queues"), "/status_queues.php"); $status_menu[] = array(gettext("Services"), "/status_services.php"); $status_menu[] = array(gettext("System Logs"), "/status_logs.php"); diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index 460ddbd..2995ad8 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -155,14 +155,12 @@ if (file_exists("/usr/sbin/swapinfo")) { ## If packages are installed lets resync if (file_exists('/conf/needs_package_sync')) { 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 - ## 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. - if (!platform_booting()) { - header('Location: pkg_mgr_install.php?mode=reinstallall'); - exit; - } + ## 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 code in head.inc will put up a notice to the user. + if (!platform_booting()) { + header('Location: pkg_mgr_install.php?mode=reinstallall'); + exit; } } else { @unlink('/conf/needs_package_sync'); diff --git a/src/usr/local/www/status_logs_settings.php b/src/usr/local/www/status_logs_settings.php index 62acf2b..33881ed 100644 --- a/src/usr/local/www/status_logs_settings.php +++ b/src/usr/local/www/status_logs_settings.php @@ -313,7 +313,7 @@ $section->addInput(new Form_Select( $section->addInput(new Form_Checkbox( 'disablelocallogging', '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'] )); diff --git a/src/usr/local/www/system_advanced_misc.php b/src/usr/local/www/system_advanced_misc.php index aae6b8f..817b745 100644 --- a/src/usr/local/www/system_advanced_misc.php +++ b/src/usr/local/www/system_advanced_misc.php @@ -255,7 +255,7 @@ if ($_POST) { // 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. // 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_dhcpleases.sh", false); } else { @@ -497,7 +497,7 @@ $section->addInput(new Form_Checkbox( 'use_mfs_tmpvar', 'Use RAM Disks', '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 '. '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 '. @@ -543,22 +543,20 @@ $section->addInput(new Form_Input( $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); - $vals = array( 6, 12, 24, 36, 48, 60, 90, 120, 180, 240, 241, 242); +$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); - $section->addInput(new Form_Select( - 'harddiskstandby', - 'Hard disk standby time', - $pconfig['harddiskstandby'], - ['' => 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 />" . - "<strong> Do not set this for CF cards.</strong>"); +$section->addInput(new Form_Select( + 'harddiskstandby', + 'Hard disk standby time', + $pconfig['harddiskstandby'], + ['' => 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 />" . + "<strong> Do not set this for CF cards.</strong>"); - $form->add($section); -} +$form->add($section); $section = new Form_Section('Installation Feedback'); diff --git a/src/usr/local/www/system_update_settings.php b/src/usr/local/www/system_update_settings.php index c22c48b..7b3d5bc 100644 --- a/src/usr/local/www/system_update_settings.php +++ b/src/usr/local/www/system_update_settings.php @@ -142,7 +142,7 @@ $section->addInput(new Form_Checkbox( $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->addInput(new Form_Checkbox( diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php index 7055688..1cae8f0 100644 --- a/src/usr/local/www/widgets/widgets/system_information.widget.php +++ b/src/usr/local/www/widgets/widgets/system_information.widget.php @@ -125,25 +125,6 @@ $filesystems = get_mounted_filesystems(); <?php endif; ?> </td> </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> <th><?=gettext("CPU Type");?></th> <td><?=htmlspecialchars(get_single_sysctl("hw.model"))?> diff --git a/tools/templates/core_pkg/base/metadir/+INSTALL b/tools/templates/core_pkg/base/metadir/+INSTALL index aa3fa89..4f53a35 100644 --- a/tools/templates/core_pkg/base/metadir/+INSTALL +++ b/tools/templates/core_pkg/base/metadir/+INSTALL @@ -36,8 +36,6 @@ oIFS=${IFS} IFS=" " -PLATFORM=$(cat /etc/platform) - # Process obsolete files if [ -f /etc/%%PRODUCT_NAME%%.obsoletedfiles ]; then for f in $(cat /etc/%%PRODUCT_NAME%%.obsoletedfiles); do |