Project

General

Profile

« Previous | Next » 

Revision b5855499

Added by Scott Ullrich almost 16 years ago

Add support for the NanoBSD platform

View differences:

etc/rc.initial_firmware_update
2 2

  
3 3
<?php
4 4

  
5
echo ".";
5
$g['booting'] = true;
6 6
require("globals.inc");
7 7

  
8 8
echo "Starting the {$g['product_name']} console firmware update system";
9 9

  
10
$g['booting'] = true;
11 10
require("functions.inc");
12 11
echo ".";
13 12
require("config.inc");
......
82 81
				echo "Downloaded file MD5: $file_md5\n";
83 82
				if($source_md5 <> $file_md5) {
84 83
					echo "\n\nMD5 checksum does not match.  Cancelling upgrade.\n\n";
85
					fclose($fp);
86 84
					exec("rm -f /root/*.md5");
85
					fclose($fp);
87 86
					die -1;
88 87
				}
89 88
				echo "\nMD5 checksum matches.\n";
90 89
				exec("rm -f /root/*.md5");
91 90
			}
92
			if(file_exists("/root/firmware.tgz"))
93
				do_upgrade("/root/firmware.tgz");
91
			if(stristr($url,"bdiff"))
92
				$type = "bdiff";
93
			if(stristr($url,"bdiff"))
94
				$type = "nanobsd";				
95
			if(file_exists("/root/firmware.tgz")) {
96
				do_upgrade("/root/firmware.tgz", $type);
97
				exit;
98
			}
94 99
		} else {
95 100
			echo "\nCould not download update.\n\n";
96 101
			fclose($fp);
......
103 108
			fclose($fp);
104 109
			die;
105 110
		}
111
		if(stristr($fp,"bdiff"))
112
			$type = "bdiff";
113
		if(stristr($fp,"bdiff"))
114
			$type = "nanobsd";			
106 115
		if(file_exists($path)) {
107 116
			touch($d_fwupenabled_path);
108
			do_upgrade($path);
117
			do_upgrade($path, $type);
109 118
		} else {
110 119
			echo "\nCould not find file.\n\n";
111 120
			fclose($fp);
......
149 158
	}
150 159
}
151 160

  
152
function do_upgrade($path) {
153
	global $fp, $g;
154
	touch($g['varrun_path'] . "/firmware.lock");
161
function do_upgrade($path, $type) {
162
	global $g;
163
	touch($g['varrun_path'] . "/firmware.lock");	
155 164
	check_for_kernel_file();
156
	echo "\nOne moment please... Invoking firmware upgrade...\n";
157
	exec("/etc/rc.firmware pfSenseupgrade $path");
158
	unlink_if_exists($path);
159
	unlink_if_exists($g['varrun_path'] . "/firmware.lock");
160
	die;
165
	echo "\nOne moment please...\nInvoking firmware upgrade...";
166
	if($type == "bdiff") 
167
		mwexec_bg("/etc/rc.firmware delta_update $path");
168
	elseif($type == "nanobsd") 
169
		mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade $path");
170
	else
171
		mwexec_bg("/etc/rc.firmware pfSenseupgrade $path");
172
	sleep(10);
173
	while(file_exists("{$g['varrun_path']}/firmware.lock")) {
174
		sleep(1);
175
		echo ".";
176
	}
177
	echo "Done.  Rebooting...\n\n";
178
	unlink($g['varrun_path'] . "/firmware.lock");
161 179
}
162 180

  
163 181
exec("rm -f /root/*.md5");
164 182
fclose($fp);
165 183

  
166
?>
184
?>

Also available in: Unified diff