#!/usr/local/bin/php * Copyright (C) 2004-2009 Scott Ullrich * Copyright (C) 2003-2004 Manuel Kasper * Copyright (C) 2009 Erik Kristensen * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* looks weird, but means we started PHP successfully */ echo "done.\n"; echo "Initializing..."; flush(); $inc_files = array( 'config.inc', 'console.inc', 'auth.inc', 'util.inc', 'interfaces.inc', 'services.inc', 'system.inc', 'filter.inc', 'rrd.inc', ); foreach ($inc_files as $inc_file) { require_once $inc_file; echo '.'; flush(); } echo "done.\n"; /* * If this was an import or restore or reset, once run * the migration, but do not display the status here as * otherwise this prints all the models that keep their * current version level. */ convert_config(); /* * Now mute console messages from kernel for this script, it * has consequences for printing bootup info and can clobber * stty probing during interface auto-detection. */ system_console_mute(); system_devd_configure(true); system_login_configure(true); /* * Determine if we need to throw an interface exception * and ask the user to reassign interfaces. This will * avoid a reboot and thats a good thing. */ if (is_interface_mismatch()) { echo "\nDefault interfaces not found -- Running interface assignment option.\n"; while (!set_networking_interfaces_ports(true)); } /* loopback device is required early for syslog */ interfaces_loopback_configure(true); system_kernel_configure(true); system_sysctl_configure(true); system_timezone_configure(true); system_firmware_configure(true); system_hostname_configure(true); system_hosts_generate(true); system_syslogd_start(true); interfaces_configure(true); system_resolvconf_generate(true); filter_configure_sync(true); plugins_configure('earlybootup', true); system_cron_configure(true, true); system_routing_configure(true); plugins_configure('dns', true); services_dhcpd_configure(true); system_hosts_generate(true); services_dhcrelay_configure(true); services_dhcrelay6_configure(true); prefer_ipv4_or_ipv6(); plugins_configure('monitor', true); filter_configure_sync(true); plugins_configure('vpn', true); plugins_configure('bootup', true); rrd_configure(true); /* XXX this seems misplaced */ system_powerd_configure(true); /* * Give syslogd a kick after everything else has been * initialized, otherwise it can occasionally fail to * route syslog messages properly on both IPv4 and IPv6. */ system_syslogd_start(true, true); system_console_unmute(); exit(0);