From 6fa9f38c0c1377ab110ff97d0ba552c878e9e07e Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 31 Jul 2015 15:40:46 -0300 Subject: Drop support for jail platform --- etc/inc/filter.inc | 4 +-- etc/inc/interfaces.inc | 7 ------ etc/inc/openvpn.inc | 3 --- etc/inc/services.inc | 12 ++------- etc/inc/system.inc | 19 ++------------- etc/inc/util.inc | 21 +++++----------- etc/inc/vpn.inc | 10 -------- etc/rc | 39 ++++++++++++----------------- etc/rc.bootup | 66 +++++++++++++++----------------------------------- etc/rc.initial | 4 --- 10 files changed, 45 insertions(+), 140 deletions(-) (limited to 'etc') diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 73614f8..e9e7a03 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -162,9 +162,7 @@ function is_bogonsv6_used() { function filter_pflog_start($kill_first = false) { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } + if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "filter_pflog_start() being called $mt\n"; diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index a192591..4d9389a 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -190,9 +190,6 @@ function interface_netgraph_needed($interface = "wan") { function interfaces_loopback_configure() { global $g; - if ($g['platform'] == 'jail') { - return; - } if (platform_booting()) { echo gettext("Configuring loopback interface..."); } @@ -1002,10 +999,6 @@ function interface_gif_configure(&$gif, $gifkey = "") { function interfaces_configure() { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } - /* Set up our loopback interface */ interfaces_loopback_configure(); diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 6e81c03..d74aa3e 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -1107,9 +1107,6 @@ function openvpn_resync($mode, $settings) { function openvpn_resync_all($interface = "") { global $g, $config; - if ($g['platform'] == 'jail') { - return; - } openvpn_create_dirs(); if (!is_array($config['openvpn'])) { diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 1412f7e..8eb6c6a 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -45,10 +45,6 @@ define('DYNDNS_PROVIDER_DESCRIPTIONS', 'City Network,CloudFlare,Custom,Custom (v function services_radvd_configure($blacklist = array()) { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } - if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "services_radvd_configure() being called $mt\n"; @@ -1567,9 +1563,7 @@ EOD; function services_dhcrelay_configure() { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } + if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "services_dhcrelay_configure() being called $mt\n"; @@ -1634,9 +1628,7 @@ function services_dhcrelay_configure() { function services_dhcrelay6_configure() { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } + if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "services_dhcrelay6_configure() being called $mt\n"; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index a215e72..d7c6226 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -41,9 +41,7 @@ function activate_powerd() { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } + if (is_process_running("powerd")) { exec("/usr/bin/killall powerd"); } @@ -119,10 +117,6 @@ function system_get_sysctls() { function activate_sysctls() { global $config, $g, $sysctls; - if ($g['platform'] == 'jail') { - return; - } - if (is_array($config['sysctl']) && is_array($config['sysctl']['item'])) { foreach ($config['sysctl']['item'] as $tunable) { if ($tunable['value'] == "default") { @@ -454,9 +448,6 @@ function system_hosts_generate() { function system_dhcpleases_configure() { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } /* Start the monitoring process for dynamic dhcpclients. */ if ((isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcp'])) || (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcp']))) { @@ -519,9 +510,7 @@ function system_hostname_configure() { function system_routing_configure($interface = "") { global $config, $g; - if ($g['platform'] == 'jail') { - return; - } + if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "system_routing_configure() being called $mt\n"; @@ -1638,10 +1627,6 @@ function system_ntp_configure($start_ntpd=true) { $statsdir = "/var/log/ntp"; $gps_device = '/dev/gps0'; - if ($g['platform'] == 'jail') { - return; - } - safe_mkdir($statsdir); if (!is_array($config['ntpd'])) { diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 169f784..b2c797b 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1836,13 +1836,11 @@ function get_memory() { } function mute_kernel_msgs() { - global $config; + global $g, $config; // Do not mute serial console. The kernel gets very very cranky // and will start dishing you cannot control tty errors. - switch (trim(file_get_contents("/etc/platform"))) { - case "nanobsd": - case "jail": - return; + if ($g['platform'] == 'nanobsd') { + return; } if ($config['system']['enableserial']) { return; @@ -1851,23 +1849,16 @@ function mute_kernel_msgs() { } function unmute_kernel_msgs() { - global $config; + global $g; // Do not mute serial console. The kernel gets very very cranky // and will start dishing you cannot control tty errors. - switch (trim(file_get_contents("/etc/platform"))) { - case "nanobsd": - case "jail": - return; + if ($g['platform'] == 'nanobsd') { + return; } exec("/sbin/conscontrol mute off"); } function start_devd() { - global $g; - - if ($g['platform'] == 'jail') { - return; - } /* Use the undocumented -q options of devd to quiet its log spamming */ $_gb = exec("/sbin/devd -q"); sleep(1); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 21a249e..2820822 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -116,10 +116,6 @@ function vpn_ipsec_convert_to_modp($index) { function vpn_ipsec_configure($restart = false) { global $config, $g, $sa, $sn, $p1_ealgos, $p2_ealgos, $ipsec_idhandling; - if ($g['platform'] == 'jail') { - return; - } - /* get the automatic ping_hosts.sh ready */ unlink_if_exists("{$g['vardb_path']}/ipsecpinghosts"); touch("{$g['vardb_path']}/ipsecpinghosts"); @@ -1365,12 +1361,6 @@ function vpn_ipsec_force_reload($interface = "") { /* master setup for vpn (mpd) */ function vpn_setup() { - global $g; - - if ($g['platform'] == 'jail') { - return; - } - /* start pptpd */ vpn_pptpd_configure(); diff --git a/etc/rc b/etc/rc index a593520..1215883 100755 --- a/etc/rc +++ b/etc/rc @@ -157,10 +157,7 @@ echo echo "Welcome to ${product} ${version} ${platformbanner} ..." echo -if [ ! "$PLATFORM" = "jail" ]; then - # Enable console output if its muted. - /sbin/conscontrol mute off >/dev/null -fi +/sbin/conscontrol mute off >/dev/null if [ "$PLATFORM" = "cdrom" ] ; then # do nothing for cdrom platform @@ -173,8 +170,6 @@ elif [ "$PLATFORM" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then /bin/mkdir -p /root/var/db/pbi /bin/rm -rf /var/db/pbi /bin/ln -s /root/var/db/pbi/ /var/db/pbi -elif [ "$PLATFORM" = "jail" ]; then - # do nothing for jail platform else SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1` /sbin/swapon -a 2>/dev/null >/dev/null @@ -324,11 +319,9 @@ done /bin/chmod 0600 /var/log/*.log echo -n "." -if [ ! "$PLATFORM" = "jail" ]; then - DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8` - if [ "$DEVFS" = "0" ]; then - mount_devfs devfs /dev - fi +DEVFS=`/sbin/mount | /usr/bin/grep devfs | /usr/bin/wc -l | /usr/bin/cut -d" " -f8` +if [ "$DEVFS" = "0" ]; then + mount_devfs devfs /dev fi # Create an initial utmp file @@ -338,20 +331,18 @@ echo -n "." /sbin/ldconfig -elf /usr/lib /usr/local/lib /lib /etc/rc.d/ldconfig start 2>/dev/null -if [ ! "$PLATFORM" = "jail" ]; then - # Launching kbdmux(4) - if [ -f "/dev/kbdmux0" ]; then - echo -n "." - /usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console - [ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console - [ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console - fi +# Launching kbdmux(4) +if [ -f "/dev/kbdmux0" ]; then + echo -n "." + /usr/sbin/kbdcontrol -k /dev/kbdmux0 < /dev/console + [ -c "/dev/atkbd0" ] && kbdcontrol -a atkbd0 < /dev/console + [ -c "/dev/ukbd0" ] && kbdcontrol -a ukbd0 < /dev/console +fi - # Fire up unionfs if mount points exist. - if [ -f /dist/uniondirs ]; then - echo -n "." - /etc/rc.d/unionfs start - fi +# Fire up unionfs if mount points exist. +if [ -f /dist/uniondirs ]; then + echo -n "." + /etc/rc.d/unionfs start fi echo "done." diff --git a/etc/rc.bootup b/etc/rc.bootup index 0bd444d..d49adee 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -149,57 +149,29 @@ echo "Loading configuration..."; parse_config_bootup(); echo "done.\n"; -if ($g['platform'] == "jail") { - /* We must determine what network settings have been configured for us */ - $wanif = "lo0"; /* defaults, if the jail admin hasn't set us up */ - $ipaddr = "127.0.0.1"; - $iflist = get_interface_list(); - foreach ($iflist as $iface => $ifa) { - if (isset($ifa['ipaddr'])) { - $wanif = $iface; - $ipaddr = $ifa['ipaddr']; - break; +/* + * Determine if we need to throw a interface exception + * and ask the user to reassign interfaces. This will + * avoid a reboot and that is a good thing. + */ +while (is_interface_mismatch() == true) { + led_assigninterfaces(); + if (isset($config['revision'])) { + if (file_exists("{$g['tmp_path']}/missing_interfaces")) { + echo "Warning: Configuration references interfaces that do not exist: " . file_get_contents("{$g['tmp_path']}/missing_interfaces") . "\n"; } + echo "\nNetwork interface mismatch -- Running interface assignment option.\n"; + } else { + echo "\nDefault interfaces not found -- Running interface assignment option.\n"; } - $config['interfaces'] = array(); - $config['interfaces']['lan'] = array(); - $config['interfaces']['lan']['enable'] = false; - $config['interfaces']['wan'] = array(); - /* XXX, todo */ - $config['interfaces']['wan']['if'] = $wanif; - $config['interfaces']['wan']['ipaddr'] = $ipaddr; - $config['interfaces']['wan']['subnet'] = "32"; /* XXX right? */ - $config['interfaces']['wan']['enable'] = true; - if ($config['dhcpd']['lan']) { - unset($config['dhcpd']['lan']['enable']); - } - unlink_if_exists('/conf/trigger_initial_wizard'); - write_config(); -} else { - /* - * Determine if we need to throw a interface exception - * and ask the user to reassign interfaces. This will - * avoid a reboot and that is a good thing. - */ - while (is_interface_mismatch() == true) { - led_assigninterfaces(); - if (isset($config['revision'])) { - if (file_exists("{$g['tmp_path']}/missing_interfaces")) { - echo "Warning: Configuration references interfaces that do not exist: " . file_get_contents("{$g['tmp_path']}/missing_interfaces") . "\n"; - } - echo "\nNetwork interface mismatch -- Running interface assignment option.\n"; - } else { - echo "\nDefault interfaces not found -- Running interface assignment option.\n"; - } - $ifaces = get_interface_list(); - if (is_array($ifaces)) { - foreach ($ifaces as $iface => $ifdata) { - interfaces_bring_up($iface); - } + $ifaces = get_interface_list(); + if (is_array($ifaces)) { + foreach ($ifaces as $iface => $ifdata) { + interfaces_bring_up($iface); } - set_networking_interfaces_ports(); - led_kitt(); } + set_networking_interfaces_ports(); + led_kitt(); } /* convert config and clean backups */ diff --git a/etc/rc.initial b/etc/rc.initial index 2d9fa98..b103bf7 100755 --- a/etc/rc.initial +++ b/etc/rc.initial @@ -34,10 +34,6 @@ WORD="https" # Set our operating platform PLATFORM=`cat /etc/platform` -if [ "$PLATFORM" = "jail" ]; then - exit -fi - # endless loop while : ; do -- cgit v1.1