summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.firmware_update
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:30 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:30 +0000
commit3121018425bc40fea6936f76048eae9fb62707aa (patch)
treebf8f240a64084def0b25efd76b7162763d217628 /etc/rc.initial.firmware_update
parented4b63b09785b89f5dcbd2517ff0bfd20632be85 (diff)
downloadpfsense-3121018425bc40fea6936f76048eae9fb62707aa.zip
pfsense-3121018425bc40fea6936f76048eae9fb62707aa.tar.gz
Close STDIN ($fp) handle before returning back to shell. Major doh's.
Diffstat (limited to 'etc/rc.initial.firmware_update')
-rwxr-xr-xetc/rc.initial.firmware_update16
1 files changed, 14 insertions, 2 deletions
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
index eb731ad..210872d 100755
--- a/etc/rc.initial.firmware_update
+++ b/etc/rc.initial.firmware_update
@@ -31,13 +31,16 @@ switch ($command) {
case "q":
case "quit":
echo "\n";
+ fclose($fp);
die;
break;
case "1":
echo "\nEnter the URL to the .tgz update file:\n> ";
$url = chop(fgets($fp));
- if(!$url)
+ if(!$url) {
+ fclose($fp);
die;
+ }
$status = does_url_exist($url);
if($status) {
conf_mount_rw();
@@ -49,10 +52,12 @@ switch ($command) {
exec("fetch -1 -w15 -a -v -o /root/firmware.tgz \"$url\"");
if($file_size <> filesize("/root/firmware.tgz")) {
echo "\nFile size mismatch. Upgrade cancelled.\n\n";
+ fclose($fp);
die;
}
if(!file_exists("/root/firmware.tgz")) {
echo "Something went wrong during file transfer. Exiting.\n\n";
+ fclose($fp);
die;
}
$status = does_url_exist("$url.md5");
@@ -71,6 +76,7 @@ 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);
die -1;
}
echo "\nMD5 checksum matches.\n";
@@ -79,21 +85,27 @@ switch ($command) {
do_upgrade("/root/firmware.tgz");
} 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));
- if(!$path)
+ if(!$path) {
+ fclose($fp);
die;
+ }
if(file_exists($path)) {
do_upgrade($path);
} else {
echo "\nCould not find file.\n\n";
+ fclose($fp);
die -1;
}
}
+fclose($fp);
+
function do_upgrade($path) {
echo "\nOne moment please... Invoking firmware upgrade...\n";
exec("/etc/rc.firmware pfSenseupgrade $path");
OpenPOWER on IntegriCloud