Commit 264c28d1 authored by Franco Fichtner's avatar Franco Fichtner

firmware: remove some obsolete parts of the firmware update system

Fear not as we will reintroduce the functionality in the GUI using
our new firmware update system which includes pkg(8)/opnsense-update(8).
parent d178bd83
...@@ -142,11 +142,6 @@ else if (file_exists("/var/run/booting") && !file_exists('/conf/config.xml')) { ...@@ -142,11 +142,6 @@ else if (file_exists("/var/run/booting") && !file_exists('/conf/config.xml')) {
} }
} }
/* write device name to a file for rc.firmware */
$fd = fopen("{$g['varetc_path']}/cfdevice", "w");
fwrite($fd, $cfgdevice . "\n");
fclose($fd);
/* write out an fstab */ /* write out an fstab */
$fd = fopen('/etc/fstab', 'w'); $fd = fopen('/etc/fstab', 'w');
......
This diff is collapsed.
#!/bin/sh
FMBASEURL=$1
FMFILENAME=$2
FETCHFILENAME=$1/$2
product=`cat /usr/local/etc/inc/globals.inc | grep product_name | cut -d'"' -f4`
# wait 5 seconds before beginning
sleep 5
logger -p daemon.info -i -t AutoUpgrade "Auto Upgrade started"
HTTP_AUTH=""
# if username and password is passed, let fetch utilize.
if [ $# -gt 3 ]; then
HTTP_AUTH="basic:*:$3:$4"
fi
#echo "Downloading $FMFILENAME from $FMBASEURL ..." | logger -p daemon.info -i -t AutoUpgrade
#/usr/bin/fetch -o /tmp/latest.tgz $FETCHFILENAME | logger -p daemon.info -i -t AutoUpgrade
#echo "Downloading $FMFILENAME.md5 from $FMBASEURL ..." | logger -p daemon.info -i -t AutoUpgrade
#/usr/bin/fetch -o /tmp/latest.tgz.md5 $FETCHFILENAME.md5 | logger -p daemon.info -i -t AutoUpgrade
PMD=`/bin/cat /tmp/latest.tgz.md5 | cut -d" " -f4 `
MD=`/sbin/md5 /tmp/latest.tgz | cut -d" " -f4`
PLATFORM=`cat /usr/local/etc/platform`
echo " Package MD5: ${PMD}" | logger -p daemon.info -i -t AutoUpgrade
echo "Downloaded MD5: ${MD}" | logger -p daemon.info -i -t AutoUpgrade
if [ "$PMD" = "" ]; then
echo "Package MD5 is null md5. Require proxy auth?" | logger -p daemon.info -i -t AutoUpgrade
exit 1
fi
if [ "$MD" = "" ]; then
echo "Downloaded MD5 is null md5. Require proxy auth?" | logger -p daemon.info -i -t AutoUpgrade
exit 1
fi
if [ "$PMD" = "$MD" ]; then
echo "MD5's match." | logger -p daemon.info -i -t AutoUpgrade
echo "Beginning ${product} upgrade." | wall
if [ "$PLATFORM" = "net45xx" ]; then
/usr/local/etc/rc.conf_mount_rw
fi
if [ "$PLATFORM" = "wrap" ]; then
/usr/local/etc/rc.conf_mount_rw
fi
if [ "$PLATFORM" = "nanobsd" ]; then
/usr/local/etc/rc.conf_mount_rw
fi
if [ -r "/tmp/custom.tgz" ]; then
sh /usr/local/etc/rc.firmware pfSenseupgrade /tmp/latest.tgz /tmp/custom.tgz
else
if [ "$PLATFORM" = "nanobsd" ]; then
sh /usr/local/etc/rc.firmware pfSenseNanoBSDupgrade /tmp/latest.tgz
else
sh /usr/local/etc/rc.firmware pfSenseupgrade /tmp/latest.tgz
fi
fi
if [ "$PLATFORM" = "wrap" ]; then
/bin/sync
sleep 5
/usr/local/etc/rc.conf_mount_ro
if [ -e /etc/init_bootloader.sh ]; then
sh /etc/init_bootloader.sh
fi
fi
if [ "$PLATFORM" = "net45xx" ]; then
/bin/sync
sleep 5
/usr/local/etc/rc.conf_mount_ro
if [ -e /etc/init_bootloader.sh ]; then
sh /etc/init_bootloader.sh
fi
fi
exit 0
fi
echo "MD5's do not match. Upgrade aborted." | logger -p daemon.info -i -t AutoUpgrade
rm /tmp/latest*
exit 1
...@@ -134,7 +134,6 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { ...@@ -134,7 +134,6 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
else if (!file_exists($_FILES['ulfile']['tmp_name'])) { else if (!file_exists($_FILES['ulfile']['tmp_name'])) {
/* probably out of memory for the MFS */ /* probably out of memory for the MFS */
$input_errors[] = gettext("Image upload failed (out of memory?)"); $input_errors[] = gettext("Image upload failed (out of memory?)");
mwexec("/usr/local/etc/rc.firmware disable");
clear_subsystem_dirty('firmware'); clear_subsystem_dirty('firmware');
} else { } else {
/* move the image so PHP won't delete it */ /* move the image so PHP won't delete it */
...@@ -155,20 +154,10 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { ...@@ -155,20 +154,10 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
/* fire up the update script in the background */ /* fire up the update script in the background */
mark_subsystem_dirty('firmwarelock'); mark_subsystem_dirty('firmwarelock');
$savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically."); $savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically.");
if (stristr($_FILES['ulfile']['name'],"nanobsd") or $_POST['isnano'] == "yes") mwexec_bg("/usr/local/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz");
mwexec_bg("/usr/local/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz"); } else {
else if(stristr($_FILES['ulfile']['name'],"bdiff"))
mwexec_bg("/usr/local/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
else {
if($g['platform'] == "nanobsd")
$whichone = "pfSenseNanoBSDupgrade";
else
$whichone = "pfSenseupgrade";
mwexec_bg("/usr/local/etc/rc.firmware {$whichone} {$g['upload_path']}/firmware.tgz");
unset($whichone);
}
} else
$savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."),$errortext); $savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."),$errortext);
}
} }
} }
} }
......
...@@ -172,15 +172,7 @@ if(!$latest_version) { ...@@ -172,15 +172,7 @@ if(!$latest_version) {
} }
/* launch external upgrade helper */ /* launch external upgrade helper */
$external_upgrade_helper_text = "/usr/local/etc/rc.firmware "; $external_upgrade_helper_text = "/usr/local/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/latest.tgz";
if($g['platform'] == "nanobsd")
$external_upgrade_helper_text .= "pfSenseNanoBSDupgrade ";
else
$external_upgrade_helper_text .= "pfSenseupgrade ";
$external_upgrade_helper_text .= "{$g['upload_path']}/latest.tgz";
$downloaded_latest_tgz_sha256 = str_replace("\n", "", `/sbin/sha256 -q {$g['upload_path']}/latest.tgz`); $downloaded_latest_tgz_sha256 = str_replace("\n", "", `/sbin/sha256 -q {$g['upload_path']}/latest.tgz`);
$upgrade_latest_tgz_sha256 = str_replace("\n", "", `/bin/cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print $4 }'`); $upgrade_latest_tgz_sha256 = str_replace("\n", "", `/bin/cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print $4 }'`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment