Drop support for jail platform

This commit is contained in:
Renato Botelho 2015-07-31 15:40:46 -03:00
parent bb3ee8a1bb
commit 6fa9f38c0c
10 changed files with 47 additions and 142 deletions

View File

@ -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";

View File

@ -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();

View File

@ -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'])) {

View File

@ -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";

View File

@ -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'])) {

View File

@ -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);

View File

@ -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();

39
etc/rc
View File

@ -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."

View File

@ -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";
}
$ifaces = get_interface_list();
if (is_array($ifaces)) {
foreach ($ifaces as $iface => $ifdata) {
interfaces_bring_up($iface);
}
}
$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);
}
}
set_networking_interfaces_ports();
led_kitt();
}
set_networking_interfaces_ports();
led_kitt();
}
/* convert config and clean backups */

View File

@ -34,10 +34,6 @@ WORD="https"
# Set our operating platform
PLATFORM=`cat /etc/platform`
if [ "$PLATFORM" = "jail" ]; then
exit
fi
# endless loop
while : ; do