summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.firmware_update
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 /etc/rc.initial.firmware_update
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.
Diffstat (limited to 'etc/rc.initial.firmware_update')
-rwxr-xr-xetc/rc.initial.firmware_update64
1 files changed, 64 insertions, 0 deletions
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