Revision f3ec0487
Added by Phil Davis over 10 years ago
usr/local/www/classes/maintable.inc | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
/* $Id$ */ |
3 | 3 |
/* |
4 |
part of pfSense (https://www.pfsense.org/)
|
|
5 |
|
|
6 |
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
|
|
7 |
All rights reserved.
|
|
8 |
|
|
9 |
Redistribution and use in source and binary forms, with or without
|
|
10 |
modification, are permitted provided that the following conditions are met:
|
|
11 |
|
|
12 |
1. Redistributions of source code must retain the above copyright notice,
|
|
13 |
this list of conditions and the following disclaimer.
|
|
14 |
|
|
15 |
2. Redistributions in binary form must reproduce the above copyright
|
|
16 |
notice, this list of conditions and the following disclaimer in the
|
|
17 |
documentation and/or other materials provided with the distribution.
|
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
20 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21 |
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
22 |
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
23 |
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
24 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
25 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
26 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
27 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
28 |
POSSIBILITY OF SUCH DAMAGE.
|
|
4 |
part of pfSense (https://www.pfsense.org/)
|
|
5 |
|
|
6 |
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
|
|
7 |
All rights reserved.
|
|
8 |
|
|
9 |
Redistribution and use in source and binary forms, with or without
|
|
10 |
modification, are permitted provided that the following conditions are met:
|
|
11 |
|
|
12 |
1. Redistributions of source code must retain the above copyright notice,
|
|
13 |
this list of conditions and the following disclaimer.
|
|
14 |
|
|
15 |
2. Redistributions in binary form must reproduce the above copyright
|
|
16 |
notice, this list of conditions and the following disclaimer in the
|
|
17 |
documentation and/or other materials provided with the distribution.
|
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
20 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21 |
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
22 |
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
23 |
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
24 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
25 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
26 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
27 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
28 |
POSSIBILITY OF SUCH DAMAGE.
|
|
29 | 29 |
*/ |
30 | 30 |
|
31 | 31 |
/* |
... | ... | |
52 | 52 |
} |
53 | 53 |
|
54 | 54 |
function add_content_array($rows) { |
55 |
foreach($rows as $row) { |
|
55 |
foreach ($rows as $row) {
|
|
56 | 56 |
$this->content[] = $row; |
57 | 57 |
$this->rows++; |
58 | 58 |
} |
... | ... | |
160 | 160 |
private function display_buttons($row) { |
161 | 161 |
echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" summary=\"display buttons\">\n"; |
162 | 162 |
echo " <tr>\n"; |
163 |
if ($this->buttons['move']) |
|
163 |
if ($this->buttons['move']) {
|
|
164 | 164 |
echo $this->display_button('move', $row); |
165 |
if ($this->buttons['edit']) |
|
165 |
} |
|
166 |
if ($this->buttons['edit']) { |
|
166 | 167 |
echo $this->display_button('edit', $row); |
168 |
} |
|
167 | 169 |
echo " </tr>\n"; |
168 | 170 |
echo " <tr>\n"; |
169 |
if ($this->buttons['del']) |
|
171 |
if ($this->buttons['del']) {
|
|
170 | 172 |
echo $this->display_button('del', $row); |
171 |
if ($this->buttons['dup']) |
|
173 |
} |
|
174 |
if ($this->buttons['dup']) { |
|
172 | 175 |
echo $this->display_button('dup', $row); |
176 |
} |
|
173 | 177 |
echo " </tr>\n"; |
174 | 178 |
echo " </table>\n"; |
175 | 179 |
} |
usr/local/www/filebrowser/browser.js | ||
---|---|---|
16 | 16 |
function fbBrowse(path) { |
17 | 17 |
jQuery("#fileContent").fadeOut(); |
18 | 18 |
|
19 |
if(jQuery("#fbCurrentDir"))
|
|
19 |
if (jQuery("#fbCurrentDir")) {
|
|
20 | 20 |
jQuery("#fbCurrentDir").html("Loading ..."); |
21 |
} |
|
21 | 22 |
|
22 | 23 |
jQuery.ajax( |
23 | 24 |
"/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"), |
24 | 25 |
{ type: "get", complete: fbComplete } |
25 | 26 |
); |
26 |
|
|
27 |
|
|
27 | 28 |
} |
28 | 29 |
|
29 | 30 |
function fbComplete(req) { |
... | ... | |
36 | 37 |
fbFile: function() { jQuery("#fbTarget").val(this.id); } |
37 | 38 |
} |
38 | 39 |
|
39 |
for(var type in actions) { |
|
40 |
for (var type in actions) {
|
|
40 | 41 |
jQuery("#fbBrowser ." + type).each( |
41 | 42 |
function() { |
42 | 43 |
jQuery(this).click(actions[type]); |
usr/local/www/filebrowser/browser.php | ||
---|---|---|
15 | 15 |
clearstatcache(); |
16 | 16 |
$fd = @opendir($dir); |
17 | 17 |
|
18 |
while($entry = @readdir($fd)) { |
|
19 |
if($entry == ".") continue; |
|
20 |
if($entry == ".." && $dir == "/") continue; |
|
21 |
|
|
22 |
if(is_dir("{$dir}/{$entry}")) |
|
18 |
while ($entry = @readdir($fd)) { |
|
19 |
if ($entry == ".") { |
|
20 |
continue; |
|
21 |
} |
|
22 |
if ($entry == ".." && $dir == "/") { |
|
23 |
continue; |
|
24 |
} |
|
25 |
if (is_dir("{$dir}/{$entry}")) { |
|
23 | 26 |
array_push($dirs, $entry); |
24 |
else
|
|
27 |
} else {
|
|
25 | 28 |
array_push($files, $entry); |
29 |
} |
|
26 | 30 |
} |
27 | 31 |
|
28 | 32 |
@closedir($fd); |
... | ... | |
34 | 38 |
} |
35 | 39 |
|
36 | 40 |
$path = realpath(strlen($_GET['path']) > 0 ? $_GET['path'] : "/"); |
37 |
if(is_file($path))
|
|
41 |
if (is_file($path)) {
|
|
38 | 42 |
$path = dirname($path); |
43 |
} |
|
39 | 44 |
|
40 | 45 |
// ----- header ----- |
41 | 46 |
?> |
... | ... | |
54 | 59 |
<?php |
55 | 60 |
|
56 | 61 |
// ----- read contents ----- |
57 |
if(is_dir($path)) { |
|
62 |
if (is_dir($path)) {
|
|
58 | 63 |
list($dirs, $files) = get_content($path); |
59 | 64 |
?> |
60 |
|
|
65 |
|
|
61 | 66 |
</td> |
62 | 67 |
</tr> |
63 | 68 |
<?php |
64 |
} |
|
65 |
else { |
|
69 |
} else { |
|
66 | 70 |
?> |
67 | 71 |
Directory does not exist. |
68 | 72 |
</td> |
... | ... | |
73 | 77 |
} |
74 | 78 |
|
75 | 79 |
// ----- directories ----- |
76 |
foreach($dirs as $dir): |
|
80 |
foreach ($dirs as $dir):
|
|
77 | 81 |
$realDir = realpath("{$path}/{$dir}"); |
78 | 82 |
?> |
79 | 83 |
<tr> |
... | ... | |
90 | 94 |
endforeach; |
91 | 95 |
|
92 | 96 |
// ----- files ----- |
93 |
foreach($files as $file): |
|
97 |
foreach ($files as $file):
|
|
94 | 98 |
$ext = strrchr($file, "."); |
95 | 99 |
|
96 | 100 |
switch ($ext) { |
97 |
case ".css":
|
|
98 |
case ".html":
|
|
99 |
case ".xml":
|
|
100 |
$type = "code"; |
|
101 |
break; |
|
102 |
case ".rrd":
|
|
103 |
$type = "database"; |
|
104 |
break; |
|
105 |
case ".gif":
|
|
106 |
case ".jpg":
|
|
107 |
case ".png":
|
|
108 |
$type = "image"; |
|
109 |
break; |
|
110 |
case ".js":
|
|
111 |
$type = "js";
|
|
112 |
break; |
|
113 |
case ".pdf":
|
|
114 |
$type = "pdf"; |
|
115 |
break; |
|
116 |
case ".inc":
|
|
117 |
case ".php":
|
|
118 |
$type = "php"; |
|
119 |
break; |
|
120 |
case ".conf":
|
|
121 |
case ".pid":
|
|
122 |
case ".sh":
|
|
123 |
$type = "system"; |
|
124 |
break; |
|
125 |
case ".bz2":
|
|
126 |
case ".gz":
|
|
127 |
case ".tgz":
|
|
128 |
case ".zip":
|
|
129 |
$type = "zip"; |
|
130 |
break; |
|
131 |
default:
|
|
132 |
$type = "generic"; |
|
101 |
case ".css":
|
|
102 |
case ".html":
|
|
103 |
case ".xml":
|
|
104 |
$type = "code";
|
|
105 |
break;
|
|
106 |
case ".rrd":
|
|
107 |
$type = "database";
|
|
108 |
break;
|
|
109 |
case ".gif":
|
|
110 |
case ".jpg":
|
|
111 |
case ".png":
|
|
112 |
$type = "image";
|
|
113 |
break;
|
|
114 |
case ".js":
|
|
115 |
$type = "js";
|
|
116 |
break;
|
|
117 |
case ".pdf":
|
|
118 |
$type = "pdf";
|
|
119 |
break;
|
|
120 |
case ".inc":
|
|
121 |
case ".php":
|
|
122 |
$type = "php";
|
|
123 |
break;
|
|
124 |
case ".conf":
|
|
125 |
case ".pid":
|
|
126 |
case ".sh":
|
|
127 |
$type = "system";
|
|
128 |
break;
|
|
129 |
case ".bz2":
|
|
130 |
case ".gz":
|
|
131 |
case ".tgz":
|
|
132 |
case ".zip":
|
|
133 |
$type = "zip";
|
|
134 |
break;
|
|
135 |
default:
|
|
136 |
$type = "generic";
|
|
133 | 137 |
} |
134 | 138 |
|
135 | 139 |
$fqpn = "{$path}/{$file}"; |
136 | 140 |
|
137 |
if(is_file($fqpn)) { |
|
141 |
if (is_file($fqpn)) {
|
|
138 | 142 |
$fqpn = realpath($fqpn); |
139 | 143 |
$size = sprintf("%.2f KiB", filesize($fqpn) / 1024); |
140 |
} |
|
141 |
else |
|
144 |
} else { |
|
142 | 145 |
$size = ""; |
146 |
} |
|
143 | 147 |
|
144 | 148 |
?> |
145 | 149 |
<tr> |
usr/local/www/includes/functions.inc.php | ||
---|---|---|
5 | 5 |
Copyright (C) 2013-2015 Electric Sheep Fencing, LP |
6 | 6 |
*/ |
7 | 7 |
|
8 |
if(Connection_Aborted()) { |
|
8 |
if (Connection_Aborted()) {
|
|
9 | 9 |
exit; |
10 | 10 |
} |
11 | 11 |
|
... | ... | |
37 | 37 |
$gateways_status = return_gateways_status(true); |
38 | 38 |
$data = ""; |
39 | 39 |
$isfirst = true; |
40 |
foreach($a_gateways as $gname => $gw) { |
|
41 |
if(!$isfirst)
|
|
40 |
foreach ($a_gateways as $gname => $gw) {
|
|
41 |
if (!$isfirst) {
|
|
42 | 42 |
$data .= ","; |
43 |
} |
|
43 | 44 |
$isfirst = false; |
44 | 45 |
$data .= $gw['name'] . ","; |
45 | 46 |
if ($gateways_status[$gname]) { |
46 | 47 |
$data .= "<b>" . lookup_gateway_ip_by_name($gname) . "</b>,"; |
47 | 48 |
$gws = $gateways_status[$gname]; |
48 |
switch(strtolower($gws['status'])) { |
|
49 |
case "none": |
|
50 |
$online = "Online"; |
|
51 |
$bgcolor = "#90EE90"; // lightgreen |
|
52 |
break; |
|
53 |
case "down": |
|
54 |
$online = "Offline"; |
|
55 |
$bgcolor = "#F08080"; // lightcoral |
|
56 |
break; |
|
57 |
case "delay": |
|
58 |
$online = "Latency"; |
|
59 |
$bgcolor = "#F0E68C"; // khaki |
|
60 |
break; |
|
61 |
case "loss": |
|
62 |
$online = "Packetloss"; |
|
63 |
$bgcolor = "#F0E68C"; // khaki |
|
64 |
break; |
|
65 |
default: |
|
66 |
$online = "Pending"; |
|
67 |
break; |
|
49 |
switch (strtolower($gws['status'])) {
|
|
50 |
case "none":
|
|
51 |
$online = "Online";
|
|
52 |
$bgcolor = "#90EE90"; // lightgreen
|
|
53 |
break;
|
|
54 |
case "down":
|
|
55 |
$online = "Offline";
|
|
56 |
$bgcolor = "#F08080"; // lightcoral
|
|
57 |
break;
|
|
58 |
case "delay":
|
|
59 |
$online = "Latency";
|
|
60 |
$bgcolor = "#F0E68C"; // khaki
|
|
61 |
break;
|
|
62 |
case "loss":
|
|
63 |
$online = "Packetloss";
|
|
64 |
$bgcolor = "#F0E68C"; // khaki
|
|
65 |
break;
|
|
66 |
default:
|
|
67 |
$online = "Pending";
|
|
68 |
break;
|
|
68 | 69 |
} |
69 | 70 |
} else { |
70 | 71 |
$data .= "~,"; |
... | ... | |
82 | 83 |
function get_uptime() { |
83 | 84 |
$uptime = get_uptime_sec(); |
84 | 85 |
|
85 |
if(intval($uptime) == 0)
|
|
86 |
if (intval($uptime) == 0) {
|
|
86 | 87 |
return; |
88 |
} |
|
87 | 89 |
|
88 | 90 |
$updays = (int)($uptime / 86400); |
89 | 91 |
$uptime %= 86400; |
... | ... | |
94 | 96 |
$upsecs = (int)($uptime); |
95 | 97 |
|
96 | 98 |
$uptimestr = ""; |
97 |
if ($updays > 1) |
|
99 |
if ($updays > 1) {
|
|
98 | 100 |
$uptimestr .= "$updays Days "; |
99 |
else if ($updays > 0)
|
|
101 |
} else if ($updays > 0) {
|
|
100 | 102 |
$uptimestr .= "1 Day "; |
103 |
} |
|
101 | 104 |
|
102 |
if ($uphours > 1) |
|
105 |
if ($uphours > 1) {
|
|
103 | 106 |
$hours = "s"; |
107 |
} |
|
104 | 108 |
|
105 |
if ($upmins > 1) |
|
109 |
if ($upmins > 1) {
|
|
106 | 110 |
$minutes = "s"; |
111 |
} |
|
107 | 112 |
|
108 |
if ($upmins > 1) |
|
113 |
if ($upmins > 1) {
|
|
109 | 114 |
$seconds = "s"; |
115 |
} |
|
110 | 116 |
|
111 | 117 |
$uptimestr .= sprintf("%02d Hour$hours %02d Minute$minutes %02d Second$seconds", $uphours, $upmins, $upsecs); |
112 | 118 |
return $uptimestr; |
... | ... | |
124 | 130 |
$totalEnd = array_sum($cpuTicks2); |
125 | 131 |
|
126 | 132 |
// Something wrapped ?!?! |
127 |
if ($totalEnd <= $totalStart) |
|
133 |
if ($totalEnd <= $totalStart) {
|
|
128 | 134 |
return 0; |
135 |
} |
|
129 | 136 |
|
130 | 137 |
// Calculate total cycles used |
131 | 138 |
$totalUsed = ($totalEnd - $totalStart) - ($cpuTicks2['idle'] - $cpuTicks['idle']); |
... | ... | |
139 | 146 |
function get_pfstate($percent=false) { |
140 | 147 |
global $config; |
141 | 148 |
$matches = ""; |
142 |
if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) |
|
149 |
if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) {
|
|
143 | 150 |
$maxstates="{$config['system']['maximumstates']}"; |
144 |
else
|
|
151 |
} else {
|
|
145 | 152 |
$maxstates=pfsense_default_state_size(); |
153 |
} |
|
146 | 154 |
$curentries = `/sbin/pfctl -si |grep current`; |
147 | 155 |
if (preg_match("/([0-9]+)/", $curentries, $matches)) { |
148 | 156 |
$curentries = $matches[1]; |
149 | 157 |
} |
150 |
if (!is_numeric($curentries)) |
|
158 |
if (!is_numeric($curentries)) {
|
|
151 | 159 |
$curentries = 0; |
152 |
if ($percent) |
|
153 |
if (intval($maxstates) > 0) |
|
160 |
} |
|
161 |
if ($percent) { |
|
162 |
if (intval($maxstates) > 0) { |
|
154 | 163 |
return round(($curentries / $maxstates) * 100, 0); |
155 |
else
|
|
164 |
} else {
|
|
156 | 165 |
return "NA"; |
157 |
else |
|
166 |
} |
|
167 |
} else { |
|
158 | 168 |
return $curentries . "/" . $maxstates; |
169 |
} |
|
159 | 170 |
} |
160 | 171 |
|
161 | 172 |
function has_temp() { |
... | ... | |
171 | 182 |
|
172 | 183 |
function get_mbuf($percent=false) { |
173 | 184 |
$mbufs_output=trim(`/usr/bin/netstat -mb | /usr/bin/grep "mbuf clusters in use" | /usr/bin/awk '{ print $1 }'`); |
174 |
list( $mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max ) = explode( "/", $mbufs_output);
|
|
175 |
if ($percent) |
|
176 |
if ($mbufs_max > 0) |
|
185 |
list($mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max) = explode("/", $mbufs_output);
|
|
186 |
if ($percent) {
|
|
187 |
if ($mbufs_max > 0) {
|
|
177 | 188 |
return round(($mbufs_total / $mbufs_max) * 100, 0); |
178 |
else
|
|
189 |
} else {
|
|
179 | 190 |
return "NA"; |
180 |
else |
|
191 |
} |
|
192 |
} else { |
|
181 | 193 |
return "{$mbufs_total}/{$mbufs_max}"; |
194 |
} |
|
182 | 195 |
} |
183 | 196 |
|
184 | 197 |
function get_temp() { |
185 | 198 |
$temp_out = get_single_sysctl("dev.cpu.0.temperature"); |
186 |
if ($temp_out == "") |
|
199 |
if ($temp_out == "") {
|
|
187 | 200 |
$temp_out = get_single_sysctl("hw.acpi.thermal.tz0.temperature"); |
201 |
} |
|
188 | 202 |
|
189 | 203 |
// Remove 'C' from the end |
190 | 204 |
return rtrim($temp_out, 'C'); |
... | ... | |
221 | 235 |
function swap_usage() { |
222 | 236 |
exec("/usr/sbin/swapinfo", $swap_info); |
223 | 237 |
$swap_used = ""; |
224 |
foreach ($swap_info as $line) |
|
238 |
foreach ($swap_info as $line) {
|
|
225 | 239 |
if (preg_match('/(\d+)%$/', $line, $matches)) { |
226 | 240 |
$swap_used = $matches[1]; |
227 | 241 |
break; |
228 | 242 |
} |
243 |
} |
|
229 | 244 |
|
230 | 245 |
return $swap_used; |
231 | 246 |
} |
... | ... | |
238 | 253 |
$freeMem = get_single_sysctl("vm.stats.vm.v_free_count"); |
239 | 254 |
$usedMem = $totalMem - ($inactiveMem + $cachedMem + $freeMem); |
240 | 255 |
$memUsage = round(($usedMem * 100) / $totalMem, 0); |
241 |
} else |
|
256 |
} else {
|
|
242 | 257 |
$memUsage = "NA"; |
258 |
} |
|
243 | 259 |
|
244 | 260 |
return $memUsage; |
245 | 261 |
} |
... | ... | |
257 | 273 |
$maxfreq = $maxfreq[0]; |
258 | 274 |
$curfreq = ""; |
259 | 275 |
$curfreq = get_single_sysctl('dev.cpu.0.freq'); |
260 |
if (($curfreq > 0) && ($curfreq != $maxfreq)) |
|
276 |
if (($curfreq > 0) && ($curfreq != $maxfreq)) {
|
|
261 | 277 |
$out = "Current: {$curfreq} MHz, Max: {$maxfreq} MHz"; |
278 |
} |
|
262 | 279 |
return $out; |
263 | 280 |
} |
264 | 281 |
|
... | ... | |
295 | 312 |
$new_data = ""; |
296 | 313 |
|
297 | 314 |
//build data arrays |
298 |
foreach ($ifdescrs as $ifdescr => $ifname){ |
|
315 |
foreach ($ifdescrs as $ifdescr => $ifname) {
|
|
299 | 316 |
$ifinfo = get_interface_info($ifdescr); |
300 |
$new_data .= "{$ifinfo['inpkts']},";
|
|
301 |
$new_data .= "{$ifinfo['outpkts']},";
|
|
302 |
$new_data .= format_bytes($ifinfo['inbytes']) . ",";
|
|
303 |
$new_data .= format_bytes($ifinfo['outbytes']) . ",";
|
|
304 |
if (isset($ifinfo['inerrs'])){
|
|
305 |
$new_data .= "{$ifinfo['inerrs']},";
|
|
306 |
$new_data .= "{$ifinfo['outerrs']},";
|
|
307 |
}
|
|
308 |
else{
|
|
309 |
$new_data .= "0,";
|
|
310 |
$new_data .= "0,";
|
|
311 |
}
|
|
312 |
if (isset($ifinfo['collisions']))
|
|
313 |
$new_data .= htmlspecialchars($ifinfo['collisions']) . ",";
|
|
314 |
else
|
|
315 |
$new_data .= "0,";
|
|
317 |
$new_data .= "{$ifinfo['inpkts']},"; |
|
318 |
$new_data .= "{$ifinfo['outpkts']},"; |
|
319 |
$new_data .= format_bytes($ifinfo['inbytes']) . ","; |
|
320 |
$new_data .= format_bytes($ifinfo['outbytes']) . ","; |
|
321 |
if (isset($ifinfo['inerrs'])) {
|
|
322 |
$new_data .= "{$ifinfo['inerrs']},"; |
|
323 |
$new_data .= "{$ifinfo['outerrs']},"; |
|
324 |
} else {
|
|
325 |
$new_data .= "0,";
|
|
326 |
$new_data .= "0,"; |
|
327 |
}
|
|
328 |
if (isset($ifinfo['collisions'])) {
|
|
329 |
$new_data .= htmlspecialchars($ifinfo['collisions']) . ",";
|
|
330 |
} else {
|
|
331 |
$new_data .= "0,";
|
|
332 |
}
|
|
316 | 333 |
}//end for |
317 | 334 |
|
318 | 335 |
return $new_data; |
... | ... | |
325 | 342 |
//build interface list for widget use |
326 | 343 |
$ifdescrs = get_configured_interface_with_descr(); |
327 | 344 |
|
328 |
foreach ($ifdescrs as $ifdescr => $ifname){ |
|
345 |
foreach ($ifdescrs as $ifdescr => $ifname) {
|
|
329 | 346 |
$ifinfo = get_interface_info($ifdescr); |
330 | 347 |
$data .= $ifname . ","; |
331 |
if($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") { |
|
348 |
if ($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
|
|
332 | 349 |
$data .= "up"; |
333 |
}else if ($ifinfo['status'] == "no carrier") { |
|
350 |
} else if ($ifinfo['status'] == "no carrier") {
|
|
334 | 351 |
$data .= "down"; |
335 |
}else if ($ifinfo['status'] == "down") { |
|
352 |
} else if ($ifinfo['status'] == "down") {
|
|
336 | 353 |
$data .= "block"; |
337 | 354 |
} |
338 | 355 |
$data .= ","; |
339 |
if ($ifinfo['ipaddr']) |
|
356 |
if ($ifinfo['ipaddr']) {
|
|
340 | 357 |
$data .= "<strong>" . htmlspecialchars($ifinfo['ipaddr']) . "</strong>"; |
358 |
} |
|
341 | 359 |
$data .= ","; |
342 |
if ($ifinfo['ipaddrv6']) |
|
360 |
if ($ifinfo['ipaddrv6']) {
|
|
343 | 361 |
$data .= "<strong>" . htmlspecialchars($ifinfo['ipaddrv6']) . "</strong>"; |
362 |
} |
|
344 | 363 |
$data .= ","; |
345 |
if ($ifinfo['status'] != "down") |
|
364 |
if ($ifinfo['status'] != "down") {
|
|
346 | 365 |
$data .= htmlspecialchars($ifinfo['media']); |
366 |
} |
|
347 | 367 |
|
348 | 368 |
$data .= "~"; |
349 | 369 |
|
usr/local/www/installer/installer.php | ||
---|---|---|
35 | 35 |
|
36 | 36 |
define('PC_SYSINSTALL', '/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh'); |
37 | 37 |
|
38 |
if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { |
|
38 |
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
|
|
39 | 39 |
header("Location: /"); |
40 | 40 |
exit; |
41 | 41 |
} |
... | ... | |
63 | 63 |
exit; |
64 | 64 |
|
65 | 65 |
default: |
66 |
installer_main();
|
|
66 |
installer_main(); |
|
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
function easy_install($fstype = "UFS+S") { |
... | ... | |
102 | 102 |
function write_out_pc_sysinstaller_config($disks, $bootmanager = "bsd") { |
103 | 103 |
$diskareas = ""; |
104 | 104 |
$fd = fopen("/usr/sbin/pc-sysinstall/examples/pfSense-install.cfg", "w"); |
105 |
if(!$fd)
|
|
105 |
if (!$fd) {
|
|
106 | 106 |
return true; |
107 |
if($bootmanager == "") |
|
108 |
$bootmanager = "none"; |
|
107 |
} |
|
108 |
if ($bootmanager == "") { |
|
109 |
$bootmanager = "none"; |
|
110 |
} |
|
109 | 111 |
// Yes, -1. We ++ early in loop. |
110 | 112 |
$numdisks = -1; |
111 | 113 |
$lastdisk = ""; |
112 | 114 |
$diskdefs = ""; |
113 | 115 |
// Run through the disks and create the conf areas for pc-sysinstaller |
114 |
foreach($disks as $disksa) { |
|
116 |
foreach ($disks as $disksa) {
|
|
115 | 117 |
$fstype = $disksa['fstype']; |
116 | 118 |
$size = $disksa['size']; |
117 | 119 |
$mountpoint = $disksa['mountpoint']; |
118 | 120 |
$disk = $disksa['disk']; |
119 |
if($disk <> $lastdisk) { |
|
121 |
if ($disk <> $lastdisk) {
|
|
120 | 122 |
$lastdisk = $disk; |
121 | 123 |
$numdisks++; |
122 | 124 |
$diskdefs .= "# disk {$disk}\n"; |
... | ... | |
126 | 128 |
$diskdefs .= "commitDiskPart\n\n"; |
127 | 129 |
} |
128 | 130 |
$diskareas .= "disk{$numdisks}-part={$fstype} {$size} {$mountpoint} \n"; |
129 |
if($encpass)
|
|
131 |
if ($encpass) {
|
|
130 | 132 |
$diskareas .= "encpass={$encpass}\n"; |
133 |
} |
|
131 | 134 |
} |
132 |
|
|
135 |
|
|
133 | 136 |
$config = <<<EOF |
134 | 137 |
# Sample configuration file for an installation using pc-sysinstall |
135 | 138 |
# This file was automatically generated by installer.php |
136 |
|
|
139 |
|
|
137 | 140 |
installMode=fresh |
138 | 141 |
installInteractive=yes |
139 | 142 |
installType=FreeBSD |
... | ... | |
148 | 151 |
# Size 0 means use the rest of the slice size |
149 | 152 |
# Alternatively, you can append .eli to any of |
150 | 153 |
# the above filesystem types to encrypt that disk. |
151 |
# If you with to use a passphrase with this
|
|
152 |
# encrypted partition, on the next line
|
|
154 |
# If you with to use a passphrase with this |
|
155 |
# encrypted partition, on the next line |
|
153 | 156 |
# the flag "encpass=" should be entered: |
154 | 157 |
# encpass=mypass |
155 | 158 |
# disk0-part=UFS 500 /boot |
... | ... | |
177 | 180 |
|
178 | 181 |
function start_installation() { |
179 | 182 |
global $g, $fstype, $savemsg; |
180 |
if(file_exists("/tmp/install_complete"))
|
|
183 |
if (file_exists("/tmp/install_complete")) {
|
|
181 | 184 |
return; |
185 |
} |
|
182 | 186 |
$ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'"); |
183 |
if($ps_running)
|
|
187 |
if ($ps_running) {
|
|
184 | 188 |
return; |
189 |
} |
|
185 | 190 |
$fd = fopen("/tmp/installer.sh", "w"); |
186 |
if(!$fd) { |
|
191 |
if (!$fd) {
|
|
187 | 192 |
die(gettext("Could not open /tmp/installer.sh for writing")); |
188 | 193 |
exit; |
189 | 194 |
} |
... | ... | |
208 | 213 |
global $g, $fstype, $savemsg; |
209 | 214 |
$disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`); |
210 | 215 |
$disks_array = array(); |
211 |
foreach($disk as $d) { |
|
216 |
foreach ($disk as $d) {
|
|
212 | 217 |
$disks_info = explode(":", $d); |
213 | 218 |
$tmp_array = array(); |
214 |
if($disks_info[0] == $diskname) { |
|
219 |
if ($disks_info[0] == $diskname) {
|
|
215 | 220 |
$disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`); |
216 | 221 |
$disk_info_split = explode("=", $disk_info); |
217 |
foreach($disk_info as $di) {
|
|
222 |
foreach ($disk_info as $di) {
|
|
218 | 223 |
$di_s = explode("=", $di); |
219 |
if($di_s[0])
|
|
224 |
if ($di_s[0]) {
|
|
220 | 225 |
$tmp_array[$di_s[0]] = $di_s[1]; |
226 |
} |
|
221 | 227 |
} |
222 | 228 |
$tmp_array['size']--; |
223 | 229 |
$tmp_array['disk'] = trim($disks_info[0]); |
... | ... | |
232 | 238 |
global $g, $fstype, $savemsg; |
233 | 239 |
$disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`); |
234 | 240 |
$disks_array = array(); |
235 |
foreach($disk as $d) { |
|
236 |
if(!$d)
|
|
241 |
foreach ($disk as $d) {
|
|
242 |
if (!$d) {
|
|
237 | 243 |
continue; |
244 |
} |
|
238 | 245 |
$disks_info = explode(":", $d); |
239 | 246 |
$tmp_array = array(); |
240 | 247 |
$disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`); |
241 |
foreach($disk_info as $di) {
|
|
248 |
foreach ($disk_info as $di) {
|
|
242 | 249 |
$di_s = explode("=", $di); |
243 |
if($di_s[0])
|
|
250 |
if ($di_s[0]) {
|
|
244 | 251 |
$tmp_array[$di_s[0]] = $di_s[1]; |
252 |
} |
|
245 | 253 |
} |
246 | 254 |
$tmp_array['size']--; |
247 | 255 |
$tmp_array['disk'] = trim($disks_info[0]); |
... | ... | |
254 | 262 |
function update_installer_status() { |
255 | 263 |
global $g, $fstype, $savemsg; |
256 | 264 |
// Ensure status files exist |
257 |
if(!file_exists("/tmp/installer_installer_running"))
|
|
265 |
if (!file_exists("/tmp/installer_installer_running")) {
|
|
258 | 266 |
touch("/tmp/installer_installer_running"); |
267 |
} |
|
259 | 268 |
$status = `cat /tmp/.pc-sysinstall/pc-sysinstall.log`; |
260 | 269 |
$status = str_replace("\n", "\\n", $status); |
261 | 270 |
$status = str_replace("\n", "\\r", $status); |
262 | 271 |
$status = str_replace("'", "\\'", $status); |
263 | 272 |
echo "document.forms[0].installeroutput.value='$status';\n"; |
264 |
echo "document.forms[0].installeroutput.scrollTop = document.forms[0].installeroutput.scrollHeight;\n";
|
|
273 |
echo "document.forms[0].installeroutput.scrollTop = document.forms[0].installeroutput.scrollHeight;\n"; |
|
265 | 274 |
// Find out installer progress |
266 | 275 |
$progress = "5"; |
267 |
if(strstr($status, "Running: dd"))
|
|
276 |
if (strstr($status, "Running: dd")) {
|
|
268 | 277 |
$progress = "6"; |
269 |
if(strstr($status, "Running: gpart create -s GPT")) |
|
278 |
} |
|
279 |
if (strstr($status, "Running: gpart create -s GPT")) { |
|
270 | 280 |
$progress = "7"; |
271 |
if(strstr($status, "Running: gpart bootcode")) |
|
281 |
} |
|
282 |
if (strstr($status, "Running: gpart bootcode")) { |
|
272 | 283 |
$progress = "7"; |
273 |
if(strstr($status, "Running: newfs -U")) |
|
284 |
} |
|
285 |
if (strstr($status, "Running: newfs -U")) { |
|
274 | 286 |
$progress = "8"; |
275 |
if(strstr($status, "Running: sync")) |
|
287 |
} |
|
288 |
if (strstr($status, "Running: sync")) { |
|
276 | 289 |
$progress = "9"; |
277 |
if(strstr($status, "/boot /mnt/boot")) |
|
290 |
} |
|
291 |
if (strstr($status, "/boot /mnt/boot")) { |
|
278 | 292 |
$progress = "10"; |
279 |
if(strstr($status, "/COPYRIGHT /mnt/COPYRIGHT")) |
|
293 |
} |
|
294 |
if (strstr($status, "/COPYRIGHT /mnt/COPYRIGHT")) { |
|
280 | 295 |
$progress = "11"; |
281 |
if(strstr($status, "/bin /mnt/bin")) |
|
296 |
} |
|
297 |
if (strstr($status, "/bin /mnt/bin")) { |
|
282 | 298 |
$progress = "12"; |
283 |
if(strstr($status, "/conf /mnt/conf")) |
|
299 |
} |
|
300 |
if (strstr($status, "/conf /mnt/conf")) { |
|
284 | 301 |
$progress = "15"; |
285 |
if(strstr($status, "/conf.default /mnt/conf.default")) |
|
302 |
} |
|
303 |
if (strstr($status, "/conf.default /mnt/conf.default")) { |
|
286 | 304 |
$progress = "20"; |
287 |
if(strstr($status, "/dev /mnt/dev")) |
|
305 |
} |
|
306 |
if (strstr($status, "/dev /mnt/dev")) { |
|
288 | 307 |
$progress = "25"; |
289 |
if(strstr($status, "/etc /mnt/etc")) |
|
308 |
} |
|
309 |
if (strstr($status, "/etc /mnt/etc")) { |
|
290 | 310 |
$progress = "30"; |
291 |
if(strstr($status, "/home /mnt/home")) |
|
311 |
} |
|
312 |
if (strstr($status, "/home /mnt/home")) { |
|
292 | 313 |
$progress = "35"; |
293 |
if(strstr($status, "/kernels /mnt/kernels")) |
|
314 |
} |
|
315 |
if (strstr($status, "/kernels /mnt/kernels")) { |
|
294 | 316 |
$progress = "40"; |
295 |
if(strstr($status, "/libexec /mnt/libexec")) |
|
317 |
} |
|
318 |
if (strstr($status, "/libexec /mnt/libexec")) { |
|
296 | 319 |
$progress = "50"; |
297 |
if(strstr($status, "/lib /mnt/lib")) |
|
320 |
} |
|
321 |
if (strstr($status, "/lib /mnt/lib")) { |
|
298 | 322 |
$progress = "60"; |
299 |
if(strstr($status, "/root /mnt/root")) |
|
323 |
} |
|
324 |
if (strstr($status, "/root /mnt/root")) { |
|
300 | 325 |
$progress = "70"; |
301 |
if(strstr($status, "/sbin /mnt/sbin")) |
|
326 |
} |
|
327 |
if (strstr($status, "/sbin /mnt/sbin")) { |
|
302 | 328 |
$progress = "75"; |
303 |
if(strstr($status, "/sys /mnt/sys")) |
|
329 |
} |
|
330 |
if (strstr($status, "/sys /mnt/sys")) { |
|
304 | 331 |
$progress = "80"; |
305 |
if(strstr($status, "/usr /mnt/usr")) |
|
332 |
} |
|
333 |
if (strstr($status, "/usr /mnt/usr")) { |
|
306 | 334 |
$progress = "95"; |
307 |
if(strstr($status, "/usr /mnt/usr")) |
|
335 |
} |
|
336 |
if (strstr($status, "/usr /mnt/usr")) { |
|
308 | 337 |
$progress = "90"; |
309 |
if(strstr($status, "/var /mnt/var")) |
|
338 |
} |
|
339 |
if (strstr($status, "/var /mnt/var")) { |
|
310 | 340 |
$progress = "95"; |
311 |
if(strstr($status, "cap_mkdb /etc/login.conf")) |
|
341 |
} |
|
342 |
if (strstr($status, "cap_mkdb /etc/login.conf")) { |
|
312 | 343 |
$progress = "96"; |
313 |
if(strstr($status, "Setting hostname")) |
|
344 |
} |
|
345 |
if (strstr($status, "Setting hostname")) { |
|
314 | 346 |
$progress = "97"; |
315 |
if(strstr($status, "umount -f /mnt")) |
|
347 |
} |
|
348 |
if (strstr($status, "umount -f /mnt")) { |
|
316 | 349 |
$progress = "98"; |
317 |
if(strstr($status, "umount -f /mnt")) |
|
350 |
} |
|
351 |
if (strstr($status, "umount -f /mnt")) { |
|
318 | 352 |
$progress = "99"; |
319 |
if(strstr($status, "Installation finished")) |
|
353 |
} |
|
354 |
if (strstr($status, "Installation finished")) { |
|
320 | 355 |
$progress = "100"; |
356 |
} |
|
321 | 357 |
// Check for error and bail if we see one. |
322 |
if(stristr($status, "error")) { |
|
358 |
if (stristr($status, "error")) {
|
|
323 | 359 |
$error = true; |
324 | 360 |
echo "\$('#installerrunning').html('<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"2\"><b>An error occurred. Aborting installation. <a href=\"/installer\">Back</a> to webInstaller'); "; |
325 | 361 |
echo "\$('#progressbar').css('width','100%');\n"; |
... | ... | |
327 | 363 |
return; |
328 | 364 |
} |
329 | 365 |
$running_old = trim(file_get_contents("/tmp/installer_installer_running")); |
330 |
if($installer_running <> "running") { |
|
366 |
if ($installer_running <> "running") {
|
|
331 | 367 |
$ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'"); |
332 |
if($ps_running) { |
|
368 |
if ($ps_running) {
|
|
333 | 369 |
$running = "\$('#installerrunning').html('<table><tr><td valign=\"middle\"><img src=\"/themes/{$g['theme']}/images/misc/loader.gif\"></td><td valign=\"middle\"> <font size=\"2\"><b>Installer running ({$progress}% completed)...</td></tr></table>'); "; |
334 |
if($running_old <> $running) { |
|
370 |
if ($running_old <> $running) {
|
|
335 | 371 |
echo $running; |
336 |
file_put_contents("/tmp/installer_installer_running", "$running");
|
|
372 |
file_put_contents("/tmp/installer_installer_running", "$running"); |
|
337 | 373 |
} |
338 | 374 |
} |
339 | 375 |
} |
340 |
if($progress)
|
|
376 |
if ($progress) {
|
|
341 | 377 |
echo "\$('#progressbar').css('width','{$progress}%');\n"; |
342 |
if(file_exists("/tmp/install_complete")) { |
|
378 |
} |
|
379 |
if (file_exists("/tmp/install_complete")) { |
|
343 | 380 |
echo "\$('#installerrunning').html('<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"+1\">Installation completed. Please <a href=\"/reboot.php\">reboot</a> to continue');\n"; |
344 | 381 |
echo "\$('#pbdiv').fadeOut();\n"; |
345 | 382 |
unlink_if_exists("/tmp/installer.sh"); |
... | ... | |
356 | 393 |
|
357 | 394 |
function begin_install() { |
358 | 395 |
global $g, $savemsg; |
359 |
if(file_exists("/tmp/install_complete"))
|
|
396 |
if (file_exists("/tmp/install_complete")) {
|
|
360 | 397 |
return; |
398 |
} |
|
361 | 399 |
unlink_if_exists("/tmp/install_complete"); |
362 | 400 |
update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."),$disk)); |
363 | 401 |
start_installation(); |
... | ... | |
377 | 415 |
width: 100%; |
378 | 416 |
text-align: left; |
379 | 417 |
} |
380 |
a:link {
|
|
418 |
a:link { |
|
381 | 419 |
color: #000000; |
382 | 420 |
text-decoration:underline; |
383 | 421 |
font-size:14; |
384 | 422 |
} |
385 |
a:visited {
|
|
423 |
a:visited { |
|
386 | 424 |
color: #000000; |
387 | 425 |
text-decoration:underline; |
388 | 426 |
font-size:14; |
389 | 427 |
} |
390 |
a:hover {
|
|
428 |
a:hover { |
|
391 | 429 |
color: #FFFF00; |
392 | 430 |
text-decoration: none; |
393 | 431 |
font-size:14; |
394 | 432 |
} |
395 |
a:active {
|
|
433 |
a:active { |
|
396 | 434 |
color: #FFFF00; |
397 | 435 |
text-decoration:underline; |
398 | 436 |
font-size:14; |
... | ... | |
434 | 472 |
</script> |
435 | 473 |
EOF; |
436 | 474 |
|
437 |
if($one_two)
|
|
475 |
if ($one_two) {
|
|
438 | 476 |
echo "<p class=\"pgtitle\">{$pgtitle}</font></p>"; |
477 |
} |
|
439 | 478 |
|
440 |
if ($savemsg) print_info_box($savemsg); |
|
479 |
if ($savemsg) { |
|
480 |
print_info_box($savemsg); |
|
481 |
} |
|
441 | 482 |
} |
442 | 483 |
|
443 | 484 |
function end_html() { |
... | ... | |
454 | 495 |
echo <<<EOF |
455 | 496 |
<div id="mainlevel"> |
456 | 497 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
457 |
<tr>
|
|
458 |
<td>
|
|
498 |
<tr> |
|
499 |
<td>
|
|
459 | 500 |
<div id="mainarea"> |
460 | 501 |
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> |
461 | 502 |
<tr> |
462 |
<td class="tabcont" >
|
|
463 |
<form action="installer.php" method="post">
|
|
503 |
<td class="tabcont" >
|
|
504 |
<form action="installer.php" method="post">
|
|
464 | 505 |
<div id="pfsensetemplate"> |
465 | 506 |
|
466 | 507 |
|
467 | 508 |
</div> |
468 |
</td>
|
|
509 |
</td>
|
|
469 | 510 |
</tr> |
470 | 511 |
</table> |
471 | 512 |
</div> |
... | ... | |
487 | 528 |
page_table_start($g['product_name'] . " installer - Verify final installation settings"); |
488 | 529 |
// If we are visiting this step from anything but the row editor / custom install |
489 | 530 |
// then load the on disk layout contents if they are available. |
490 |
if(!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) { |
|
531 |
if (!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) {
|
|
491 | 532 |
$disks = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt")); |
492 | 533 |
$bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt")); |
493 | 534 |
$restored_layout_from_file = true; |
... | ... | |
495 | 536 |
} else { |
496 | 537 |
$disks = array(); |
497 | 538 |
} |
498 |
if(!$bootmanager)
|
|
539 |
if (!$bootmanager) {
|
|
499 | 540 |
$bootmanager = $_REQUEST['bootmanager']; |
541 |
} |
|
500 | 542 |
// echo "\n<!--" . print_r($_REQUEST, true) . " -->\n"; |
501 | 543 |
$disk = pcsysinstall_get_disk_info(htmlspecialchars($_REQUEST['disk'])); |
502 | 544 |
$disksize = format_bytes($disk['size'] * 1048576); |
503 | 545 |
// Loop through posted items and create an array |
504 |
for($x=0; $x<99; $x++) { // XXX: Make this more optimal |
|
505 |
if(!$_REQUEST['fstype' . $x])
|
|
546 |
for ($x=0; $x<99; $x++) { // XXX: Make this more optimal
|
|
547 |
if (!$_REQUEST['fstype' . $x]) {
|
|
506 | 548 |
continue; |
549 |
} |
|
507 | 550 |
$tmparray = array(); |
508 |
if($_REQUEST['fstype' . $x] <> "SWAP") { |
|
551 |
if ($_REQUEST['fstype' . $x] <> "SWAP") {
|
|
509 | 552 |
$tmparray['mountpoint'] = $_REQUEST['mountpoint' . $x]; |
510 | 553 |
// Check for encrypted slice / |
511 |
if(stristr($_REQUEST['fstype' . $x], ".eli")) { |
|
512 |
if($tmparray['mountpoint'] == "/")
|
|
554 |
if (stristr($_REQUEST['fstype' . $x], ".eli")) {
|
|
555 |
if ($tmparray['mountpoint'] == "/") {
|
|
513 | 556 |
$encrypted_root = true; |
557 |
} |
|
514 | 558 |
} |
515 | 559 |
// Check if we have a non-encrypted /boot |
516 |
if($tmparray['mountpoint'] == "/boot") {
|
|
517 |
if(!stristr($_REQUEST['fstype' . $x], ".eli"))
|
|
560 |
if ($tmparray['mountpoint'] == "/boot") {
|
|
561 |
if (!stristr($_REQUEST['fstype' . $x], ".eli")) {
|
|
518 | 562 |
$non_encrypted_boot = true; |
563 |
} |
|
519 | 564 |
} |
520 |
if($tmparray['mountpoint'] == "/conf") {
|
|
565 |
if ($tmparray['mountpoint'] == "/conf") {
|
|
521 | 566 |
$tmparray['mountpoint'] = "/conf{$x}"; |
522 | 567 |
$error_txt[] = "/conf is not an allowed mount point and has been renamed to /conf{$x}."; |
523 | 568 |
} |
... | ... | |
525 | 570 |
$tmparray['mountpoint'] = "none"; |
526 | 571 |
} |
527 | 572 |
// If we have an encrypted /root and lack a non encrypted /boot, throw an error/warning |
528 |
if($encrypted_root && !$non_encrypted_boot && !$non_encrypted_notice) { |
|
573 |
if ($encrypted_root && !$non_encrypted_boot && !$non_encrypted_notice) {
|
|
529 | 574 |
$error_txt[] = "A non-encrypted /boot slice is required when encrypting the / slice"; |
530 | 575 |
$non_encrypted_notice = true; |
531 | 576 |
} |
... | ... | |
547 | 592 |
<input type="hidden" name="bootmanager" value="{$bootmanager}"> |
548 | 593 |
<div id="mainlevel"> |
549 | 594 |
<table width="800" border="0" cellpadding="0" cellspacing="0"> |
550 |
<tr>
|
|
551 |
<td>
|
|
595 |
<tr> |
|
596 |
<td>
|
|
552 | 597 |
<div id="mainarea"> |
553 | 598 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
554 | 599 |
<tr> |
555 |
<td >
|
|
600 |
<td >
|
|
556 | 601 |
<div> |
557 | 602 |
<center> |
558 | 603 |
<div id="pfsensetemplate"> |
... | ... | |
564 | 609 |
echo "<tr><td colspan=\"5\">"; |
565 | 610 |
print_input_errors($error_txt); |
566 | 611 |
echo "</td></tr>"; |
567 |
} else |
|
612 |
} else {
|
|
568 | 613 |
echo "<tr><td> </td></tr>"; |
614 |
} |
|
569 | 615 |
|
570 | 616 |
echo <<<EOFAMBACBAF |
571 | 617 |
|
... | ... | |
592 | 638 |
|
593 | 639 |
EOFAMBACBAF; |
594 | 640 |
|
595 |
foreach($disks as $disk) { |
|
641 |
foreach ($disks as $disk) {
|
|
596 | 642 |
$desc = pcsysinstall_get_disk_info($disk['disk']); |
597 | 643 |
echo "<tr>"; |
598 | 644 |
echo "<td> " . htmlspecialchars($disk['mountpoint']) . "</td>"; |
... | ... | |
609 | 655 |
</div> |
610 | 656 |
</center> |
611 | 657 |
</div> |
612 |
</td>
|
|
658 |
</td>
|
|
613 | 659 |
</tr> |
614 | 660 |
</table> |
615 | 661 |
</div> |
... | ... | |
617 | 663 |
<p/> |
618 | 664 |
<input type="button" value="Cancel" onClick="javascript:document.location='installer.php?state=custominstall';"> |
619 | 665 |
EOFAMB; |
620 |
if(!$error_txt) |
|
621 |
echo "<input type=\"submit\" value=\"Begin installation\"> <br /> "; |
|
666 |
if (!$error_txt) { |
|
667 |
echo "<input type=\"submit\" value=\"Begin installation\"> <br /> "; |
|
668 |
} |
|
622 | 669 |
echo <<<EOFAMBASDF |
623 | 670 |
|
624 | 671 |
</center> |
... | ... | |
649 | 696 |
<tr><td> |
650 | 697 |
<div id="mainlevel"> |
651 | 698 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
652 |
<tr>
|
|
653 |
<td>
|
|
699 |
<tr> |
|
700 |
<td>
|
|
654 | 701 |
<div id="mainarea"> |
655 | 702 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
656 | 703 |
<tr> |
657 |
<td>
|
|
704 |
<td>
|
|
658 | 705 |
<div id="pfsenseinstaller" width="100%"> |
659 | 706 |
<div id='installerrunning' width='100%' style="padding:8px; border:1px dashed #000000"> |
660 | 707 |
<table> |
... | ... | |
691 | 738 |
<textarea name='installeroutput' id='installeroutput' rows="31" cols="90"> |
692 | 739 |
</textarea> |
693 | 740 |
</div> |
694 |
</td>
|
|
741 |
</td>
|
|
695 | 742 |
</tr> |
696 | 743 |
</table> |
697 | 744 |
</div> |
... | ... | |
711 | 758 |
|
712 | 759 |
function page_table_start($pgtitle = "") { |
713 | 760 |
global $g, $fstype, $savemsg; |
714 |
if($pgtitle == "")
|
|
761 |
if ($pgtitle == "") {
|
|
715 | 762 |
$pgtitle = "{$g['product_name']} installer"; |
763 |
} |
|
716 | 764 |
echo <<<EOF |
717 | 765 |
<center> |
718 | 766 |
<img border="0" src="/themes/{$g['theme']}/images/logo.gif"></a><br /> |
... | ... | |
742 | 790 |
</center> |
743 | 791 |
|
744 | 792 |
EOF; |
745 |
|
|
793 |
|
|
746 | 794 |
} |
747 | 795 |
|
748 | 796 |
function installer_custom() { |
749 | 797 |
global $g, $fstype, $savemsg; |
750 | 798 |
global $select_txt, $custom_disks; |
751 |
if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log"))
|
|
799 |
if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
|
|
752 | 800 |
unlink("/tmp/.pc-sysinstall/pc-sysinstall.log"); |
801 |
} |
|
753 | 802 |
$disks = installer_find_all_disks(); |
754 | 803 |
// Pass size of disks down to javascript. |
755 | 804 |
$disk_sizes_js_txt = "var disk_sizes = new Array();\n"; |
756 |
foreach($disks as $disk)
|
|
805 |
foreach ($disks as $disk) {
|
|
757 | 806 |
$disk_sizes_js_txt .= "disk_sizes['{$disk['disk']}'] = '{$disk['size']}';\n"; |
807 |
} |
|
758 | 808 |
head_html(); |
759 | 809 |
body_html(); |
760 | 810 |
page_table_start($g['product_name'] . " installer - Customize disk(s) layout"); |
761 | 811 |
echo <<<EOF |
762 | 812 |
<script type="text/javascript"> |
763 | 813 |
Array.prototype.in_array = function(p_val) { |
764 |
for(var i = 0, l = this.length; i < l; i++) { |
|
765 |
if(this[i] == p_val) { |
|
814 |
for (var i = 0, l = this.length; i < l; i++) {
|
|
815 |
if (this[i] == p_val) {
|
|
766 | 816 |
return true; |
767 | 817 |
} |
768 | 818 |
} |
... | ... | |
772 | 822 |
var totalsize = 0; |
773 | 823 |
{$disk_sizes_js_txt} |
774 | 824 |
// Run through all rows and process data |
775 |
for(var x = 0; x<99; x++) { //optimize me better |
|
776 |
if(\$('#fstype' + x).length) { |
|
777 |
if(\$('#size' + x).val() == '')
|
|
825 |
for (var x = 0; x<99; x++) { //optimize me better
|
|
826 |
if (\$('#fstype' + x).length) {
|
|
827 |
if (\$('#size' + x).val() == '') {
|
|
778 | 828 |
\$('#size' + x).val(disk_sizes[\$('disk' + x).value]); |
829 |
} |
|
779 | 830 |
var fstype = \$('#fstype' + x).val(); |
780 |
if(fstype.substring(fstype.length - 4) == ".eli") { |
|
831 |
if (fstype.substring(fstype.length - 4) == ".eli") {
|
|
781 | 832 |
\$('#encpass' + x).prop('disabled',false); |
782 |
if(!encryption_warning_shown) { |
|
833 |
if (!encryption_warning_shown) {
|
|
783 | 834 |
alert('NOTE: If you define a disk encryption password you will need to enter it on *EVERY* bootup!'); |
784 | 835 |
encryption_warning_shown = true; |
785 | 836 |
} |
786 |
} else {
|
|
837 |
} else { |
|
787 | 838 |
\$('#encpass' + x).prop('disabled',true); |
788 | 839 |
} |
789 | 840 |
} |
790 | 841 |
// Calculate size allocations |
791 |
if(\$('#size' + x).length) { |
|
792 |
if(parseInt($('#size' + x).val()) > 0)
|
|
842 |
if (\$('#size' + x).length) {
|
|
843 |
if (parseInt($('#size' + x).val()) > 0) {
|
|
793 | 844 |
totalsize += parseInt($('#size' + x).val()); |
845 |
} |
|
794 | 846 |
} |
795 | 847 |
} |
796 | 848 |
// If the totalsize element exists, set it and disable |
797 |
if(\$('#totalsize').length) { |
|
798 |
if(\$('#totalsize').val() != totalsize) { |
|
849 |
if (\$('#totalsize').length) {
|
|
850 |
if (\$('#totalsize').val() != totalsize) {
|
|
799 | 851 |
// When size allocation changes, draw attention. |
800 |
jQuery('#totalsize').effect('highlight');
|
|
852 |
jQuery('#totalsize').effect('highlight'); |
|
801 | 853 |
\$('#totalsize').val(totalsize); |
802 | 854 |
} |
803 | 855 |
\$('#totalsize').prop('disabled',true); |
804 | 856 |
} |
805 |
if(\$('#disktotals').length) { |
|
857 |
if (\$('#disktotals').length) {
|
|
806 | 858 |
var disks_seen = new Array(); |
807 | 859 |
var tmp_sizedisks = 0; |
808 | 860 |
var disksseen = 0; |
809 |
for(var xx = 0; xx<99; xx++) { |
|
810 |
if(\$('#disk' + xx).length) { |
|
811 |
if(!disks_seen.in_array(\$('#disk' + xx).val())) { |
|
861 |
for (var xx = 0; xx<99; xx++) {
|
|
862 |
if (\$('#disk' + xx).length) {
|
|
863 |
if (!disks_seen.in_array(\$('#disk' + xx).val())) {
|
|
812 | 864 |
tmp_sizedisks += parseInt(disk_sizes[\$('#disk' + xx).val()]); |
813 | 865 |
disks_seen[disksseen] = \$('#disk' + xx).val(); |
814 | 866 |
disksseen++; |
... | ... | |
818 | 870 |
\$('#disktotals').prop('disabled',true); |
819 | 871 |
\$('#disktotals').css('color','#000000'); |
820 | 872 |
var remaining = parseInt(\$('#disktotals').val()) - parseInt(\$('#totalsize').val()); |
821 |
if(remaining == 0) { |
|
822 |
if(\$('#totalsize').length) |
|
873 |
if (remaining == 0) {
|
|
874 |
if (\$('#totalsize').length)
|
|
823 | 875 |
\$('#totalsize').css({ |
824 | 876 |
'background':'#00FF00', |
825 | 877 |
'color':'#000000' |
826 | 878 |
}); |
827 | 879 |
} else { |
828 |
if(\$('#totalsize').length) |
|
880 |
if (\$('#totalsize').length)
|
|
829 | 881 |
\$('#totalsize').css({ |
830 | 882 |
'background':'#FFFFFF', |
831 | 883 |
'color':'#000000' |
832 | 884 |
}); |
833 | 885 |
} |
834 |
if(parseInt(\$('#totalsize').val()) > parseInt(\$('#disktotals').val())) { |
|
835 |
if(\$('#totalsize')) |
|
886 |
if (parseInt(\$('#totalsize').val()) > parseInt(\$('#disktotals').val())) {
|
|
887 |
if (\$('#totalsize'))
|
|
836 | 888 |
\$('#totalsize').css({ |
837 | 889 |
'background':'#FF0000', |
838 | 890 |
'color':'#000000' |
839 |
});
|
|
891 |
}); |
|
840 | 892 |
} |
841 |
if(\$('#availalloc').length) { |
|
893 |
if (\$('#availalloc').length) {
|
|
842 | 894 |
\$('#availalloc').prop('disabled',true); |
843 | 895 |
\$('#availalloc').val(remaining); |
844 |
\$('#availalloc').css({
|
|
845 |
'background':'#FFFFFF',
|
|
846 |
'color':'#000000'
|
|
847 |
});
|
|
896 |
\$('#availalloc').css({ |
|
897 |
'background':'#FFFFFF', |
|
898 |
'color':'#000000' |
|
899 |
});
|
|
848 | 900 |
} |
849 | 901 |
} |
850 | 902 |
} |
... | ... | |
881 | 933 |
<div id="mainlevel"> |
882 | 934 |
<center> |
883 | 935 |
<table width="100%" border="0" cellpadding="5" cellspacing="0"> |
884 |
<tr>
|
|
885 |
<td>
|
|
936 |
<tr> |
|
937 |
<td>
|
|
886 | 938 |
<center> |
887 | 939 |
<div id="mainarea"> |
888 | 940 |
<center> |
889 | 941 |
<table width="100%" border="0" cellpadding="5" cellspacing="5"> |
890 | 942 |
<tr> |
891 |
<td>
|
|
943 |
<td>
|
|
892 | 944 |
<div id="pfsenseinstaller"> |
893 | 945 |
<center> |
894 | 946 |
<div id='loadingdiv'> |
... | ... | |
898 | 950 |
<img src="/themes/{$g['theme']}/images/misc/loader.gif"> |
899 | 951 |
</td> |
900 | 952 |
<td valign="center"> |
901 |
Probing disks, please wait...
|
|
953 |
Probing disks, please wait... |
|
902 | 954 |
</td> |
903 | 955 |
</tr> |
904 | 956 |
</table> |
... | ... | |
906 | 958 |
EOF; |
907 | 959 |
ob_flush(); |
908 | 960 |
// Read bootmanager setting from disk if found |
909 |
if(file_exists("/tmp/webInstaller_disk_bootmanager.txt"))
|
|
961 |
if (file_exists("/tmp/webInstaller_disk_bootmanager.txt")) {
|
|
910 | 962 |
$bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt")); |
911 |
if($bootmanager == "none") |
|
963 |
} |
|
964 |
if ($bootmanager == "none") { |
|
912 | 965 |
$noneselected = " SELECTED"; |
913 |
if($bootmanager == "bsd") |
|
966 |
} |
|
967 |
if ($bootmanager == "bsd") { |
|
914 | 968 |
$bsdeselected = " SELECTED"; |
915 |
if(!$disks) { |
|
969 |
} |
|
970 |
if (!$disks) { |
|
916 | 971 |
$custom_txt = gettext("ERROR: Could not find any suitable disks for installation."); |
917 | 972 |
} else { |
918 | 973 |
// Prepare disk selection dropdown |
... | ... | |
973 | 1028 |
// echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size - $first_disk_size -->\n\n"; |
974 | 1029 |
|
975 | 1030 |
// Check to see if a on disk layout exists |
976 |
if(file_exists("/tmp/webInstaller_disk_layout.txt")) { |
|
1031 |
if (file_exists("/tmp/webInstaller_disk_layout.txt")) {
|
|
977 | 1032 |
$disks_restored = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt")); |
978 | 1033 |
$restored_layout_from_file = true; |
979 | 1034 |
$restored_layout_txt = "<br />* The previous disk layout was restored from a previous session"; |
980 | 1035 |
} |
981 | 1036 |
|
982 | 1037 |
// If we restored disk layout(s) from a file then build the rows |
983 |
if($restored_layout_from_file == true) { |
|
1038 |
if ($restored_layout_from_file == true) {
|
|
984 | 1039 |
$diskcounter = 0; |
985 |
foreach($disks_restored as $dr) { |
|
1040 |
foreach ($disks_restored as $dr) {
|
|
986 | 1041 |
$custom_txt .= return_rowhelper_row("$diskcounter", $dr['mountpoint'], $dr['fstype'], $dr['disk'], $dr['size'], $dr['encpass']); |
987 | 1042 |
$diskcounter++; |
988 | 1043 |
} |
989 |
} else {
|
|
1044 |
} else { |
|
990 | 1045 |
// Construct the default rows that outline the disks configuration. |
991 | 1046 |
$custom_txt .= return_rowhelper_row("0", "/", "UFS+S", $first_disk, "{$first_disk_size}", ""); |
992 | 1047 |
$custom_txt .= return_rowhelper_row("1", "none", "SWAP", $first_disk, "$swap_size", ""); |
... | ... | |
1003 | 1058 |
$custom_txt .= "<a onclick=\"javascript:addRowTo('maintable', 'formfldalias'); return false;\" href=\"#\">"; |
1004 | 1059 |
$custom_txt .= "<img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" alt=\"\" title=\"add another entry\" /></a>"; |
1005 | 1060 |
$custom_txt .= "</div>"; |
1006 |
$custom_txt .= "</td></tr>";
|
|
1061 |
$custom_txt .= "</td></tr>"; |
|
1007 | 1062 |
// Disk capacity box |
1008 | 1063 |
$custom_txt .= "<tr><td></td><td></td><td align='right'>Disk(s) capacity total:</td><td><input style='border:0px; background-color: #FFFFFF;' size='8' id='disktotals' name='disktotals'></td></tr>"; |
1009 | 1064 |
// Remaining allocation box |
... | ... | |
1034 | 1089 |
</td></tr> |
1035 | 1090 |
</table> |
1036 | 1091 |
</div> |
1037 |
</td>
|
|
1092 |
</td>
|
|
1038 | 1093 |
</tr> |
1039 | 1094 |
</table> |
1040 | 1095 |
</center> |
... | ... | |
1061 | 1116 |
newrow[2] = "{$custom_disks}"; |
1062 | 1117 |
--> |
1063 | 1118 |
</script> |
1064 |
|
|
1119 |
|
|
1065 | 1120 |
|
1066 | 1121 |
EOF; |
1067 | 1122 |
page_table_end(); |
... | ... | |
1070 | 1125 |
|
1071 | 1126 |
function installer_main() { |
1072 | 1127 |
global $g, $fstype, $savemsg; |
1073 |
if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log"))
|
|
1128 |
if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
|
|
1074 | 1129 |
unlink("/tmp/.pc-sysinstall/pc-sysinstall.log"); |
1130 |
} |
|
1075 | 1131 |
head_html(); |
1076 | 1132 |
body_html(); |
1077 | 1133 |
$disk = installer_find_first_disk(); |
1078 | 1134 |
// Only enable ZFS if this exists. The install will fail otherwise. |
1079 |
if(file_exists("/boot/gptzfsboot"))
|
|
1135 |
if (file_exists("/boot/gptzfsboot")) {
|
|
1080 | 1136 |
$zfs_enabled = "<tr bgcolor=\"#9A9A9A\"><td align=\"center\"><a href=\"installer.php?state=easy_install_zfs\">Easy installation of {$g['product_name']} using the ZFS filesystem on disk {$disk}</a></td></tr>"; |
1137 |
} |
|
1081 | 1138 |
page_table_start(); |
1082 | 1139 |
echo <<<EOF |
1083 | 1140 |
<form action="installer.php" method="post" state="step1_post"> |
... | ... | |
1086 | 1143 |
<b><font face="arial" size="+2">Welcome to the {$g['product_name']} webInstaller!</b></font><p/> |
1087 | 1144 |
<font face="arial" size="+1">This utility will install {$g['product_name']} to a hard disk, flash drive, etc.</font> |
1088 | 1145 |
<table width="100%" border="0" cellpadding="5" cellspacing="0"> |
1089 |
<tr>
|
|
1090 |
<td>
|
|
1146 |
<tr> |
|
1147 |
<td>
|
|
1091 | 1148 |
<center> |
1092 | 1149 |
<div id="mainarea"> |
1093 | 1150 |
<br /> |
... | ... | |
1096 | 1153 |
<p/> |
1097 | 1154 |
<table width="100%" border="0" cellpadding="5" cellspacing="5"> |
1098 | 1155 |
<tr> |
1099 |
<td>
|
|
1156 |
<td>
|
|
1100 | 1157 |
<div id="pfsenseinstaller"> |
1101 | 1158 |
<center> |
1102 | 1159 |
EOF; |
1103 |
if(!$disk) { |
|
1160 |
if (!$disk) {
|
|
1104 | 1161 |
echo gettext("ERROR: Could not find any suitable disks for installation."); |
1105 | 1162 |
echo "</div></td></tr></table></div></table></div>"; |
1106 | 1163 |
end_html(); |
... | ... | |
1112 | 1169 |
<tr bgcolor="#CECECE"><td align="center"> |
1113 | 1170 |
<a href="installer.php?state=easy_install_ufs">Easy installation of {$g['product_name']} using the UFS filesystem on disk {$disk}</a> |
1114 | 1171 |
</td></tr> |
1115 |
{$zfs_enabled}
|
|
1172 |
{$zfs_enabled} |
|
1116 | 1173 |
<tr bgcolor="#AAAAAA"><td align="center"> |
1117 | 1174 |
<a href="installer.php?state=custominstall">Custom installation of {$g['product_name']}</a> |
1118 | 1175 |
</td></tr> |
... | ... | |
1122 | 1179 |
</table> |
1123 | 1180 |
</center> |
1124 | 1181 |
</div> |
1125 |
</td>
|
|
1182 |
</td>
|
|
1126 | 1183 |
</tr> |
1127 | 1184 |
</table> |
1128 | 1185 |
</div> |
... | ... | |
1136 | 1193 |
} |
1137 | 1194 |
|
1138 | 1195 |
function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encpass) { |
1139 |
global $g, $select_txt, $custom_disks, $savemsg; |
|
1140 |
$release = php_uname("r"); |
|
1141 |
// Get release number like 8.3 or 10.1 |
|
1142 |
$relnum = strtok($release, "-"); |
|
1143 |
|
|
1144 |
// Mount point |
|
1145 |
$disks = installer_find_all_disks(); |
|
1146 |
$custom_txt .= "<tr>"; |
|
1147 |
$custom_txt .= "<td><input size='8' id='mountpoint{$rownum}' name='mountpoint{$rownum}' value='{$mountpoint}'></td>"; |
|
1148 |
|
|
1149 |
// Filesystem type array |
|
1150 |
$types = array( |
|
1151 |
'UFS' => 'UFS', |
|
1152 |
'UFS+S' => 'UFS + Softupdates', |
|
1153 |
'UFS.eli' => 'Encrypted UFS', |
|
1154 |
'UFS+S.eli' => 'Encrypted UFS + Softupdates', |
|
1155 |
'SWAP' => 'SWAP' |
|
1156 |
); |
|
1157 |
|
|
1158 |
// UFS + Journaling was introduced in 9.0 |
|
1159 |
if($relnum >= 9) { |
|
1160 |
$types['UFS+J'] = "UFS + Journaling"; |
|
1161 |
$types['UFS+J.eli'] = "Encrypted UFS + Journaling"; |
|
1162 |
} |
|
1163 |
|
|
1164 |
// Add ZFS Boot loader if it exists |
|
1165 |
if(file_exists("/boot/gptzfsboot")) { |
|
1166 |
$types['ZFS'] = "Zetabyte Filesystem"; |
|
1167 |
$types['ZFS.eli'] = "Encrypted Zetabyte Filesystem"; |
|
1168 |
} |
|
1196 |
global $g, $select_txt, $custom_disks, $savemsg; |
|
1197 |
$release = php_uname("r"); |
|
1198 |
// Get release number like 8.3 or 10.1 |
|
1199 |
$relnum = strtok($release, "-"); |
|
1200 |
|
|
1201 |
// Mount point |
|
1202 |
$disks = installer_find_all_disks(); |
|
1203 |
$custom_txt .= "<tr>"; |
|
1204 |
$custom_txt .= "<td><input size='8' id='mountpoint{$rownum}' name='mountpoint{$rownum}' value='{$mountpoint}'></td>"; |
|
1205 |
|
|
1206 |
// Filesystem type array |
|
1207 |
$types = array( |
|
1208 |
'UFS' => 'UFS', |
|
1209 |
'UFS+S' => 'UFS + Softupdates', |
|
1210 |
'UFS.eli' => 'Encrypted UFS', |
|
1211 |
'UFS+S.eli' => 'Encrypted UFS + Softupdates', |
|
1212 |
'SWAP' => 'SWAP' |
|
1213 |
); |
|
1214 |
|
|
1215 |
// UFS + Journaling was introduced in 9.0 |
|
1216 |
if ($relnum >= 9) { |
|
1217 |
$types['UFS+J'] = "UFS + Journaling"; |
|
1218 |
$types['UFS+J.eli'] = "Encrypted UFS + Journaling"; |
|
1219 |
} |
|
1169 | 1220 |
|
1170 |
// fstype form field |
|
1171 |
$custom_txt .= "<td><select onChange='javascript:row_helper_dynamic_custom()' id='fstype{$rownum}' name='fstype{$rownum}'>"; |
|
1172 |
$select_txt = ""; |
|
1173 |
foreach($types as $type => $desc) { |
|
1174 |
if($type == $fstype) |
|
1175 |
$SELECTED="SELECTED"; |
Also available in: Unified diff
Code style for small things in usr-local-www