summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-05-01 21:56:56 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-05-01 21:56:56 +0000
commitf4feb493f2a30c65375b5b994471417150ce200c (patch)
tree9dd005d357a62a7981e801c87f30943902f99bd5
parent3264c13b6c063587da04d1ebe7089dab8aaa2ce9 (diff)
downloadpfsense-f4feb493f2a30c65375b5b994471417150ce200c.zip
pfsense-f4feb493f2a30c65375b5b994471417150ce200c.tar.gz
Add firmware update menu option which can fetch a URL from the internet or use a already fetched file from the file system.
-rwxr-xr-xetc/rc.initial6
-rwxr-xr-xetc/rc.initial.firmware_update64
2 files changed, 69 insertions, 1 deletions
diff --git a/etc/rc.initial b/etc/rc.initial
index 66bab08..51258c8 100755
--- a/etc/rc.initial
+++ b/etc/rc.initial
@@ -77,6 +77,7 @@ echo " 9) PFtop"
echo "10) Filter Logs"
echo "11) Restart webConfigurator"
echo "12) pfSense PHP shell"
+echo "13) Upgrade from console"
for i in /var/db/pfi/capable_*; do
if [ -f $i -a ! -L /cf/conf ]; then
echo "98) Move configuration file to removable device"
@@ -134,7 +135,10 @@ case ${opmode} in
12)
/usr/local/sbin/pfSsh.php
;;
-13)
+13)
+ /etc/rc.initial_firmware_update
+ ;;
+14)
/etc/rc.banner
;;
98)
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
new file mode 100755
index 0000000..74ee6e4
--- /dev/null
+++ b/etc/rc.initial.firmware_update
@@ -0,0 +1,64 @@
+#!/usr/local/bin/php -f
+
+<?php
+
+echo "Starting the pfSense console firmware update system";
+
+echo ".";
+require("globals.inc");
+$g['booting'] = true;
+require("functions.inc");
+echo ".";
+require("config.inc");
+echo ".";
+$g['booting'] = false;
+
+$fp = fopen('php://stdin', 'r');
+
+echo ".\n\n";
+
+$shell_active = true;
+
+echo "1) Update from a URL\n";
+echo "2) Update from a local file\n";
+echo "Q) Quit\n";
+
+echo "\nPlease select an option to continue: ";
+
+$command = strtoupper(chop(fgets($fp)));
+
+switch ($command) {
+ case "q":
+ case "quit":
+ echo "\n";
+ die;
+ break;
+ case "1":
+ echo "\nEnter the URL to the .tgz update file:\n> ";
+ $url = chop(fgets($fp));
+ $status = does_url_exist($url);
+ if($status) {
+ exec("fetch -v -o /tmp/firmware.tgz \"$url\"");
+ if(file_exists("/tmp/firmware.tgz"))
+ do_upgrade("/tmp/firmware.tgz");
+ } else {
+ echo "\nCould not download update.\n\n";
+ die -1;
+ }
+ case "2":
+ echo "\nEnter the complete path to the .tgz update file: ";
+ $path = chop(fgets($fp));
+ if(file_exists($path)) {
+ do_upgrade($path);
+ } else {
+ echo "\nCould not find file.\n\n";
+ die -1;
+ }
+}
+
+function do_upgrade($path) {
+ echo "\nOne moment please... Invoking firmware upgrade...\n";
+ exec("/etc/rc.firmware pfSenseupgrade $path");
+}
+
+?> \ No newline at end of file
OpenPOWER on IntegriCloud