Merge branch 'RELENG_1_2' of http://gitweb.pfsense.org/pfsense/mainline into RELENG_1_2

This commit is contained in:
Chris Buechler 2009-07-02 14:09:34 -04:00
commit 3231a44d98
257 changed files with 6817 additions and 150 deletions

View File

@ -273,9 +273,9 @@ function parse_config($parse = false) {
config_unlock();
/* process packager manager custom rules */
if(is_dir("/usr/local/pkg/config_parse/")) {
update_filter_reload_status("Running plugins (config_parse)");
run_plugins("/usr/local/pkg/config_parse/");
if(is_dir("/usr/local/pkg/parse_config")) {
update_filter_reload_status("Running plugins (parse_config)");
run_plugins("/usr/local/pkg/parse_config/");
update_filter_reload_status("Plugins completed.");
}
@ -306,12 +306,9 @@ function parse_config($parse = false) {
function generate_config_cache($config) {
global $g;
config_lock();
conf_mount_rw();
$configcache = fopen($g['tmp_path'] . '/config.cache', "w");
fwrite($configcache, serialize($config));
fclose($configcache);
mwexec("sync");
conf_mount_ro();
config_unlock();
return true;
}
@ -444,7 +441,7 @@ function conf_mount_rw() {
* compact flash cards root.
*/
if($g['platform'] == "wrap" or $g['platform'] == "net45xx"
or $g['platform'] == "embedded") {
or $g['platform'] == "embedded" or $g['platform'] == "nanobsd") {
$status = mwexec("/sbin/mount -u -w /");
/* we could not mount this correctly. kick off fsck */
if($status <> 0) {
@ -1079,7 +1076,7 @@ function write_config($desc="Unknown", $backup = true) {
die("Unable to open {$g['cf_conf_path']}/config.xml for writing in write_config()\n");
}
if($g['platform'] == "embedded") {
if($g['platform'] == "embedded" or $g['platform'] == "nanobsd") {
cleanup_backupcache(5);
} else {
cleanup_backupcache(30);
@ -1101,7 +1098,7 @@ function write_config($desc="Unknown", $backup = true) {
config_unlock();
if(is_dir("/usr/local/pkg/write_config/")) {
if(is_dir("/usr/local/pkg/write_config")) {
/* process packager manager custom rules */
update_filter_reload_status("Running plugins");
run_plugins("/usr/local/pkg/write_config/");

View File

@ -2224,7 +2224,7 @@ function run_plugins($directory) {
if(!stristr($file,"CVS")) {
if($g['booting'] == true)
echo "\t{$file}... ";
require_once($directory . $file);
require_once($directory . "/" . $file);
}
}
}

View File

@ -38,15 +38,20 @@ require_once("service-utils.inc");
require_once("pfsense-utils.inc");
require_once("globals.inc");
safe_mkdir("/var/db/pkg");
$g['platform'] = trim(file_get_contents("/etc/platform"));
if($g['platform'] == "pfSense") {
safe_mkdir("/usr/local/pkg");
safe_mkdir("/usr/local/pkg/pf");
} else {
if(!is_dir("/usr/local/pkg") or !is_dir("/usr/local/pkg/pf")) {
conf_mount_rw();
safe_mkdir("/usr/local/pkg");
safe_mkdir("/usr/local/pkg/pf");
conf_mount_ro();
}
}
/****f* pkg-utils/remove_package

View File

@ -373,9 +373,11 @@ function lock($lock) {
function unlock($cfglckkey = 0) {
global $g, $cfglckkeyconsumers;
if (!$cfglckkey)
if ($cfglckkey == 0)
return;
ini_set('error_reporting', E_NONE);
if (!sem_release($cfglckkey))
log_error("WARNING: unlock() - Could not unlock lock.");
else {
@ -386,6 +388,8 @@ function unlock($cfglckkey = 0) {
ini_set('error_reporting', E_ALL & ~E_NOTICE);
}
$cfglckkeyconsumers--;
ini_set('error_reporting', E_ALL & ~E_NOTICE);
}
/* wrapper for exec() */

View File

@ -1 +1,2 @@
/etc/phpshellsessions/cvssync
/etc/phpshellsessions/cvssync
/etc/rc.initial_firmware_update

12
etc/rc
View File

@ -31,6 +31,10 @@ if [ "$PLATFORM" = "embedded" ]; then
/etc/rc.embedded
fi
if [ "$PLATFORM" = "nanobsd" ]; then
/etc/rc.embedded
fi
if [ "$PLATFORM" = "pfSense" ]; then
mdmfs -S -M -s 4m md /var/run
fi
@ -85,6 +89,8 @@ if [ "$PLATFORM" = "cdrom" ] ; then
# do nothing for cdrom platform
elif [ "$PLATFORM" = "embedded" ] ; then
# do nothing for embedded platform
elif [ "$PLATFORM" = "nanobsd" ] ; then
# do nothing for nanobsd platform
else
SWAPDEVICE=`cat /etc/fstab | grep swap | cut -f1`
/sbin/swapon -a 2>/dev/null >/dev/null
@ -98,6 +104,12 @@ if [ "$PLATFORM" = "embedded" ] ; then
ln -s /cf/conf/ /conf
fi
# Make sure symlink is correct on embedded
if [ "$PLATFORM" = "nanobsd" ] ; then
rm /conf
ln -s /cf/conf/ /conf
fi
# Repair symlinks if they are broken
if [ ! -L /etc/syslog.conf ]; then
rm -rf /etc/syslog.conf

View File

@ -1,15 +1,12 @@
#!/bin/sh
# $Id$
# /etc/rc.firmware
# part of m0n0wall (http://neon1.net/m0n0wall)
#
# originally part of m0n0wall (http://neon1.net/m0n0wall)
# Copyright (C) 2005-2009 Scott Ullrich <sullrich@pfsense.org>.
# Copyright (C) 2003 Manuel Kasper <mk@neon1.net>.
# All rights reserved.
#CFDEVICE=`cat /var/etc/cfdevice`
exec 3>&2 2>>/tmp/firmware_update.log
exec 3>&2 2>>/cf/firmware_update_misc.log
export ACTION=$1
export IMG=$2
@ -21,17 +18,47 @@ if [ $ACTION != "upgrade" ]; then
/sbin/umount -f /ftmp > /dev/null 2>&1
fi
file_notice() {
/usr/local/bin/php -q -d auto_prepend_file=config.inc <<ENDOFF
<?php
require_once("globals.inc");
require_once("functions.inc");
file_notice("$1", "$2", "$1", "");
?>
ENDOFF
}
output_env_to_log() {
date >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
ls -lah /dev/ >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
ls -lah $IMG >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
md5 $IMG >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
mount >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
top >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
}
backup_chflags() {
TOPROCESS="bin lib libexec sbin usr"
for files in $TOPROCESS; do
/usr/sbin/mtree -Pcp /${files} | bzip2 -9 > /tmp/chflags.dist.${files}.bz2 | logger -p daemon.info -i -t UpgradeFlags
/usr/sbin/mtree -Pcp /${files} | bzip2 -9 > /tmp/chflags.dist.${files}.bz2 >> /cf/upgrade_log.txt 2>&1
done
}
restore_chflags() {
TOPROCESS="bin lib libexec sbin usr"
for files in $TOPROCESS; do
cd / && /usr/bin/bzcat /tmp/chflags.dist.${files}.bz2 | /usr/sbin/mtree -PU -p /${files} | logger -p daemon.info -i -t UpgradeFlags
cd / && /usr/bin/bzcat /tmp/chflags.dist.${files}.bz2 | /usr/sbin/mtree -PU -p /${files} >> /cf/upgrade_log.txt 2>&1
done
}
@ -83,118 +110,250 @@ binary_update() {
case $ACTION in
enable)
#/sbin/mount_mfs -s 15360 -T qp120at -b 8192 -f 1024 dummy /ftmp \
# > /dev/null 2>&1
touch /cf/upgrade_log.txt
echo "" > /cf/upgrade_log.txt
;;
auto)
touch /var/run/firmware.lock
backup_chflags
remove_chflags
/etc/rc.firmware_auto
restore_chflags
;;
upgrade)
# wait 5 seconds before beginning
sleep 5
backup_chflags
remove_chflags
exec </dev/console >/dev/console 2>/dev/console
echo
echo "Firmware upgrade in progress..." | logger -p daemon.info -i -t Upgrade
echo "Firmware upgrade in progress..." | wall
# backup config
mkdir /tmp/configbak
cp -p /conf/* /tmp/configbak
# unmount /cf
/sbin/umount -f /cf
# dd image onto card
if [ -r $IMG ]; then
/usr/bin/gunzip -S "" -c $IMG | dd of=/dev/r$CFDEVICE bs=16k > /dev/null 2>&1
echo "Image installed."
fi
pfSenseNanoBSDupgrade)
# mount /cf
/sbin/mount -w -o noatime /cf
# restore config
cp -p /tmp/configbak/* /conf
restore_chflags
rm -f /var/run/firmware.lock
/bin/sync
sleep 5
echo "Done."
# If /tmp/post_upgrade_command exists after update
# then execute the command.
if [ -f /tmp/post_upgrade_command ]; then
sh /tmp/post_upgrade_command
fi
# If the archive has unpacked a file called
# /tmp/no_upgrade_reboot_required then do
# not reboot after upgrade.
if [ -f /tmp/no_upgrade_reboot_required ]; then
rm /tmp/no_upgrade_reboot_required
else
rm -f /var/run/config.lock
sh /etc/rc.reboot
fi
;;
pfSenseupgrade)
# wait 5 seconds before beginning
sleep 5
/etc/rc.conf_mount_rw
# Sanity check - bail early if there's no firmware file!
if [ ! -r $IMG ]; then
echo "2nd parameter has not been passed or file does not exist. Exiting." | logger -p daemon.info -i -t Upgrade
echo "2nd parameter has not been passed or file does not exist. Exiting." >> /cf/upgrade_log.txt 2>&1
/etc/rc.conf_mount_ro
exit 1
fi
# Prevent full upgrade file from being used to upgrade
if [ `echo $IMG | grep "full"` ]; then
echo "You cannot use a full file for upgrade. Please use a file labeled upgrade."
file_notice "NanoBSDUpgradeFailure" "You have attemped to use a full NanoBSD installation file as an upgrade. Please use a NanoBSD file labeled 'upgrade' instead."
/etc/rc.conf_mount_ro
exit 1
fi
touch /var/run/firmware.lock
echo "NanoBSD Firmware upgrade in progress..." >> /cf/upgrade_log.txt 2>&1
echo "NanoBSD Firmware upgrade in progress..." | wall
# backup config
/bin/mkdir -p /tmp/configbak
cp -p /conf/* /tmp/configbak 2>/dev/null
touch /cf/upgrade_log.txt
echo "" > /cf/upgrade_log.txt
echo "Installing $IMG." >> /cf/upgrade_log.txt 2>&1
echo "Installing $IMG." >> /cf/upgrade_log.txt
# resolve glabel label that we booted from
BOOT_DEVICE=`/sbin/mount | /usr/bin/grep pfsense | /usr/bin/cut -d'/' -f4 | /usr/bin/cut -d' ' -f1`
# resolve glabel to the real boot dev entry
REAL_BOOT_DEVICE=`/sbin/glabel list | /usr/bin/grep -B2 ufs/${BOOT_DEVICE} | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' '`
# grab the boot device, example ad1, ad0
BOOT_DRIVE=`/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`
# test the slice. if we are on slice 1 we need to flash 2 and vica versa
if [ `echo $REAL_BOOT_DEVICE | /usr/bin/grep "s1"` ]; then
SLICE="2"
OLDSLICE="1"
TOFLASH="${BOOT_DRIVE}s${SLICE}"
COMPLETE_PATH="${BOOT_DRIVE}s${SLICE}a"
GLABEL_SLICE="pfsense1"
UFS_ID="1"
OLD_UFS_ID="0"
else
SLICE="1"
OLDSLICE="2"
TOFLASH="${BOOT_DRIVE}s${SLICE}"
COMPLETE_PATH="${BOOT_DRIVE}s${SLICE}a"
GLABEL_SLICE="pfsense0"
UFS_ID="0"
OLD_UFS_ID="1"
fi
# Output specifc information that this script is using
echo "SLICE $SLICE" >> /cf/upgrade_log.txt
echo "OLDSLICE $OLDSLICE" >> /cf/upgrade_log.txt
echo "TOFLASH $TOFLASH" >> /cf/upgrade_log.txt
echo "COMPLETE_PATH $COMPLETE_PATH" >> /cf/upgrade_log.txt
echo "GLABEL_SLICE $GLABEL_SLICE" >> /cf/upgrade_log.txt
# Output environment information to log file
output_env_to_log
# Log that we are really doing a NanoBSD upgrade
echo "" >> /cf/upgrade_log.txt
echo "NanoBSD upgrade starting" >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
# Foot shooting is fun!
echo "" >> /cf/upgrade_log.txt
echo "/sbin/sysctl kern.geom.debugflags=16" >> /cf/upgrade_log.txt
/sbin/sysctl kern.geom.debugflags=16 >> /cf/upgrade_log.txt 2>&1
# Remove TOFLASH and get ready for new flash image
echo "" >> /cf/upgrade_log.txt
echo "dd if=/dev/zero of=/dev/${TOFLASH} bs=1m count=1" >> /cf/upgrade_log.txt
dd if=/dev/zero of=/dev/${TOFLASH} bs=1m count=1 >> /cf/upgrade_log.txt 2>&1
# Stream gzipped image to dd and explode image to new area
echo "" >> /cf/upgrade_log.txt
echo "/usr/bin/gzcat $IMG | /bin/dd of=/dev/${TOFLASH} bs=16k" >> /cf/upgrade_log.txt
/usr/bin/gzcat $IMG | /bin/dd of=/dev/${TOFLASH} bs=16k >> /cf/upgrade_log.txt 2>&1
# Ensure that our new system is sound and bail if it is not and file a notice
echo "" >> /cf/upgrade_log.txt
echo "/sbin/fsck_ffs -y /dev/$COMPLETE_PATH" >> /cf/upgrade_log.txt
/sbin/fsck_ffs -y /dev/$COMPLETE_PATH >> /cf/upgrade_log.txt 2>&1
if [ $? != 0 ]; then
file_notice "UpgradeFailure" "{\$g['product_name']} upgrade has failed. Your system has been left in a usable state."
rm /var/run/firmware.lock
/etc/rc.conf_mount_ro
exit 1
fi
# Add back the corresponding glabel
echo "" >> /cf/upgrade_log.txt
echo "/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH" >> /cf/upgrade_log.txt
/sbin/tunefs -L ${GLABEL_SLICE} /dev/$COMPLETE_PATH >> /cf/upgrade_log.txt 2>&1
# restore config
cp -p /tmp/configbak/* /conf 2>/dev/null
# Remove upgrade file
rm -f $IMG
# Mount newly prepared slice
mkdir /tmp/$GLABEL_SLICE
mount /dev/ufs/$GLABEL_SLICE /tmp/$GLABEL_SLICE
# If /tmp/$GLABEL_SLICE/tmp/post_upgrade_command exists
# after update then execute the command.
if [ -f /tmp/$GLABEL_SLICE/tmp/post_upgrade_command ]; then
sh /tmp/$GLABEL_SLICE/tmp/post_upgrade_command >> /cf/upgrade_log.txt 2>&1
fi
# Update fstab
cp /etc/fstab /tmp/$GLABEL_SLICE/etc/fstab
sed -i "" "s/pfsense${OLD_UFS_ID}/pfsense${UFS_ID}/g" /tmp/$GLABEL_SLICE/etc/fstab
if [ $? != 0 ]; then
echo "Something went wrong when trying to update the fstab entry. Aborting upgrade."
file_notice "UpgradeFailure" "Something went wrong when trying to update the fstab entry. Aborting upgrade."
rm /var/run/firmware.lock
umount /tmp/$GLABEL_SLICE
/etc/rc.conf_mount_ro
exit 1
fi
echo "" >> /cf/upgrade_log.txt
cat /tmp/$GLABEL_SLICE/etc/fstab >> /cf/upgrade_log.txt
# Unmount newly prepared slice
umount /tmp/$GLABEL_SLICE
# Set active mount slice in fdisk
echo "" >> /cf/upgrade_log.txt
echo "gpart set -a active -i ${SLICE} ${BOOT_DRIVE}" >> /cf/upgrade_log.txt
gpart set -a active -i ${SLICE} ${BOOT_DRIVE}
# Set active boot source
echo "" >> /cf/upgrade_log.txt
echo "/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE}" >> /cf/upgrade_log.txt
/usr/sbin/boot0cfg -s ${SLICE} -v /dev/${BOOT_DRIVE} >> /cf/upgrade_log.txt 2>&1
# Remove extra stuff
rm -rf /etc/rc.conf
rm -rf /etc/motd
rm -rf /usr/savecore/*
date >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
# Trigger a package reinstallation on reobot
touch /conf/needs_package_sync
# remount /cf ro
/etc/rc.conf_mount_ro
/bin/sync
echo "Done." >> /cf/upgrade_log.txt 2>&1
# Enough fun for now.
echo "" >> /cf/upgrade_log.txt
echo "/sbin/sysctl kern.geom.debugflags=0" >> /cf/upgrade_log.txt
/sbin/sysctl kern.geom.debugflags=0 >> /cf/upgrade_log.txt 2>&1
rm -f /var/run/firmware.lock
sh /etc/rc.reboot
;;
pfSenseupgrade)
# mount /cf
/etc/rc.conf_mount_rw
# Sanity check - bail early if there's no firmware file!
if [ ! -r $IMG ]; then
echo "2nd parameter has not been passed or file does not exist. Exiting." >> /cf/upgrade_log.txt 2>&1
/etc/rc.conf_mount_ro
exit
fi
# wait 1 seconds before beginning
sleep 1
# Log that we are really doing a NanoBSD upgrade
echo "" >> /cf/upgrade_log.txt
echo "NanoBSD upgrade starting" >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
touch /var/run/firmware.lock
touch /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
# Output environment information to log file
output_env_to_log
backup_chflags
remove_chflags
# Do we have a pre-upgrade hook in the update file?
if [ `tar tvzf $IMG | grep /tmp/pre_upgrade_command | wc -l` -gt 0 ]; then
tar xzvf $IMG -C / ./tmp/pre_upgrade_command
chmod a+rx /tmp/pre_upgrade_command
sh /tmp/pre_upgrade_command
tar xzvf $IMG -C / ./tmp/pre_upgrade_command >> /cf/upgrade_log.txt 2>&1
chmod a+rx /tmp/pre_upgrade_command >> /cf/upgrade_log.txt 2>&1
sh /tmp/pre_upgrade_command >> /cf/upgrade_log.txt 2>&1
fi
#exec </dev/console >/dev/console 2>/dev/console
echo "Firmware upgrade in progress..." | logger -p daemon.info -i -t Upgrade
echo "Firmware upgrade in progress..." >> /cf/upgrade_log.txt 2>&1
echo "Firmware upgrade in progress..." | wall
# backup config
/bin/mkdir -p /tmp/configbak
cp -p /conf/* /tmp/configbak 2>/dev/null
# mount /cf
/etc/rc.conf_mount_rw
/sbin/mount -w -o noatime /cf 2>/dev/null
/sbin/mount -w -o noatime / 2>/dev/null
# tar explode image onto hd
echo "Installing $IMG." | logger -p daemon.info -i -t Upgrade
cd / && /usr/bin/tar xzUPf $IMG | logger -p daemon.info -i -t Upgrade
echo "Installing $IMG." >> /cf/upgrade_log.txt 2>&1
cd / && /usr/bin/tar xzUPf $IMG >> /cf/upgrade_log.txt 2>&1
/usr/bin/find / -name CVS -exec rm -fr {} \;
echo "Image installed $IMG." | logger -p daemon.info -i -t Upgrade
echo "Image installed $IMG." >> /cf/upgrade_log.txt 2>&1
# process custom image if its passed
if [ $# -eq 3 ]; then
if [ -f $CUSTOMIMG ]; then
echo "Custom image $CUSTOMIMG found." | logger -p daemon.info -i -t Upgrade
echo "Custom image ($CUSTOMIMG) found."
echo "Custom image $CUSTOMIMG found." >> /cf/upgrade_log.txt 2>&1
echo "Custom image ($CUSTOMIMG) found." >> /cf/upgrade_log.txt 2>&1
PWD_DIR=`pwd`
cd / && /usr/bin/tar xzPUf $CUSTOMIMG | logger -p daemon.info -i -t Upgrade
cd / && /usr/bin/tar xzPUf $CUSTOMIMG >> /cf/upgrade_log.txt 2>&1
cd $PWD_DIR
echo "Custom image $CUSTOMIMG installed." | logger -p daemon.info -i -t Upgrade
echo "Custom image $CUSTOMIMG installed." >> /cf/upgrade_log.txt 2>&1
fi
fi
@ -210,33 +369,31 @@ pfSenseupgrade)
# Remove upgrade file
rm -f $IMG
rm -f /var/run/firmware.lock
/bin/sync
sleep 5
# remount /cf ro
rm -rf /etc/rc.conf
rm -rf /etc/motd
find / -name CVS -type d -exec rm {} \;
rm -rf /usr/savecore/*
/etc/rc.conf_mount_ro
/sbin/umount -f /cf 2>/dev/null
/sbin/mount -r /cf 2>/dev/null
/sbin/umount -f / 2>/dev/null
/sbin/mount -r / 2>/dev/null
if [ -e /etc/init_bootloader.sh ]; then
sh /etc/init_bootloader.sh
sh /etc/init_bootloader.sh >> /cf/upgrade_log.txt 2>&1
fi
/bin/sync
echo "Done." | logger -p daemon.info -i -t Upgrade
# If /tmp/post_upgrade_command exists after update
# then execute the command.
if [ -f /tmp/post_upgrade_command ]; then
sh /tmp/post_upgrade_command
sh /tmp/post_upgrade_command >> /cf/upgrade_log.txt 2>&1
fi
# remove unused files
rm -rf /etc/rc.conf
rm -rf /etc/motd
rm -rf /usr/savecore/*
date >> /cf/upgrade_log.txt
echo "" >> /cf/upgrade_log.txt
# remount /cf ro
/etc/rc.conf_mount_ro
# release the firmware lock
rm -f /var/run/firmware.lock
/bin/sync
# If the archive has unpacked a file called
# /tmp/no_upgrade_reboot_required then do
# not reboot after upgrade.
@ -246,8 +403,10 @@ pfSenseupgrade)
rm -f /var/run/config.lock
sh /etc/rc.reboot
fi
;;
delta_update)
touch /var/run/firmware.lock
backup_chflags
remove_chflags
binary_update $IMG

View File

@ -156,7 +156,7 @@ case ${opmode} in
/usr/local/sbin/pfSsh.php
;;
13)
php -f /etc/rc.initial_firmware_update
php -f /etc/rc.initial.firmware_update
;;
14)
php -f /etc/rc.initial.toggle_sshd

View File

@ -2,12 +2,11 @@
<?php
echo ".";
$g['booting'] = true;
require("globals.inc");
echo "Starting the {$g['product_name']} console firmware update system";
$g['booting'] = true;
require("functions.inc");
echo ".";
require("config.inc");
@ -82,20 +81,29 @@ switch ($command) {
echo "Downloaded file MD5: $file_md5\n";
if($source_md5 <> $file_md5) {
echo "\n\nMD5 checksum does not match. Cancelling upgrade.\n\n";
fclose($fp);
exec("rm -f /root/*.md5");
fclose($fp);
die -1;
}
echo "\nMD5 checksum matches.\n";
exec("rm -f /root/*.md5");
}
if(file_exists("/root/firmware.tgz"))
do_upgrade("/root/firmware.tgz");
} else {
echo "\nCould not download update.\n\n";
fclose($fp);
die -1;
}
if(strstr($url,"bdiff")) {
echo "Binary DIFF upgrade file detected...\n";
$type = "bdiff";
}
if(strstr($url,"bdiff")) {}
echo "NanoBSD upgrade file detected...\n";
$type = "nanobsd";
}
if(file_exists("/root/firmware.tgz")) {
do_upgrade("/root/firmware.tgz", $type);
exit;
} else {
echo "\nCould not download update.\n\n";
fclose($fp);
die -1;
}
case "2":
echo "\nEnter the complete path to the .tgz update file: ";
$path = chop(fgets($fp));
@ -103,9 +111,13 @@ switch ($command) {
fclose($fp);
die;
}
if(stristr($fp,"bdiff"))
$type = "bdiff";
if(stristr($fp,"bdiff"))
$type = "nanobsd";
if(file_exists($path)) {
touch($d_fwupenabled_path);
do_upgrade($path);
do_upgrade($path, $type);
} else {
echo "\nCould not find file.\n\n";
fclose($fp);
@ -118,7 +130,7 @@ function check_for_kernel_file() {
$platform = file_get_contents("/etc/platform");
$platform = str_replace("\n", "", $platform);
$platform = str_replace("\r", "", $platform);
if($platform == "embedded" or $platform == "wrap") {
if($platform == "embedded" or $platform == "wrap" or $platform == "nanobsd") {
exec("echo wrap > /boot/kernel/pfsense_kernel.txt");
echo "\n";
return;
@ -149,18 +161,28 @@ function check_for_kernel_file() {
}
}
function do_upgrade($path) {
global $fp, $g;
touch($g['varrun_path'] . "/firmware.lock");
function do_upgrade($path, $type) {
global $g;
touch($g['varrun_path'] . "/firmware.lock");
check_for_kernel_file();
echo "\nOne moment please... Invoking firmware upgrade...\n";
exec("/etc/rc.firmware pfSenseupgrade $path");
unlink_if_exists($path);
unlink_if_exists($g['varrun_path'] . "/firmware.lock");
die;
echo "\nOne moment please...\nInvoking firmware upgrade...";
if($type == "bdiff")
mwexec_bg("/etc/rc.firmware delta_update $path");
elseif($type == "nanobsd")
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade $path");
else
mwexec_bg("/etc/rc.firmware pfSenseupgrade $path");
sleep(10);
while(file_exists("{$g['varrun_path']}/firmware.lock")) {
sleep(1);
echo ".";
}
echo "Done. Rebooting...\n\n";
if(file_exists($g['varrun_path'] . "/firmware.lock"))
unlink($g['varrun_path'] . "/firmware.lock");
}
exec("rm -f /root/*.md5");
fclose($fp);
?>
?>

View File

@ -28,6 +28,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once("globals.inc");
require_once("config.inc");
require_once("notices.inc");
@ -44,6 +45,13 @@
return $size;
}
/* restore ssh data for nanobsd platform */
if($g['platform'] == "nanobsd" and file_exists("/conf/sshd/ssh_host_key")) {
if(!file_exists("/etc/ssh/sshd_host_key.pub")) {
exec("cp /conf/sshd/* /etc/ssh/");
}
}
/* if any of these files are 0 bytes then they are corrupted.
* remove them
*/
@ -180,6 +188,13 @@
echo "done.\n";
}
// NanoBSD
if($g['platform'] == "nanobsd") {
if(!is_dir("/conf/sshd"))
exec("mkdir /conf/sshd");
exec("cp /etc/ssh/ssh_host* /conf/sshd");
}
conf_mount_ro();

View File

@ -25,7 +25,8 @@ if (($_POST['submit'] == "Download") && file_exists($_POST['dlPath'])) {
unset($_POST['txtCommand']);
}
conf_mount_rw();
if($_POST)
conf_mount_rw();
// Function: is Blank
// Returns true or false depending on blankness of argument.
@ -293,6 +294,7 @@ document.forms[0].txtCommand.focus();
<?php
conf_mount_ro();
if($_POST)
conf_mount_ro();
?>

View File

@ -122,7 +122,7 @@ require_once("notices.inc");
<li><a href="/system_advanced.php" class="navlnk">Advanced</a></li>
<li><a href="/system_firmware.php" class="navlnk">Firmware</a></li>
<li><a href="/system.php" class="navlnk">General Setup</a></li>
<?php if($g['platform'] == "pfSense"): ?>
<?php if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd"): ?>
<li><a href="/pkg_mgr.php" class="navlnk">Packages</a></li>
<?php endif; ?>
<li><a href="/wizard.php?xml=setup_wizard.xml" class="navlnk">Setup wizard</a></li>

View File

@ -156,7 +156,7 @@ $medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex",
"10half" => "10BASE-T half-duplex");
/* platforms that support firmware updating */
$fwupplatforms = array('pfSense', 'net45xx', 'net48xx', 'generic-pc', 'embedded', 'wrap');
$fwupplatforms = array('pfSense', 'net45xx', 'net48xx', 'generic-pc', 'embedded', 'wrap', 'nanobsd');
/* IPsec defines */
$my_identifier_list = array('myaddress' => 'My IP address',

View File

@ -55,11 +55,11 @@ include("head.inc");
<?php
$version = file_get_contents("/etc/version");
$tab_array = array();
$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
/* $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
$tab_array[] = array("{$version} packages", false, "pkg_mgr.php");
// $tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
// $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
$tab_array[] = array("Installed packages", false, "pkg_mgr_installed.php");
$tab_array[] = array("Package Installer", true, "");
$tab_array[] = array("Package Installer", true, "");
display_top_tabs($tab_array);
?>
</td></tr>

View File

@ -50,9 +50,9 @@ include("head.inc");
<?php
$version = file_get_contents("/etc/version");
$tab_array = array();
$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php");
$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
/* $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */
$tab_array[] = array("{$version} packages", false, "pkg_mgr.php");
// $tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
// $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
$tab_array[] = array("Installed packages", true, "pkg_mgr_installed.php");
display_top_tabs($tab_array);
?>

View File

@ -137,7 +137,9 @@ if ($_POST && !file_exists($d_firmwarelock_path)) {
/* fire up the update script in the background */
touch($d_firmwarelock_path);
$savemsg = "The firmware is now being updated. The firewall will reboot automatically.";
if(stristr($_FILES['ulfile']['tmp_name'],"bdiff"))
if(stristr($_FILES['ulfile']['name'],"nanobsd"))
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
else if(stristr($_FILES['ulfile']['name'],"bdiff"))
mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
else
mwexec_bg("/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz");

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<!--
NiftyCheck();
Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth");
Rounded("div#mainarea","bl br tr","#FFF","#eeeeee","smooth");
Rounded("div#boxarea","bl br tl tr","#FFF","#eeeeee","smooth");
Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth");
Rounded("div#topbox","all","#FFF","#990000","smooth");
//-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,43 @@
/*******************************************************************************
$Id: graphlink.css,v 1.2.2.1 2007/01/17 18:43:30 sullrich Exp $
This file is part of the GraphLink software.
GraphLink is distributed under the MIT License.
Copyright (C) 2005-2006 Max Khitrov <max@mxsoft.org>
*******************************************************************************/
/**
* Defines the background image used for the graph, as well as the actual data
* locations.
* Use padding-left and padding-top to align the data area correctly with your
* background image.
* Width and height should same as the dimensions of the image, minus the
* padding values in both directions.
*/
div.GraphLink {
width: 212px;
height: 60px;
padding-left: 38px;
padding-top: 10px;
background-image: url(/themes/nervecenter/images/misc/graph.png);
overflow: hidden;
}
/**
* Defines the data display area. Modify to fit your background image.
*/
div.GraphLinkData {
width: 200px;
height: 50px;
overflow: hidden;
}
/**
* Defines the look of one bar. Nothing to change here other than the color.
*/
span.GraphLinkBar {
background-color: #990000;
height: 100%;
float: left;
overflow: hidden;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Some files were not shown because too many files have changed in this diff Show More