summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/local/captiveportal/index.php45
-rw-r--r--usr/local/captiveportal/radius_accounting.inc8
-rw-r--r--usr/local/pkg/miniupnpd.inc24
-rwxr-xr-xusr/local/www/bandwidth_by_ip.php2
-rw-r--r--usr/local/www/carp_status.php2
-rw-r--r--usr/local/www/crash_reporter.php6
-rw-r--r--usr/local/www/diag_backup.php4
-rw-r--r--usr/local/www/diag_dns.php6
-rwxr-xr-xusr/local/www/diag_dump_states.php4
-rw-r--r--usr/local/www/diag_ipsec.php2
-rw-r--r--usr/local/www/diag_limiter_info.php2
-rw-r--r--usr/local/www/diag_logs_filter.php4
-rw-r--r--usr/local/www/diag_logs_filter_summary.php8
-rw-r--r--usr/local/www/diag_logs_ipsec.php4
-rw-r--r--usr/local/www/diag_logs_settings.php2
-rw-r--r--usr/local/www/diag_packet_capture.php8
-rw-r--r--usr/local/www/diag_pf_info.php2
-rw-r--r--usr/local/www/diag_states_summary.php2
-rw-r--r--usr/local/www/diag_system_activity.php2
-rw-r--r--usr/local/www/diag_system_pftop.php2
-rw-r--r--usr/local/www/diag_tables.php5
-rw-r--r--usr/local/www/edit.php8
-rw-r--r--usr/local/www/exec.php36
-rwxr-xr-xusr/local/www/fbegin.inc32
-rw-r--r--usr/local/www/firewall_aliases.php22
-rwxr-xr-xusr/local/www/firewall_aliases_edit.php10
-rwxr-xr-xusr/local/www/firewall_aliases_import.php6
-rw-r--r--usr/local/www/firewall_nat.php6
-rw-r--r--usr/local/www/firewall_nat_1to1.php2
-rw-r--r--usr/local/www/firewall_nat_1to1_edit.php10
-rw-r--r--usr/local/www/firewall_nat_edit.php40
-rw-r--r--usr/local/www/firewall_nat_npt.php2
-rw-r--r--usr/local/www/firewall_nat_npt_edit.php2
-rw-r--r--usr/local/www/firewall_nat_out.php4
-rw-r--r--usr/local/www/firewall_nat_out_edit.php38
-rw-r--r--usr/local/www/firewall_rules.php22
-rw-r--r--usr/local/www/firewall_rules_edit.php62
-rw-r--r--usr/local/www/firewall_schedule.php12
-rw-r--r--usr/local/www/firewall_schedule_edit.php78
-rw-r--r--usr/local/www/firewall_shaper.php11
-rw-r--r--usr/local/www/firewall_shaper_layer7.php30
-rw-r--r--usr/local/www/firewall_shaper_vinterface.php6
-rw-r--r--usr/local/www/firewall_shaper_wizards.php6
-rw-r--r--usr/local/www/firewall_virtual_ip.php14
-rw-r--r--usr/local/www/firewall_virtual_ip_edit.php20
-rw-r--r--usr/local/www/getserviceproviders.php18
-rw-r--r--usr/local/www/getstats.php6
-rwxr-xr-xusr/local/www/graph.php481
-rw-r--r--usr/local/www/graph_cpu.php210
-rw-r--r--usr/local/www/guiconfig.inc70
-rwxr-xr-xusr/local/www/halt.php4
-rwxr-xr-xusr/local/www/head.inc2
-rw-r--r--usr/local/www/headjs.php4
-rw-r--r--usr/local/www/ifstats.php6
-rw-r--r--usr/local/www/includes/functions.inc.php37
-rw-r--r--usr/local/www/index.php60
-rw-r--r--usr/local/www/installer/index.php5
-rw-r--r--usr/local/www/installer/installer.php1273
-rw-r--r--usr/local/www/interfaces.php130
-rw-r--r--usr/local/www/interfaces_assign.php10
-rw-r--r--usr/local/www/interfaces_bridge.php2
-rw-r--r--usr/local/www/interfaces_bridge_edit.php14
-rw-r--r--usr/local/www/interfaces_gif.php4
-rw-r--r--usr/local/www/interfaces_gif_edit.php6
-rw-r--r--usr/local/www/interfaces_gre.php4
-rw-r--r--usr/local/www/interfaces_gre_edit.php6
-rw-r--r--usr/local/www/interfaces_groups.php4
-rw-r--r--usr/local/www/interfaces_groups_edit.php7
-rw-r--r--usr/local/www/interfaces_lagg.php4
-rw-r--r--usr/local/www/interfaces_lagg_edit.php2
-rw-r--r--usr/local/www/interfaces_ppps.php2
-rw-r--r--usr/local/www/interfaces_ppps_edit.php72
-rw-r--r--usr/local/www/interfaces_qinq.php4
-rw-r--r--usr/local/www/interfaces_qinq_edit.php8
-rw-r--r--usr/local/www/interfaces_vlan.php4
-rw-r--r--usr/local/www/interfaces_vlan_edit.php6
-rw-r--r--usr/local/www/interfaces_wireless.php2
-rw-r--r--usr/local/www/interfaces_wireless_edit.php4
-rw-r--r--usr/local/www/license.php2
-rw-r--r--usr/local/www/load_balancer_monitor.php8
-rw-r--r--usr/local/www/load_balancer_monitor_edit.php22
-rw-r--r--usr/local/www/load_balancer_pool.php14
-rw-r--r--usr/local/www/load_balancer_pool_edit.php16
-rw-r--r--usr/local/www/load_balancer_setting.php4
-rw-r--r--usr/local/www/load_balancer_virtual_server.php16
-rw-r--r--usr/local/www/load_balancer_virtual_server_edit.php8
-rwxr-xr-xusr/local/www/pkg.php40
-rw-r--r--usr/local/www/pkg_edit.php67
-rw-r--r--usr/local/www/pkg_mgr.php28
-rw-r--r--usr/local/www/pkg_mgr_install.php7
-rw-r--r--usr/local/www/pkg_mgr_installed.php42
-rw-r--r--usr/local/www/pkg_mgr_settings.php6
-rwxr-xr-xusr/local/www/reboot.php4
-rw-r--r--usr/local/www/services_captiveportal.php8
-rw-r--r--usr/local/www/services_captiveportal_hostname_edit.php6
-rw-r--r--usr/local/www/services_captiveportal_mac.php4
-rw-r--r--usr/local/www/services_captiveportal_vouchers.php14
-rw-r--r--usr/local/www/services_captiveportal_vouchers_edit.php4
-rw-r--r--usr/local/www/services_dhcp.php30
-rw-r--r--usr/local/www/services_dhcpv6.php2
-rw-r--r--usr/local/www/services_dhcpv6_edit.php2
-rw-r--r--usr/local/www/services_dnsmasq.php8
-rw-r--r--usr/local/www/services_dyndns_edit.php2
-rw-r--r--usr/local/www/services_igmpproxy_edit.php14
-rw-r--r--usr/local/www/services_ntpd.php2
-rw-r--r--usr/local/www/services_rfc2136_edit.php2
-rw-r--r--usr/local/www/services_unbound.php2
-rw-r--r--usr/local/www/services_unbound_acls.php2
-rw-r--r--usr/local/www/services_unbound_advanced.php4
-rw-r--r--usr/local/www/services_wol_edit.php2
-rw-r--r--usr/local/www/shortcuts.inc4
-rwxr-xr-xusr/local/www/status.php88
-rw-r--r--usr/local/www/status_captiveportal.php2
-rw-r--r--usr/local/www/status_captiveportal_expire.php2
-rw-r--r--usr/local/www/status_captiveportal_test.php3
-rw-r--r--usr/local/www/status_captiveportal_voucher_rolls.php4
-rw-r--r--usr/local/www/status_captiveportal_vouchers.php4
-rw-r--r--usr/local/www/status_dhcp_leases.php23
-rw-r--r--usr/local/www/status_dhcpv6_leases.php24
-rw-r--r--usr/local/www/status_filter_reload.php10
-rwxr-xr-xusr/local/www/status_gateway_groups.php2
-rw-r--r--usr/local/www/status_gateways.php2
-rw-r--r--usr/local/www/status_graph.php8
-rw-r--r--usr/local/www/status_interfaces.php6
-rw-r--r--usr/local/www/status_lb_pool.php18
-rw-r--r--usr/local/www/status_lb_vs.php2
-rw-r--r--usr/local/www/status_ntpd.php12
-rw-r--r--usr/local/www/status_openvpn.php12
-rw-r--r--usr/local/www/status_queues.php15
-rw-r--r--usr/local/www/status_rrd_graph.php27
-rw-r--r--usr/local/www/status_rrd_graph_img.php34
-rw-r--r--usr/local/www/status_rrd_graph_settings.php2
-rwxr-xr-xusr/local/www/status_services.php2
-rw-r--r--usr/local/www/status_upnp.php2
-rw-r--r--usr/local/www/status_wireless.php6
-rw-r--r--usr/local/www/system_advanced_admin.php8
-rw-r--r--usr/local/www/system_advanced_firewall.php27
-rw-r--r--usr/local/www/system_advanced_misc.php26
-rw-r--r--usr/local/www/system_advanced_notifications.php24
-rw-r--r--usr/local/www/system_advanced_sysctl.php14
-rw-r--r--usr/local/www/system_certmanager.php2
-rw-r--r--usr/local/www/system_crlmanager.php11
-rw-r--r--usr/local/www/system_firmware.php4
-rw-r--r--usr/local/www/system_firmware_check.php10
-rw-r--r--usr/local/www/system_firmware_restorefullbackup.php10
-rw-r--r--usr/local/www/system_firmware_settings.php6
-rw-r--r--usr/local/www/system_gateways_edit.php6
-rw-r--r--usr/local/www/system_groupmanager_addprivs.php2
-rwxr-xr-xusr/local/www/system_hasync.php8
-rw-r--r--usr/local/www/system_usermanager_addprivs.php2
-rw-r--r--usr/local/www/vpn_ipsec.php10
-rw-r--r--usr/local/www/vpn_ipsec_mobile.php6
-rw-r--r--usr/local/www/vpn_ipsec_phase2.php8
-rw-r--r--usr/local/www/vpn_ipsec_settings.php21
-rw-r--r--usr/local/www/vpn_l2tp.php28
-rw-r--r--usr/local/www/vpn_l2tp_users.php2
-rw-r--r--usr/local/www/vpn_l2tp_users_edit.php12
-rw-r--r--usr/local/www/vpn_openvpn_client.php2
-rw-r--r--usr/local/www/vpn_openvpn_csc.php10
-rw-r--r--usr/local/www/vpn_openvpn_server.php6
-rw-r--r--usr/local/www/vpn_pppoe.php2
-rw-r--r--usr/local/www/vpn_pppoe_edit.php13
-rw-r--r--usr/local/www/widgets/javascript/traffic_graph.js4
-rw-r--r--usr/local/www/widgets/widgets/gateways.widget.php101
-rw-r--r--usr/local/www/widgets/widgets/log.widget.php4
-rw-r--r--usr/local/www/widgets/widgets/picture.widget.php4
-rw-r--r--usr/local/www/widgets/widgets/rss.widget.php4
-rw-r--r--usr/local/www/widgets/widgets/services_status.widget.php4
-rw-r--r--usr/local/www/widgets/widgets/thermal_sensors.widget.php2
-rw-r--r--usr/local/www/widgets/widgets/traffic_graphs.widget.php4
-rw-r--r--usr/local/www/wizard.php14
-rwxr-xr-xusr/local/www/xmlrpc.php10
-rw-r--r--usr/sbin/pc-sysinstall/Makefile5
-rw-r--r--usr/sbin/pc-sysinstall/Makefile.inc3
-rw-r--r--usr/sbin/pc-sysinstall/backend-partmanager/Makefile8
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-partmanager/create-part.sh92
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-partmanager/delete-part.sh89
-rw-r--r--usr/sbin/pc-sysinstall/backend-query/Makefile13
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/detect-emulation.sh41
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/detect-laptop.sh32
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/detect-nics.sh36
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/disk-info.sh60
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/disk-list.sh103
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/disk-part.sh117
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/enable-net.sh65
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/get-packages.sh52
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-components.sh55
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-config.sh30
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-mirrors.sh37
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-packages.sh86
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-rsync-backups.sh70
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/list-tzones.sh34
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/query-langs.sh30
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/send-logs.sh83
-rw-r--r--usr/sbin/pc-sysinstall/backend-query/set-mirror.sh40
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh64
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/sys-mem.sh28
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/test-live.sh33
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/test-netup.sh50
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/update-part-list.sh110
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh56
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/xkeyboard-models.sh58
-rwxr-xr-xusr/sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh56
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/Makefile15
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-bsdlabel.sh819
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-cleanup.sh418
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-disk.sh827
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-extractimage.sh457
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-ftp.sh417
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-installcomponents.sh167
-rw-r--r--usr/sbin/pc-sysinstall/backend/functions-installpackages.sh125
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-localize.sh511
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-mountdisk.sh191
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-mountoptical.sh153
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-networking.sh357
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-newfs.sh217
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-packages.sh376
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-parse.sh232
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-runcommands.sh110
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-unmount.sh209
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-upgrade.sh247
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions-users.sh175
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/functions.sh497
-rw-r--r--usr/sbin/pc-sysinstall/backend/installimage.sh34
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/parseconfig.sh120
-rwxr-xr-xusr/sbin/pc-sysinstall/backend/startautoinstall.sh136
-rw-r--r--usr/sbin/pc-sysinstall/conf/Makefile11
-rw-r--r--usr/sbin/pc-sysinstall/conf/avail-langs20
-rw-r--r--usr/sbin/pc-sysinstall/conf/exclude-from-upgrade15
-rw-r--r--usr/sbin/pc-sysinstall/conf/licenses/bsd-en.txt24
-rw-r--r--usr/sbin/pc-sysinstall/conf/licenses/intel-en.txt207
-rw-r--r--usr/sbin/pc-sysinstall/conf/licenses/nvidia-en.txt53
-rw-r--r--usr/sbin/pc-sysinstall/conf/pc-sysinstall.conf86
-rw-r--r--usr/sbin/pc-sysinstall/doc/Makefile8
-rw-r--r--usr/sbin/pc-sysinstall/doc/help-disk-list1
-rw-r--r--usr/sbin/pc-sysinstall/doc/help-disk-size1
-rw-r--r--usr/sbin/pc-sysinstall/doc/help-index100
-rw-r--r--usr/sbin/pc-sysinstall/doc/help-start-autoinstall39
-rw-r--r--usr/sbin/pc-sysinstall/examples/Makefile11
-rw-r--r--usr/sbin/pc-sysinstall/examples/README369
-rw-r--r--usr/sbin/pc-sysinstall/examples/pc-autoinstall.conf52
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall71
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.geli50
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror45
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall68
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.restore57
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.rsync45
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade24
-rw-r--r--usr/sbin/pc-sysinstall/examples/pcinstall.cfg.zfs59
-rw-r--r--usr/sbin/pc-sysinstall/examples/pfSense.cfg31
-rw-r--r--usr/sbin/pc-sysinstall/examples/pfSense.cfg.zfs46
-rw-r--r--usr/sbin/pc-sysinstall/pc-sysinstall/Makefile6
-rw-r--r--usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8120
-rwxr-xr-xusr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh240
254 files changed, 1569 insertions, 12967 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index 2d256b2..d450233 100644
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -98,7 +98,7 @@ if ($macfilter || $passthrumac) {
$tmpres = pfSense_ip_to_mac($clientip);
if (!is_array($tmpres)) {
/* unable to find MAC address - shouldn't happen! - bail out */
- captiveportal_logportalauth("unauthenticated","noclientmac",$clientip,"ERROR");
+ captiveportal_logportalauth("unauthenticated", "noclientmac", $clientip, "ERROR");
echo "An error occurred. Please check the system logs for more information.";
log_error("Zone: {$cpzone} - Captive portal could not determine client's MAC address. Disable MAC address filtering in captive portal if you do not need this functionality.");
ob_flush();
@@ -142,19 +142,19 @@ EOD;
captiveportal_disconnect_client($_POST['logout_id']);
} else if ($macfilter && $clientmac && captiveportal_blocked_mac($clientmac)) {
- captiveportal_logportalauth($clientmac,$clientmac,$clientip,"Blocked MAC address");
+ captiveportal_logportalauth($clientmac, $clientmac, $clientip, "Blocked MAC address");
if (!empty($cpcfg['blockedmacsurl'])) {
portal_reply_page($cpcfg['blockedmacsurl'], "redir");
} else {
portal_reply_page($redirurl, "error", "This MAC address has been blocked");
}
-} else if ($clientmac && $radmac_enable && portal_mac_radius($clientmac,$clientip, $radiusctx)) {
+} else if ($clientmac && $radmac_enable && portal_mac_radius($clientmac, $clientip, $radiusctx)) {
/* radius functions handle everything so we exit here since we're done */
} else if (portal_consume_passthrough_credit($clientmac)) {
/* allow the client through if it had a pass-through credit for its MAC */
- captiveportal_logportalauth("unauthenticated",$clientmac,$clientip,"ACCEPT");
+ captiveportal_logportalauth("unauthenticated", $clientmac, $clientip, "ACCEPT");
portal_allow($clientip, $clientmac, "unauthenticated");
} else if (isset($config['voucher'][$cpzone]['enable']) && $_POST['accept'] && $_POST['auth_voucher']) {
@@ -163,22 +163,23 @@ EOD;
// $timecredit contains either a credit in minutes or an error message
if ($timecredit > 0) { // voucher is valid. Remaining minutes returned
// if multiple vouchers given, use the first as username
- $a_vouchers = preg_split("/[\t\n\r ]+/s",$voucher);
+ $a_vouchers = preg_split("/[\t\n\r ]+/s", $voucher);
$voucher = $a_vouchers[0];
- $attr = array( 'voucher' => 1,
- 'session_timeout' => $timecredit*60,
- 'session_terminate_time' => 0);
- if (portal_allow($clientip, $clientmac,$voucher,null,$attr)) {
+ $attr = array(
+ 'voucher' => 1,
+ 'session_timeout' => $timecredit*60,
+ 'session_terminate_time' => 0);
+ if (portal_allow($clientip, $clientmac, $voucher, null, $attr)) {
// YES: user is good for $timecredit minutes.
- captiveportal_logportalauth($voucher,$clientmac,$clientip,"Voucher login good for $timecredit min.");
+ captiveportal_logportalauth($voucher, $clientmac, $clientip, "Voucher login good for $timecredit min.");
} else {
portal_reply_page($redirurl, "error", $config['voucher'][$cpzone]['descrmsgexpired'] ? $config['voucher'][$cpzone]['descrmsgexpired']: $errormsg);
}
} else if (-1 == $timecredit) { // valid but expired
- captiveportal_logportalauth($voucher,$clientmac,$clientip,"FAILURE","voucher expired");
+ captiveportal_logportalauth($voucher, $clientmac, $clientip, "FAILURE", "voucher expired");
portal_reply_page($redirurl, "error", $config['voucher'][$cpzone]['descrmsgexpired'] ? $config['voucher'][$cpzone]['descrmsgexpired']: $errormsg);
} else {
- captiveportal_logportalauth($voucher,$clientmac,$clientip,"FAILURE");
+ captiveportal_logportalauth($voucher, $clientmac, $clientip, "FAILURE");
portal_reply_page($redirurl, "error", $config['voucher'][$cpzone]['descrmsgnoaccess'] ? $config['voucher'][$cpzone]['descrmsgnoaccess'] : $errormsg);
}
@@ -191,7 +192,7 @@ EOD;
$user = $_POST['auth_user2'];
$paswd = $_POST['auth_pass2'];
}
- $auth_list = radius($user,$paswd,$clientip,$clientmac,"USER LOGIN", $radiusctx);
+ $auth_list = radius($user, $paswd, $clientip, $clientmac, "USER LOGIN", $radiusctx);
$type = "error";
if (!empty($auth_list['url_redirection'])) {
$redirurl = $auth_list['url_redirection'];
@@ -199,10 +200,10 @@ EOD;
}
if ($auth_list['auth_val'] == 1) {
- captiveportal_logportalauth($user,$clientmac,$clientip,"ERROR",$auth_list['error']);
+ captiveportal_logportalauth($user, $clientmac, $clientip, "ERROR", $auth_list['error']);
portal_reply_page($redirurl, $type, $auth_list['error'] ? $auth_list['error'] : $errormsg);
} else if ($auth_list['auth_val'] == 3) {
- captiveportal_logportalauth($user,$clientmac,$clientip,"FAILURE",$auth_list['reply_message']);
+ captiveportal_logportalauth($user, $clientmac, $clientip, "FAILURE", $auth_list['reply_message']);
portal_reply_page($redirurl, $type, $auth_list['reply_message'] ? $auth_list['reply_message'] : $errormsg);
}
} else {
@@ -213,7 +214,7 @@ EOD;
} else {
$user = 'unknown';
}
- captiveportal_logportalauth($user ,$clientmac,$clientip,"ERROR");
+ captiveportal_logportalauth($user, $clientmac, $clientip, "ERROR");
portal_reply_page($redirurl, "error", $errormsg);
}
@@ -226,11 +227,11 @@ EOD;
$loginok = userHasPrivilege(getUserEntry($_POST['auth_user']), "user-services-captiveportal-login");
}
- if ($loginok){
- captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"LOGIN");
- portal_allow($clientip, $clientmac,$_POST['auth_user']);
+ if ($loginok) {
+ captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, "LOGIN");
+ portal_allow($clientip, $clientmac, $_POST['auth_user']);
} else {
- captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"FAILURE");
+ captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, "FAILURE");
portal_reply_page($redirurl, "error", $errormsg);
}
} else {
@@ -238,12 +239,12 @@ EOD;
}
} else if ($_POST['accept'] && $clientip && $cpcfg['auth_method'] == "none") {
- captiveportal_logportalauth("unauthenticated",$clientmac,$clientip,"ACCEPT");
+ captiveportal_logportalauth("unauthenticated", $clientmac, $clientip, "ACCEPT");
portal_allow($clientip, $clientmac, "unauthenticated");
} else {
/* display captive portal page */
- portal_reply_page($redirurl, "login",null,$clientmac,$clientip);
+ portal_reply_page($redirurl, "login", null, $clientmac, $clientip);
}
ob_flush();
diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc
index 174d455..2d9c97e 100644
--- a/usr/local/captiveportal/radius_accounting.inc
+++ b/usr/local/captiveportal/radius_accounting.inc
@@ -61,12 +61,12 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers,
$nas_port = intval($ruleno);
$radiusvendor = $config['captiveportal'][$cpzone]['radiusvendor'] ? $config['captiveportal'][$cpzone]['radiusvendor'] : null;
- switch($radiusvendor) {
+ switch ($radiusvendor) {
case 'cisco':
- $calledstationid = $clientmac;
- $callingstationid = $clientip;
- break;
+ $calledstationid = $clientmac;
+ $callingstationid = $clientip;
+ break;
default:
if (!function_exists('getNasIP'))
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index 0c816a1..a545744 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -37,7 +37,7 @@
/* md5 hash of wan mac */
$uuid = md5(get_interface_mac(get_real_interface("wan")));
/* put uuid in correct format 8-4-4-4-12 */
- return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12);
+ return substr($uuid, 0, 8) . '-' . substr($uuid, 9, 4) . '-' . substr($uuid, 13, 4) . '-' . substr($uuid, 17, 4) . '-' . substr($uuid, 21, 12);
}
function upnp_validate_queue($qname) {
@@ -102,7 +102,7 @@
}
}
}
- if ($post['overridewanip'] && !upnp_validate_ip($post['overridewanip'],false)) {
+ if ($post['overridewanip'] && !upnp_validate_ip($post['overridewanip'], false)) {
$input_errors[] = 'You must specify a valid ip address in the \'Override WAN address\' field';
}
if (($post['download'] && !$post['upload']) || ($post['upload'] && !$post['download'])) {
@@ -120,9 +120,9 @@
/* user permissions validation */
$j = substr_count(implode(array_keys($post)), "permuser");
- for ($i=0; $i<$j; $i++){
+ for ($i = 0; $i < $j; $i++) {
if ($post["permuser{$i}"]) {
- $perm = explode(' ',$post["permuser{$i}"]);
+ $perm = explode(' ', $post["permuser{$i}"]);
/* should explode to 4 args */
if (count($perm) != 4) {
$input_errors[] = "You must follow the specified format in the 'User specified permissions {$i}' field";
@@ -136,7 +136,7 @@
$input_errors[] = "You must specify a port or port range between 0 and 65535 in the 'User specified permissions {$i}' field";
}
/* verify ip address */
- if (!upnp_validate_ip($perm[2],true)) {
+ if (!upnp_validate_ip($perm[2], true)) {
$input_errors[] = "You must specify a valid ip address in the 'User specified permissions {$i}' field";
}
}
@@ -179,7 +179,7 @@
}
$if = convert_friendly_interface_to_real_interface_name($iface);
/* above function returns iface if fail */
- if ($if!=$iface) {
+ if ($if != $iface) {
$addr = find_interface_ip($if);
$bits = find_interface_subnet($if);
/* check that the interface has an ip address before adding parameters */
@@ -235,14 +235,14 @@
/* set uuid and serial */
$config_text .= "uuid=".upnp_uuid()."\n";
- $config_text .= "serial=".strtoupper(substr(upnp_uuid(),0,8))."\n";
+ $config_text .= "serial=".strtoupper(substr(upnp_uuid(), 0, 8))."\n";
/* set model number */
$config_text .= "model_number=".file_get_contents("/etc/version")."\n";
/* upnp access restrictions */
- foreach($upnp_config['row'] as $row){
- if($row['permuser']) {
+ foreach ($upnp_config['row'] as $row) {
+ if ($row['permuser']) {
$config_text .= "{$row["permuser"]}\n";
}
}
@@ -257,13 +257,13 @@
}
/* Add shaper queue */
- if($upnp_config['upnpqueue']) {
+ if ($upnp_config['upnpqueue']) {
$config_text .= "queue={$upnp_config['upnpqueue']}\n";
}
/* Allow UPnP or NAT-PMP as requested */
- $config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" );
- $config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" );
+ $config_text .= "enable_upnp=" . ($upnp_config['enable_upnp'] ? "yes\n" : "no\n");
+ $config_text .= "enable_natpmp=" . ($upnp_config['enable_natpmp'] ? "yes\n" : "no\n");
/* write out the configuration */
upnp_write_config($config_file, $config_text);
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php
index d50b9e4..39f9a01 100755
--- a/usr/local/www/bandwidth_by_ip.php
+++ b/usr/local/www/bandwidth_by_ip.php
@@ -107,7 +107,7 @@ for ($x=2; $x<12; $x++) {
// echo $bandwidthinfo;
$emptyinfocounter = 1;
if ($bandwidthinfo != "") {
- $infoarray = explode (":",$bandwidthinfo);
+ $infoarray = explode (":", $bandwidthinfo);
if (($filter == "all") ||
(($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) ||
(($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) {
diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php
index a00d781..5f863e2 100644
--- a/usr/local/www/carp_status.php
+++ b/usr/local/www/carp_status.php
@@ -122,7 +122,7 @@ if (!empty($_POST['resetdemotion'])) {
$carp_detected_problems = get_single_sysctl("net.inet.carp.demotion");
}
-$pgtitle = array(gettext("Status"),gettext("CARP"));
+$pgtitle = array(gettext("Status"), gettext("CARP"));
$shortcut_section = "carp";
include("head.inc");
diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php
index fe4c7ca..24cb36f 100644
--- a/usr/local/www/crash_reporter.php
+++ b/usr/local/www/crash_reporter.php
@@ -71,12 +71,12 @@ function output_crash_reporter_html($crash_reports) {
echo "<p><i>" . gettext("Please double check the contents to ensure you are comfortable sending this information before clicking Yes.") . "</i></p>";
echo "<p>" . gettext("Contents of crash reports") . ":<br />";
echo "<textarea readonly=\"readonly\" rows=\"40\" cols=\"65\" name=\"crashreports\">{$crash_reports}</textarea></p>";
- echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Yes") . "\" />" . gettext(" - Submit this to the developers for inspection") . "</p>";
- echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("No") . "\" />" . gettext(" - Just delete the crash report and take me back to the Dashboard") . "</p>";
+ echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Yes") . "\" />" . gettext(" - Submit this to the developers for inspection") . "</p>";
+ echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("No") . "\" />" . gettext(" - Just delete the crash report and take me back to the Dashboard") . "</p>";
echo "</form>";
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Crash reporter"));
include('head.inc');
$crash_report_header = "Crash report begins. Anonymous machine information:\n\n";
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index bede178..6e454a4 100644
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -207,7 +207,7 @@ function spit_out_select_items($name, $showall) {
"wol" => gettext("Wake on LAN")
);
- $select = "<select name=\"{$name}\" id=\"{$name}\">";
+ $select = "<select name=\"{$name}\" id=\"{$name}\">";
$select .= "<option value=\"\">" . gettext("ALL") . "</option>";
if ($showall == true) {
@@ -457,7 +457,7 @@ if ($_POST) {
if (is_alias($config['interfaces'][$iface]['descr'])) {
// Firewall rules
$origname = $config['interfaces'][$iface]['descr'];
- $newname = $config['interfaces'][$iface]['descr'] . "Alias";
+ $newname = $config['interfaces'][$iface]['descr'] . "Alias";
update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $newname, $origname);
update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $newname, $origname);
// NAT Rules
diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php
index c234bea..4c57223 100644
--- a/usr/local/www/diag_dns.php
+++ b/usr/local/www/diag_dns.php
@@ -47,11 +47,11 @@ $a_aliases = &$config['aliases']['alias'];
$aliasname = str_replace(array(".", "-"), "_", $host);
$alias_exists = false;
-$counter=0;
+$counter = 0;
foreach ($a_aliases as $a) {
if ($a['name'] == $aliasname) {
$alias_exists = true;
- $id=$counter;
+ $id = $counter;
}
$counter++;
}
@@ -289,7 +289,7 @@ include("head.inc"); ?>
if (!$input_errors && $ipaddr) {
?>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("More Information:");?></td>
+ <td width="22%" valign="top" class="vncell"><?=gettext("More Information:");?></td>
<td width="78%" class="vtable">
<a href ="/diag_ping.php?host=<?=htmlspecialchars($host)?>&amp;interface=wan&amp;count=3"><?=gettext("Ping");?></a> <br />
<a href ="/diag_traceroute.php?host=<?=htmlspecialchars($host)?>&amp;ttl=18"><?=gettext("Traceroute");?></a>
diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php
index 1a2f435..1f947fd 100755
--- a/usr/local/www/diag_dump_states.php
+++ b/usr/local/www/diag_dump_states.php
@@ -187,10 +187,10 @@ while ($line = chop(fgets($fd))) {
$line_split = preg_split("/\s+/", $line);
- $iface = array_shift($line_split);
+ $iface = array_shift($line_split);
$proto = array_shift($line_split);
$state = array_pop($line_split);
- $info = implode(" ", $line_split);
+ $info = implode(" ", $line_split);
// We may want to make this optional, with a large state table, this could get to be expensive.
$iface = convert_real_interface_to_friendly_descr($iface);
diff --git a/usr/local/www/diag_ipsec.php b/usr/local/www/diag_ipsec.php
index 7f259c3..96c6835 100644
--- a/usr/local/www/diag_ipsec.php
+++ b/usr/local/www/diag_ipsec.php
@@ -301,7 +301,7 @@ $status = ipsec_smp_dump_status();
<tr>
<td class="listrborder" colspan="9">
<div id="btnchildsa-<?=$ikeid;?>">
- <input type="button" onclick="show_childsa('childsa-<?=$ikeid;?>','btnchildsa-<?=$ikeid;?>');" value="+" /> - Show child SA entries
+ <input type="button" onclick="show_childsa('childsa-<?=$ikeid;?>', 'btnchildsa-<?=$ikeid;?>');" value="+" /> - Show child SA entries
</div>
<table class="tabcont" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" id="childsa-<?=$ikeid;?>" style="display:none" summary="">
<thead>
diff --git a/usr/local/www/diag_limiter_info.php b/usr/local/www/diag_limiter_info.php
index 98d2663..d4e5b06 100644
--- a/usr/local/www/diag_limiter_info.php
+++ b/usr/local/www/diag_limiter_info.php
@@ -79,7 +79,7 @@ include("head.inc");
});
}
function activitycallback(transport) {
- jQuery('#limiteractivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
+ jQuery('#limiteractivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
setTimeout('getlimiteractivity()', 2000);
}
setTimeout('getlimiteractivity()', 5000);
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index df24cd4..b583035 100644
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -181,8 +181,8 @@ include("head.inc");
<td rowspan="2">
<div align="center"><?=gettext("Action");?></div>
<div align="left">
- <input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass<br />
- <input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block<br />
+ <input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass<br />
+ <input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block<br />
</div>
</td>
<td>
diff --git a/usr/local/www/diag_logs_filter_summary.php b/usr/local/www/diag_logs_filter_summary.php
index fe10383..331df0d 100644
--- a/usr/local/www/diag_logs_filter_summary.php
+++ b/usr/local/www/diag_logs_filter_summary.php
@@ -54,7 +54,7 @@ $fields = array(
$summary = array();
foreach (array_keys($fields) as $f) {
- $summary[$f] = array();
+ $summary[$f] = array();
}
$totals = array();
@@ -74,7 +74,7 @@ function stat_block($summary, $stat, $num) {
$k = array_keys($summary[$stat]);
$total = 0;
$numentries = 0;
- for ($i=0; $i < $num; $i++) {
+ for ($i = 0; $i < $num; $i++) {
if ($k[$i]) {
$total += $summary[$stat][$k[$i]];
$numentries++;
@@ -106,7 +106,7 @@ function pie_block($summary, $stat, $num) {
$numentries = 0;
print "\n<script type=\"text/javascript\">\n";
print "//<![CDATA[\n";
- for ($i=0; $i < $num; $i++) {
+ for ($i = 0; $i < $num; $i++) {
if ($k[$i]) {
$total += $summary[$stat][$k[$i]];
$numentries++;
@@ -123,7 +123,7 @@ function pie_block($summary, $stat, $num) {
print "Event.observe(window, 'load', function() {\n";
print " new Proto.Chart($('piechart{$stat}'),\n";
print " [\n";
- for ($i=0; $i < $num; $i++) {
+ for ($i = 0; $i < $num; $i++) {
if ($k[$i]) {
print " { data: d{$stat}{$i}, label: \"{$k[$i]}\"}";
if (!(($i == ($numentries - 1)) && ($leftover <= 0))) {
diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php
index 9340571..8fa79ce 100644
--- a/usr/local/www/diag_logs_ipsec.php
+++ b/usr/local/www/diag_logs_ipsec.php
@@ -92,7 +92,7 @@ include("head.inc");
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="main area">
<tr>
- <td colspan="2" class="listtopic"><?php printf(gettext("Last %s IPsec log entries"), $nentries);?></td>
+ <td colspan="2" class="listtopic"><?php printf(gettext("Last %s IPsec log entries"), $nentries);?></td>
</tr>
<?php
foreach ($ipsec_logarr as $logent) {
@@ -100,7 +100,7 @@ include("head.inc");
$logent = preg_split("/\s+/", $logent, 6);
echo "<tr valign=\"top\">\n";
$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
- echo "<td class=\"listlr nowrap\">" . $entry_date_time . "</td>\n";
+ echo "<td class=\"listlr nowrap\">" . $entry_date_time . "</td>\n";
echo "<td class=\"listr\">" . $logent[4] . " " . $logent[5] . "</td>\n";
echo "</tr>\n";
}
diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php
index c3d6993..c9f2791 100644
--- a/usr/local/www/diag_logs_settings.php
+++ b/usr/local/www/diag_logs_settings.php
@@ -379,7 +379,7 @@ function check_everything() {
<tr>
<td width="22%" valign="top">Reset Logs</td>
<td width="78%">
- <input name="resetlogs" type="submit" class="formbtn" value="<?=gettext("Reset Log Files"); ?>" onclick="return confirm('<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>')" />
+ <input name="resetlogs" type="submit" class="formbtn" value="<?=gettext("Reset Log Files"); ?>" onclick="return confirm('<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>')" />
<br /><br />
<?= gettext("Note: Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes."); ?>
</td>
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php
index ae41a67..14be5d1 100644
--- a/usr/local/www/diag_packet_capture.php
+++ b/usr/local/www/diag_packet_capture.php
@@ -309,7 +309,7 @@ include("fbegin.inc");
<tr>
<td width="17%" valign="top" class="vncellreq"><?=gettext("Port");?></td>
<td colspan="2" width="83%" class="vtable">
- <input name="port" class="formfld unknown" id="port" size="5" value="<?=$port;?>" />
+ <input name="port" class="formfld unknown" id="port" size="5" value="<?=htmlspecialchars($port);?>" />
<br /><?=gettext("The port can be either the source or destination port. The packet capture will look for this port in either field.");?>
<br /><?=gettext("Leave blank if you do not want to filter by port.");?>
</td>
@@ -317,14 +317,14 @@ include("fbegin.inc");
<tr>
<td width="17%" valign="top" class="vncellreq"><?=gettext("Packet Length");?></td>
<td colspan="2" width="83%" class="vtable">
- <input name="snaplen" class="formfld unknown" id="snaplen" size="5" value="<?=$snaplen;?>" />
+ <input name="snaplen" class="formfld unknown" id="snaplen" size="5" value="<?=htmlspecialchars($snaplen);?>" />
<br /><?=gettext("The Packet length is the number of bytes of each packet that will be captured. Default value is 0, which will capture the entire frame regardless of its size.");?>
</td>
</tr>
<tr>
<td width="17%" valign="top" class="vncellreq"><?=gettext("Count");?></td>
<td colspan="2" width="83%" class="vtable">
- <input name="count" class="formfld unknown" id="count" size="5" value="<?=$count;?>" />
+ <input name="count" class="formfld unknown" id="count" size="5" value="<?=htmlspecialchars($count);?>" />
<br /><?=gettext("This is the number of packets the packet capture will grab. Default value is 100.") . "<br />" . gettext("Enter 0 (zero) for no count limit.");?>
</td>
</tr>
@@ -338,7 +338,7 @@ include("fbegin.inc");
<option value="full" <?php if ($detail == "full") echo "selected=\"selected\""; ?>><?=gettext("Full");?></option>
</select>
<br />
- <?=gettext("This is the level of detail that will be displayed after hitting 'Stop' when the packets have been captured.") . "<br /><b>" .
+ <?=gettext("This is the level of detail that will be displayed after hitting 'Stop' when the packets have been captured.") . "<br /><b>" .
gettext("Note:") . "</b> " .
gettext("This option does not affect the level of detail when downloading the packet capture.");?>
</td>
diff --git a/usr/local/www/diag_pf_info.php b/usr/local/www/diag_pf_info.php
index b6ed73a..369c0f4 100644
--- a/usr/local/www/diag_pf_info.php
+++ b/usr/local/www/diag_pf_info.php
@@ -74,7 +74,7 @@ jQuery(document).ready(function() {setTimeout('getpfinfo()', 5000);});
});
}
function activitycallback(transport) {
- jQuery('#pfactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
+ jQuery('#pfactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
setTimeout('getpfinfo()', 2000);
}
//]]>
diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php
index 3b31df9..7aa91d6 100644
--- a/usr/local/www/diag_states_summary.php
+++ b/usr/local/www/diag_states_summary.php
@@ -68,7 +68,7 @@ if (count($states) > 0) {
$iface = array_shift($line_split);
$proto = array_shift($line_split);
$state = array_pop($line_split);
- $info = implode(" ", $line_split);
+ $info = implode(" ", $line_split);
/* Handle NAT cases
Replaces an external IP + NAT by the internal IP */
diff --git a/usr/local/www/diag_system_activity.php b/usr/local/www/diag_system_activity.php
index 58c5345..1f6380f 100644
--- a/usr/local/www/diag_system_activity.php
+++ b/usr/local/www/diag_system_activity.php
@@ -71,7 +71,7 @@ include("head.inc");
});
}
function activitycallback(transport) {
- jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
+ jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
setTimeout('getcpuactivity()', 2500);
}
setTimeout('getcpuactivity()', 1000);
diff --git a/usr/local/www/diag_system_pftop.php b/usr/local/www/diag_system_pftop.php
index 5c15e6f..7d51c84 100644
--- a/usr/local/www/diag_system_pftop.php
+++ b/usr/local/www/diag_system_pftop.php
@@ -108,7 +108,7 @@ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) &&
});
}
function activitycallback(transport) {
- jQuery('#pftopactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
+ jQuery('#pftopactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
setTimeout('getpftopactivity()', 2500);
}
setTimeout('getpftopactivity()', 1000);
diff --git a/usr/local/www/diag_tables.php b/usr/local/www/diag_tables.php
index 289d39f..fe6778f 100644
--- a/usr/local/www/diag_tables.php
+++ b/usr/local/www/diag_tables.php
@@ -114,7 +114,8 @@ include("head.inc");
if (200 == response.status) {
// Escape all dots to not confuse jQuery selectors
name = response.responseText.replace(/\./g,'\\.');
- name = name.replace(/\//g,'\\/');
+ name = name.replace(/\//g,'\\-');
+ name = "entry_" + name;
jQuery('#' + name).fadeOut(1000);
}
}
@@ -147,7 +148,7 @@ include("head.inc");
foreach ($entries as $entryA):
$entry = trim($entryA);
?>
- <tr id="<?=$entry?>">
+ <tr id="entry_<?=str_replace("/", "-", $entry);?>">
<td>
<?php echo $entry; ?>
</td>
diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php
index 7a78974..481b2ce 100644
--- a/usr/local/www/edit.php
+++ b/usr/local/www/edit.php
@@ -49,7 +49,7 @@ if ($_POST['action']) {
echo "|5|" . gettext("No file name specified") . ".|";
} elseif (is_dir($_POST['file'])) {
echo "|4|" . gettext("Loading a directory is not supported") . ".|";
- } elseif (! is_file($_POST['file'])) {
+ } elseif (!is_file($_POST['file'])) {
echo "|3|" . gettext("File does not exist or is not a regular file") . ".|";
} else {
$data = file_get_contents(urldecode($_POST['file']));
@@ -129,11 +129,11 @@ outputJavaScriptFileInline("javascript/base64.js");
if (file.indexOf(".php") > 0) lang = "php";
else if (file.indexOf(".inc") > 0) lang = "php";
else if (file.indexOf(".xml") > 0) lang = "xml";
- else if (file.indexOf(".js" ) > 0) lang = "js";
+ else if (file.indexOf(".js") > 0) lang = "js";
else if (file.indexOf(".css") > 0) lang = "css";
if (jQuery("#highlight").checked && lang != "none") {
- jQuery("fileContent").prop("className",lang + ":showcolumns");
+ jQuery("fileContent").prop("className", lang + ":showcolumns");
dp.SyntaxHighlighter.HighlightAll("fileContent", true, false);
}
} else {
@@ -148,7 +148,7 @@ outputJavaScriptFileInline("javascript/base64.js");
jQuery("#fileStatusBox").show(500);
var fileContent = Base64.encode(jQuery("#fileContent").val());
- fileContent = fileContent.replace(/\+/g,"%2B");
+ fileContent = fileContent.replace(/\+/g, "%2B");
jQuery.ajax(
"<?=$_SERVER['SCRIPT_NAME'];?>", {
diff --git a/usr/local/www/exec.php b/usr/local/www/exec.php
index f1da7a1..ecf938a 100644
--- a/usr/local/www/exec.php
+++ b/usr/local/www/exec.php
@@ -75,7 +75,7 @@ if ($_POST) {
// Returns true or false depending on blankness of argument.
function isBlank($arg) {
- return preg_match( "/^\s*$/", $arg );
+ return preg_match("/^\s*$/", $arg);
}
// Function: Puts
@@ -96,7 +96,7 @@ $arrDT = localtime();
$intYear = $arrDT[5] + 1900;
$closehead = false;
-$pgtitle = array(gettext("Diagnostics"),gettext("Execute command"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Execute command"));
include("head.inc");
?>
@@ -107,16 +107,16 @@ include("head.inc");
<?php
-if (isBlank( $_POST['txtRecallBuffer'] )) {
- puts( " var arrRecallBuffer = new Array;" );
+if (isBlank($_POST['txtRecallBuffer'])) {
+ puts(" var arrRecallBuffer = new Array;");
} else {
- puts( " var arrRecallBuffer = new Array(" );
- $arrBuffer = explode( "&", $_POST['txtRecallBuffer'] );
- for ($i=0; $i < (count( $arrBuffer ) - 1); $i++) {
- puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," );
+ puts(" var arrRecallBuffer = new Array(");
+ $arrBuffer = explode("&", $_POST['txtRecallBuffer']);
+ for ($i = 0; $i < (count($arrBuffer) - 1); $i++) {
+ puts(" '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "',");
}
- puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" );
- puts( " );" );
+ puts(" '" . htmlspecialchars($arrBuffer[count($arrBuffer) - 1], ENT_QUOTES | ENT_HTML401) . "'");
+ puts(" );");
}
?>
@@ -161,7 +161,7 @@ if (isBlank( $_POST['txtRecallBuffer'] )) {
// If nothing in recall buffer, then error.
if (!arrRecallBuffer.length) {
- alert( '<?=gettext("Nothing to recall"); ?>!' );
+ alert('<?=gettext("Nothing to recall"); ?>!');
form.txtCommand.focus();
return;
}
@@ -241,7 +241,7 @@ if (!isBlank($_POST['txtCommand'])) {
puts("\$ " . htmlspecialchars($_POST['txtCommand']));
putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); /* PHP scripts */
- $ph = popen($_POST['txtCommand'] . ' 2>&1', "r" );
+ $ph = popen($_POST['txtCommand'] . ' 2>&1', "r");
while ($line = fgets($ph)) {
echo htmlspecialchars($line);
}
@@ -260,7 +260,7 @@ if (!isBlank($_POST['txtPHPCommand'])) {
?>
<div id="niftyOutter">
-<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );">
+<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit(this);">
<table summary="exec">
<tr>
<td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td>
@@ -273,10 +273,10 @@ if (!isBlank($_POST['txtPHPCommand'])) {
<td valign="top">&nbsp;&nbsp;&nbsp;</td>
<td valign="top" class="label">
<input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" />
- <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" />
+ <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick(this.form, -1);" />
<input type="submit" class="button" value="<?=gettext("Execute"); ?>" />
- <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" />
- <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" />
+ <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick(this.form, 1);" />
+ <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick(this.form);" />
</td>
</tr>
<tr>
@@ -294,7 +294,7 @@ if (!isBlank($_POST['txtPHPCommand'])) {
<tr>
<td valign="top">&nbsp;&nbsp;&nbsp;</td>
<td valign="top" class="label">
- <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" />
+ <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" />
</td>
</tr>
<tr>
@@ -312,7 +312,7 @@ if (!isBlank($_POST['txtPHPCommand'])) {
<tr>
<td valign="top">&nbsp;&nbsp;&nbsp;</td>
<td valign="top" class="label">
- <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td>
+ <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td>
</tr>
<tr>
<td colspan="2" valign="top" height="16"></td>
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc
index 47be7e0..50a3f2e 100755
--- a/usr/local/www/fbegin.inc
+++ b/usr/local/www/fbegin.inc
@@ -76,7 +76,7 @@ function return_ext_menu($section) {
function output_menu($arrayitem, $target = null) {
foreach ($arrayitem as $item) {
- if (isAllowedPage($item[1]) || $item[1]=="/index.php?logout") {
+ if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout") {
$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
if ($target) {
$attr .= sprintf(" target=\"%s\"", htmlentities($target));
@@ -114,7 +114,7 @@ if (!isAllowedPage("system_usermanager.php*")) {
} else {
$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
}
-$system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0);
+$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
// Interfaces
$interfaces_menu = array();
@@ -127,7 +127,7 @@ foreach ($opts as $oif => $odescr) {
$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
}
}
-$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0);
+$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
// Firewall
$firewall_menu = array();
@@ -137,7 +137,7 @@ $firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
-$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")),0);
+$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
// Services
$services_menu = array();
@@ -163,7 +163,7 @@ if (count($config['interfaces']) > 1) {
$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
}
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
-$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0);
+$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
// VPN
$vpn_menu = array();
@@ -171,7 +171,7 @@ $vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
-$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0);
+$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
// Status
$status_menu = array();
@@ -210,7 +210,7 @@ foreach ($ifentries as $ent => $entdesc) {
if (count($wifdescrs) > 0) {
$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
}
-$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0);
+$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
// Diagnostics
$diagnostics_menu = array();
@@ -223,11 +223,11 @@ $diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
if (file_exists("/var/run/gmirror_active")) {
- $diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php" );
+ $diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
}
-$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" );
-$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" );
-$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" );
+$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php");
+$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
+$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
@@ -237,7 +237,7 @@ $diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
-$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php" );
+$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
@@ -250,11 +250,11 @@ if ($g['platform'] == "nanobsd") {
if (isset($config['system']['developer'])) {
$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
}
-$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0);
+$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
$gold_menu = array();
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
-$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")),0);
+$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
if (!$g['disablehelpmenu']) {
$help_menu = array();
@@ -269,7 +269,7 @@ if (!$g['disablehelpmenu']) {
$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
$help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
- $help_menu = msort(array_merge($help_menu, return_ext_menu("Help")),0);
+ $help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
}
?>
@@ -450,7 +450,7 @@ if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync'
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
$info_text = sprintf(gettext("%s is booting then packages will be reinstalled in the background.<p>Do not make changes in the GUI until this is complete."), $g['product_name']);
} else {
- $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ $pgtitle = array(gettext("System"), gettext("Package Manager"));
$info_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
}
print_info_box($info_text . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />");
diff --git a/usr/local/www/firewall_aliases.php b/usr/local/www/firewall_aliases.php
index 0df3c81..950a8a2 100644
--- a/usr/local/www/firewall_aliases.php
+++ b/usr/local/www/firewall_aliases.php
@@ -52,7 +52,7 @@ if (!is_array($config['aliases']['alias'])) {
}
$a_aliases = &$config['aliases']['alias'];
-$tab = ($_REQUEST['tab'] == "" ? "ip" : preg_replace("/\W/","",$_REQUEST['tab']));
+$tab = ($_REQUEST['tab'] == "" ? "ip" : preg_replace("/\W/", "", $_REQUEST['tab']));
if ($_POST) {
@@ -160,7 +160,7 @@ function find_alias_reference($section, $field, $origname, &$is_alias_referenced
}
}
-$pgtitle = array(gettext("Firewall"),gettext("Aliases"));
+$pgtitle = array(gettext("Firewall"), gettext("Aliases"));
$shortcut_section = "aliases";
include("head.inc");
@@ -180,10 +180,10 @@ include("head.inc");
<td class="tabnavtbl">
<?php
$tab_array = array();
- $tab_array[] = array(gettext("IP"),($tab=="ip" ? true : ($tab=="host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip");
- $tab_array[] = array(gettext("Ports"), ($tab=="port"? true : false), "/firewall_aliases.php?tab=port");
- $tab_array[] = array(gettext("URLs"), ($tab=="url"? true : false), "/firewall_aliases.php?tab=url");
- $tab_array[] = array(gettext("All"), ($tab=="all"? true : false), "/firewall_aliases.php?tab=all");
+ $tab_array[] = array(gettext("IP"), ($tab == "ip" ? true : ($tab == "host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip");
+ $tab_array[] = array(gettext("Ports"), ($tab == "port"? true : false), "/firewall_aliases.php?tab=port");
+ $tab_array[] = array(gettext("URLs"), ($tab == "url"? true : false), "/firewall_aliases.php?tab=url");
+ $tab_array[] = array(gettext("All"), ($tab == "all"? true : false), "/firewall_aliases.php?tab=all");
display_top_tabs($tab_array);
?>
<input type="hidden" name="tab" value="<?=htmlspecialchars($tab);?>" />
@@ -198,7 +198,7 @@ include("head.inc");
<td width="43%" class="listhdrr"><?=gettext("Values"); ?></td>
<td width="30%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="7%" class="list">
- <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
<tr>
<td valign="middle" width="17">&nbsp;</td>
<td valign="middle"><a href="firewall_aliases_edit.php?tab=<?=$tab?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" <?=dom_title(gettext("Add a new alias"));?> alt="add" /></a></td>
@@ -208,21 +208,21 @@ include("head.inc");
</tr>
<?php
asort($a_aliases);
- foreach ($a_aliases as $i=> $alias){
+ foreach ($a_aliases as $i=> $alias) {
unset ($show_alias);
- switch ($tab){
+ switch ($tab) {
case "all":
$show_alias= true;
break;
case "ip":
case "host":
case "network":
- if (preg_match("/(host|network)/",$alias["type"])) {
+ if (preg_match("/(host|network)/", $alias["type"])) {
$show_alias= true;
}
break;
case "url":
- if (preg_match("/(url)/i",$alias["type"])) {
+ if (preg_match("/(url)/i", $alias["type"])) {
$show_alias= true;
}
break;
diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php
index 81b38e1..d78c500 100755
--- a/usr/local/www/firewall_aliases_edit.php
+++ b/usr/local/www/firewall_aliases_edit.php
@@ -50,7 +50,7 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Edit"));
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php');
@@ -93,7 +93,7 @@ function alias_same_type($name, $type) {
in_array($alias['type'], array("host", "network"))) {
return true;
}
- if ($type == $alias['type']) {
+ if ($type == $alias['type']) {
return true;
} else {
return false;
@@ -194,7 +194,7 @@ if ($_POST) {
$alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7;
if (!is_URL($alias['url']) || empty($alias['url'])) {
$input_errors[] = gettext("You must provide a valid URL.");
- } elseif (! process_alias_urltable($alias['name'], $alias['url'], 0, true)) {
+ } elseif (!process_alias_urltable($alias['name'], $alias['url'], 0, true)) {
$input_errors[] = gettext("Unable to fetch usable data.");
}
if ($_POST["detail0"] <> "") {
@@ -214,7 +214,7 @@ if ($_POST) {
$desc_fmt_err_found = false;
/* item is a url type */
- for ($x=0; $x<$max_alias_addresses-1; $x++) {
+ for ($x = 0; $x < $max_alias_addresses - 1; $x++) {
$_POST['address' . $x] = trim($_POST['address' . $x]);
if ($_POST['address' . $x]) {
/* fetch down and add in */
@@ -278,7 +278,7 @@ if ($_POST) {
// Users can paste strings like "10.1.2.0/24 10.3.0.0/16 9.10.11.0/24" into an address box.
// They can also put an IP range.
// This loop expands out that stuff so it can easily be validated.
- for ($x=0; $x<($max_alias_addresses-1); $x++) {
+ for ($x = 0; $x < ($max_alias_addresses - 1); $x++) {
if ($_POST["address{$x}"] <> "") {
if ($_POST["detail{$x}"] <> "") {
if ((strpos($_POST["detail{$x}"], "||") === false) && (substr($_POST["detail{$x}"], 0, 1) != "|") && (substr($_POST["detail{$x}"], -1, 1) != "|")) {
diff --git a/usr/local/www/firewall_aliases_import.php b/usr/local/www/firewall_aliases_import.php
index 5660717..09a2b79 100755
--- a/usr/local/www/firewall_aliases_import.php
+++ b/usr/local/www/firewall_aliases_import.php
@@ -47,7 +47,7 @@ require_once("util.inc");
require_once("filter.inc");
require("shaper.inc");
-$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Bulk import"));
+$pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Bulk import"));
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php');
@@ -68,7 +68,7 @@ $a_aliases = &$config['aliases']['alias'];
if ($_POST['aliasimport'] <> "") {
$reqdfields = explode(" ", "name aliasimport");
- $reqdfieldsn = array(gettext("Name"),gettext("Aliases"));
+ $reqdfieldsn = array(gettext("Name"), gettext("Aliases"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -104,7 +104,7 @@ if ($_POST['aliasimport'] <> "") {
$desc_len_err_found = false;
$desc_fmt_err_found = false;
foreach ($tocheck as $impline) {
- $implinea = explode(" ",trim($impline),2);
+ $implinea = explode(" ", trim($impline), 2);
$impip = $implinea[0];
$impdesc = trim($implinea[1]);
if (strlen($impdesc) < 200) {
diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php
index 2fba0b7..70c8041 100644
--- a/usr/local/www/firewall_nat.php
+++ b/usr/local/www/firewall_nat.php
@@ -106,7 +106,7 @@ if (isset($_POST['del_x'])) {
foreach ($_POST['rule'] as $rulei) {
$target = $rule['target'];
// Check for filter rule associations
- if (isset($a_nat[$rulei]['associated-rule-id'])){
+ if (isset($a_nat[$rulei]['associated-rule-id'])) {
delete_id($a_nat[$rulei]['associated-rule-id'], $config['filter']['rule']);
mark_subsystem_dirty('filter');
@@ -171,7 +171,7 @@ if (isset($_POST['del_x'])) {
}
$closehead = false;
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Port Forward"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"));
include("head.inc");
echo "<script type=\"text/javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
@@ -251,7 +251,7 @@ echo "<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></
$alias_dst_span_end = $alias_popup["dst_end"];
$alias_dst_port_span_end = $alias_popup["dstport_end"];
- $alias_popup = rule_popup("","",$natent['target'], pprint_port($natent['local-port']));
+ $alias_popup = rule_popup("", "", $natent['target'], pprint_port($natent['local-port']));
$alias_target_span_begin = $alias_popup["dst"];
$alias_local_port_span_begin = $alias_popup["dstport"];
diff --git a/usr/local/www/firewall_nat_1to1.php b/usr/local/www/firewall_nat_1to1.php
index fea2dd4..10b48dc 100644
--- a/usr/local/www/firewall_nat_1to1.php
+++ b/usr/local/www/firewall_nat_1to1.php
@@ -157,7 +157,7 @@ if (isset($_POST['del_x'])) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("1:1"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("1:1"));
include("head.inc");
?>
diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php
index 5964c5d..37c25ca 100644
--- a/usr/local/www/firewall_nat_1to1_edit.php
+++ b/usr/local/www/firewall_nat_1to1_edit.php
@@ -116,7 +116,7 @@ if ($_POST) {
$temp = str_replace(">", "", $value);
$newpost = htmlentities($temp);
if ($newpost <> $temp) {
- $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."),$temp);
+ $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."), $temp);
}
}
@@ -241,7 +241,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("1:1"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("1:1"), gettext("Edit"));
include("head.inc");
?>
@@ -390,8 +390,8 @@ if ($input_errors) {
<?php
$sel = is_specialnet($pconfig['src']);
?>
- <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
- <option value="single" <?php if ((($pconfig['srcmask'] == 32) || !isset($pconfig['srcmask'])) && !$sel) { echo "selected=\"selected\""; $sel = 1; } ?>>
+ <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
+ <option value="single" <?php if ((($pconfig['srcmask'] == 32) || !isset($pconfig['srcmask'])) && !$sel) { echo "selected=\"selected\""; $sel = 1; } ?>>
<?=gettext("Single host"); ?>
</option>
<option value="network" <?php if (!$sel) echo "selected=\"selected\""; ?>><?=gettext("Network"); ?></option>
@@ -417,7 +417,7 @@ if ($input_errors) {
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected=\"selected\""; } ?>>
<?=htmlspecialchars($ifdesc);?> <?=gettext("net"); ?>
</option>
- <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
+ <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
<?=$ifdesc?> <?=gettext("address");?>
</option>
<?php
diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php
index ce6d31b..7015f65 100644
--- a/usr/local/www/firewall_nat_edit.php
+++ b/usr/local/www/firewall_nat_edit.php
@@ -214,10 +214,10 @@ if ($_POST) {
/* input validation */
if (strtoupper($_POST['proto']) == "TCP" or strtoupper($_POST['proto']) == "UDP" or strtoupper($_POST['proto']) == "TCP/UDP") {
$reqdfields = explode(" ", "interface proto dstbeginport dstendport");
- $reqdfieldsn = array(gettext("Interface"),gettext("Protocol"),gettext("Destination port from"),gettext("Destination port to"));
+ $reqdfieldsn = array(gettext("Interface"), gettext("Protocol"), gettext("Destination port from"), gettext("Destination port to"));
} else {
$reqdfields = explode(" ", "interface proto");
- $reqdfieldsn = array(gettext("Interface"),gettext("Protocol"));
+ $reqdfieldsn = array(gettext("Interface"), gettext("Protocol"));
}
if ($_POST['srctype'] == "single" || $_POST['srctype'] == "network") {
@@ -276,8 +276,8 @@ if ($_POST) {
}
/* if user enters an alias and selects "network" then disallow. */
- if (($_POST['srctype'] == "network" && is_alias($_POST['src']) ) ||
- ($_POST['dsttype'] == "network" && is_alias($_POST['dst']) )) {
+ if (($_POST['srctype'] == "network" && is_alias($_POST['src'])) ||
+ ($_POST['dsttype'] == "network" && is_alias($_POST['dst']))) {
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
}
@@ -332,7 +332,7 @@ if ($_POST) {
continue;
}
- list($begp,$endp) = explode("-", $natent['destination']['port']);
+ list($begp, $endp) = explode("-", $natent['destination']['port']);
if (!$endp) {
$endp = $begp;
}
@@ -405,15 +405,15 @@ if ($_POST) {
$need_filter_rule = true;
}
// Create a rule or if we want to create a new one
- if ($natent['associated-rule-id']=='new') {
+ if ($natent['associated-rule-id'] == 'new') {
$need_filter_rule = true;
- unset( $natent['associated-rule-id'] );
+ unset($natent['associated-rule-id']);
$_POST['filter-rule-association']='add-associated';
}
// If creating a new rule, where we want to add the filter rule, associated or not
else if (isset($_POST['filter-rule-association']) &&
- ($_POST['filter-rule-association']=='add-associated' ||
- $_POST['filter-rule-association']=='add-unassociated')) {
+ ($_POST['filter-rule-association'] == 'add-associated' ||
+ $_POST['filter-rule-association'] == 'add-unassociated')) {
$need_filter_rule = true;
}
@@ -456,7 +456,7 @@ if ($_POST) {
$filterent['descr'] = substr("NAT " . $_POST['descr'], 0, 62);
// If this is a new rule, create an ID and add the rule
- if ($_POST['filter-rule-association']=='add-associated') {
+ if ($_POST['filter-rule-association'] == 'add-associated') {
$filterent['associated-rule-id'] = $natent['associated-rule-id'] = get_unique_id();
$filterent['created'] = make_config_revision_entry(null, gettext("NAT Port Forward"));
$config['filter']['rule'][] = $filterent;
@@ -496,7 +496,7 @@ if ($_POST) {
}
$closehead = false;
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Port Forward"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"), gettext("Edit"));
include("head.inc");
?>
@@ -536,7 +536,7 @@ include("fbegin.inc"); ?>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
<td width="78%" class="vtable">
- <select name="interface" class="formselect" onchange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
+ <select name="interface" class="formselect" onchange="dst_change(this.value, iface_old, document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
<?php
$iflist = get_configured_interface_with_descr(false, true);
// Allow extending of the firewall edit interfaces
@@ -623,24 +623,24 @@ include("fbegin.inc"); ?>
<select name="srctype" class="formselect" onchange="typesel_change()">
<?php
$sel = is_specialnet($pconfig['src']); ?>
- <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
- <option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected=\"selected\""; $sel = 1; } ?>><?=gettext("Single host or alias"); ?></option>
+ <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
+ <option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected=\"selected\""; $sel = 1; } ?>><?=gettext("Single host or alias"); ?></option>
<option value="network" <?php if (!$sel) echo "selected=\"selected\""; ?>><?=gettext("Network"); ?></option>
<?php if (have_ruleint_access("pptp")): ?>
- <option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected=\"selected\""; } ?>><?=gettext("PPTP clients"); ?></option>
+ <option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected=\"selected\""; } ?>><?=gettext("PPTP clients"); ?></option>
<?php endif; ?>
<?php if (have_ruleint_access("pppoe")): ?>
- <option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected=\"selected\""; } ?>><?=gettext("PPPoE clients"); ?></option>
+ <option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected=\"selected\""; } ?>><?=gettext("PPPoE clients"); ?></option>
<?php endif; ?>
<?php if (have_ruleint_access("l2tp")): ?>
- <option value="l2tp" <?php if ($pconfig['src'] == "l2tp") { echo "selected=\"selected\""; } ?>><?=gettext("L2TP clients"); ?></option>
+ <option value="l2tp" <?php if ($pconfig['src'] == "l2tp") { echo "selected=\"selected\""; } ?>><?=gettext("L2TP clients"); ?></option>
<?php endif; ?>
<?php
foreach ($ifdisp as $ifent => $ifdesc):
if (have_ruleint_access($ifent)):
?>
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net"); ?></option>
- <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
+ <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
<?=$ifdesc?> <?=gettext("address");?>
</option>
<?php
@@ -898,7 +898,7 @@ include("fbegin.inc"); ?>
foreach ($config['filter']['rule'] as $filter_id => $filter_rule) {
if (isset($filter_rule['associated-rule-id'])) {
echo "<option value=\"{$filter_rule['associated-rule-id']}\"";
- if ($filter_rule['associated-rule-id']==$pconfig['associated-rule-id']) {
+ if ($filter_rule['associated-rule-id'] == $pconfig['associated-rule-id']) {
echo " selected=\"selected\"";
$linkedrule = "<br /><a href=\"firewall_rules_edit.php?id={$filter_id}\">" . gettext("View the filter rule") . "</a><br />";
}
@@ -994,7 +994,7 @@ include("fbegin.inc"); ?>
<script type="text/javascript">
//<![CDATA[
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("localip"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
diff --git a/usr/local/www/firewall_nat_npt.php b/usr/local/www/firewall_nat_npt.php
index 3fcfbf4..003bd88 100644
--- a/usr/local/www/firewall_nat_npt.php
+++ b/usr/local/www/firewall_nat_npt.php
@@ -79,7 +79,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"));
include("head.inc");
?>
diff --git a/usr/local/www/firewall_nat_npt_edit.php b/usr/local/www/firewall_nat_npt_edit.php
index 2f2531d..e4b5818 100644
--- a/usr/local/www/firewall_nat_npt_edit.php
+++ b/usr/local/www/firewall_nat_npt_edit.php
@@ -151,7 +151,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"), gettext("Edit"));
include("head.inc");
?>
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 1e942d2..d560abe 100644
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -228,7 +228,7 @@ if (isset($_POST['del_x'])) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound"));
include("head.inc");
?>
@@ -360,7 +360,7 @@ if (is_subsystem_dirty('natconf')) {
$alias_dst_span_begin = "";
$alias_dst_port_span_begin = "";
- $alias_popup = rule_popup($natent['source']['network'],pprint_port($natent['sourceport']),$natent['destination']['address'],pprint_port($natent['dstport']));
+ $alias_popup = rule_popup($natent['source']['network'], pprint_port($natent['sourceport']), $natent['destination']['address'], pprint_port($natent['dstport']));
$alias_src_span_begin = $alias_popup["src"];
$alias_src_port_span_begin = $alias_popup["srcport"];
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php
index d646e68..6471516 100644
--- a/usr/local/www/firewall_nat_out_edit.php
+++ b/usr/local/www/firewall_nat_out_edit.php
@@ -92,7 +92,7 @@ if (isset($id) && $a_out[$id]) {
}
$pconfig['protocol'] = $a_out[$id]['protocol'];
- list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']);
+ list($pconfig['source'], $pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']);
if (!is_numeric($pconfig['source_subnet'])) {
$pconfig['source_subnet'] = 32;
}
@@ -148,13 +148,13 @@ if ($_POST) {
$temp = str_replace(">", "", $value);
$newpost = htmlentities($temp);
if ($newpost <> $temp) {
- $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."),$temp);
+ $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."), $temp);
}
}
/* input validation */
$reqdfields = explode(" ", "interface protocol source source_subnet destination destination_subnet");
- $reqdfieldsn = array(gettext("Interface"),gettext("Protocol"),gettext("Source"),gettext("Source bit count"),gettext("Destination"),gettext("Destination bit count"));
+ $reqdfieldsn = array(gettext("Interface"), gettext("Protocol"), gettext("Source"), gettext("Source bit count"), gettext("Destination"), gettext("Destination bit count"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -364,7 +364,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound"), gettext("Edit"));
$closehead = false;
include("head.inc");
@@ -440,19 +440,19 @@ function proto_change() {
}
}
function poolopts_change() {
- if (jQuery('#target option:selected').text().trim().substring(0,4) == "Host") {
- jQuery('#poolopts_tr').css('display','');
- jQuery('#target_network').css('display','none');
- } else if (jQuery('#target option:selected').text().trim().substring(0,6) == "Subnet") {
- jQuery('#poolopts_tr').css('display','');
- jQuery('#target_network').css('display','none');
- } else if (jQuery('#target option:selected').text().trim().substring(0,5) == "Other") {
- jQuery('#poolopts_tr').css('display','');
- jQuery('#target_network').css('display','');
+ if (jQuery('#target option:selected').text().trim().substring(0, 4) == "Host") {
+ jQuery('#poolopts_tr').css('display', '');
+ jQuery('#target_network').css('display', 'none');
+ } else if (jQuery('#target option:selected').text().trim().substring(0, 6) == "Subnet") {
+ jQuery('#poolopts_tr').css('display', '');
+ jQuery('#target_network').css('display', 'none');
+ } else if (jQuery('#target option:selected').text().trim().substring(0, 5) == "Other") {
+ jQuery('#poolopts_tr').css('display', '');
+ jQuery('#target_network').css('display', '');
} else {
- jQuery('#poolopts').prop('selectedIndex',0);
- jQuery('#poolopts_tr').css('display','none');
- jQuery('#target_network').css('display','none');
+ jQuery('#poolopts').prop('selectedIndex', 0);
+ jQuery('#poolopts_tr').css('display', 'none');
+ jQuery('#target_network').css('display', 'none');
jQuery('#targetip').val('');
jQuery('#targetip_subnet').val('0');
}
@@ -525,7 +525,7 @@ function poolopts_change() {
}
/* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
}
@@ -558,7 +558,7 @@ function poolopts_change() {
</select><br />
<span class="vexpl"><?=gettext("Choose which protocol this rule should match.");?><br />
<?php
- printf(gettext("Hint: in most cases, you should specify %s any %s here."),"<em>","</em>&nbsp;");
+ printf(gettext("Hint: in most cases, you should specify %s any %s here."), "<em>", "</em>&nbsp;");
?>
</span>
</td>
@@ -887,7 +887,7 @@ function poolopts_change() {
poolopts_change();
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("source"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("sourceport"), new StateSuggestions(customarray));
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index f66ac10..d3e8f24 100644
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -47,7 +47,7 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-$pgtitle = array(gettext("Firewall"),gettext("Rules"));
+$pgtitle = array(gettext("Firewall"), gettext("Rules"));
$shortcut_section = "firewall";
function delete_nat_association($id) {
@@ -122,7 +122,7 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enabl
}
/* add openvpn/tun interfaces */
-if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
+if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$iflist["openvpn"] = "OpenVPN";
}
@@ -152,7 +152,7 @@ if ($_POST) {
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
- $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>");
+ $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"), "<a href='status_filter_reload.php'>", "</a>");
}
}
@@ -516,7 +516,7 @@ include("head.inc");
$alias_dst_span_begin = "";
$alias_dst_port_span_begin = "";
- $alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
+ $alias_popup = rule_popup($filterent['source']['address'], pprint_port($filterent['source']['port']), $filterent['destination']['address'], pprint_port($filterent['destination']['port']));
$alias_src_span_begin = $alias_popup["src"];
$alias_src_port_span_begin = $alias_popup["srcport"];
@@ -535,8 +535,8 @@ include("head.inc");
$sched_caption_escaped = "";
$sched_content = "";
$schedstatus = false;
- $dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
- $monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
+ $dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
+ $monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December'));
if ($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
foreach ($a_schedules as $schedule) {
if ($schedule['name'] == $filterent['sched']) {
@@ -559,7 +559,7 @@ include("head.inc");
if ($timerange['month']) {
$tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
+ $tempdayarray = explode(",", $timerange['day']);
$arraycounter = 0;
$firstDayFound = false;
$firstPrint = false;
@@ -584,7 +584,7 @@ include("head.inc");
if ($currentDay != $firstDay) {
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
} else {
- $dayFriendly .= $monthArray[$month-1] . " " . $day;
+ $dayFriendly .= $monthArray[$month-1] . " " . $day;
}
$firstDayFound = false;
$firstPrint = true;
@@ -702,7 +702,7 @@ include("head.inc");
}
break;
case 'openvpn':
- if ($config['openvpn']['openvpn-server'] || $config['openvpn']['openvpn-client']) {
+ if ($config['openvpn']['openvpn-server'] || $config['openvpn']['openvpn-client']) {
$selected_descs[] = 'OpenVPN';
}
break;
@@ -743,7 +743,7 @@ include("head.inc");
echo strtoupper($filterent['protocol']);
if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
echo ' <span style="cursor: help;" title="ICMP type: ' .
- ($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) .
+ ($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) .
'"><u>';
echo $filterent['icmptype'];
echo '</u></span>';
@@ -767,7 +767,7 @@ include("head.inc");
<?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
</td>
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
- <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
+ <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
</td>
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
<?=$textss;?>
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index 9d610ea..fa4a8eb 100644
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -328,7 +328,7 @@ if ($_POST) {
}
if (($_POST['proto'] == "icmp") && ($_POST['icmptype'] <> "")) {
if ($_POST['ipprotocol'] == "inet46") {
- $input_errors[] = gettext("You can not assign a ICMP type to a rule that applies to IPv4 and IPv6");
+ $input_errors[] = gettext("You can not assign a ICMP type to a rule that applies to IPv4 and IPv6");
}
}
@@ -389,7 +389,7 @@ if ($_POST) {
if (is_specialnet($_POST['dsttype'])) {
$_POST['dst'] = $_POST['dsttype'];
$_POST['dstmask'] = 0;
- } else if ($_POST['dsttype'] == "single") {
+ } else if ($_POST['dsttype'] == "single") {
if (is_ipaddrv6($_POST['dst'])) {
$_POST['dstmask'] = 128;
} else {
@@ -401,31 +401,31 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "type proto");
- if (isset($a_filter[$id]['associated-rule-id'])===false) {
+ if (isset($a_filter[$id]['associated-rule-id']) === false) {
$reqdfields[] = "src";
$reqdfields[] = "dst";
}
$reqdfieldsn = explode(",", "Type,Protocol");
- if (isset($a_filter[$id]['associated-rule-id'])===false) {
+ if (isset($a_filter[$id]['associated-rule-id']) === false) {
$reqdfieldsn[] = "Source";
$reqdfieldsn[] = "Destination";
}
if ($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state") {
if ($_POST['proto'] != "tcp") {
- $input_errors[] = sprintf(gettext("%s is only valid with protocol TCP."),$_POST['statetype']);
+ $input_errors[] = sprintf(gettext("%s is only valid with protocol TCP."), $_POST['statetype']);
}
if (($_POST['statetype'] == "synproxy state") && ($_POST['gateway'] != "")) {
- $input_errors[] = sprintf(gettext("%s is only valid if the gateway is set to 'default'."),$_POST['statetype']);
+ $input_errors[] = sprintf(gettext("%s is only valid if the gateway is set to 'default'."), $_POST['statetype']);
}
}
- if (isset($a_filter[$id]['associated-rule-id'])===false &&
+ if (isset($a_filter[$id]['associated-rule-id']) === false &&
(!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) {
$reqdfields[] = "srcmask";
$reqdfieldsn[] = "Source bit count";
}
- if (isset($a_filter[$id]['associated-rule-id'])===false &&
+ if (isset($a_filter[$id]['associated-rule-id']) === false &&
(!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) {
$reqdfields[] = "dstmask";
$reqdfieldsn[] = gettext("Destination bit count");
@@ -443,16 +443,16 @@ if ($_POST) {
}
if ($_POST['srcbeginport'] && !is_portoralias($_POST['srcbeginport'])) {
- $input_errors[] = sprintf(gettext("%s is not a valid start source port. It must be a port alias or integer between 1 and 65535."),$_POST['srcbeginposrt']);
+ $input_errors[] = sprintf(gettext("%s is not a valid start source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcbeginposrt']);
}
if ($_POST['srcendport'] && !is_portoralias($_POST['srcendport'])) {
- $input_errors[] = sprintf(gettext("%s is not a valid end source port. It must be a port alias or integer between 1 and 65535."),$_POST['srcendport']);
+ $input_errors[] = sprintf(gettext("%s is not a valid end source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcendport']);
}
if ($_POST['dstbeginport'] && !is_portoralias($_POST['dstbeginport'])) {
- $input_errors[] = sprintf(gettext("%s is not a valid start destination port. It must be a port alias or integer between 1 and 65535."),$_POST['dstbeginport']);
+ $input_errors[] = sprintf(gettext("%s is not a valid start destination port. It must be a port alias or integer between 1 and 65535."), $_POST['dstbeginport']);
}
if ($_POST['dstendport'] && !is_portoralias($_POST['dstendport'])) {
- $input_errors[] = sprintf(gettext("%s is not a valid end destination port. It must be a port alias or integer between 1 and 65535."),$_POST['dstendport']);
+ $input_errors[] = sprintf(gettext("%s is not a valid end destination port. It must be a port alias or integer between 1 and 65535."), $_POST['dstendport']);
}
if (!$_POST['srcbeginport_cust'] && $_POST['srcendport_cust']) {
if (is_alias($_POST['srcendport_cust'])) {
@@ -463,8 +463,8 @@ if ($_POST) {
if (is_alias($_POST['srcendport_cust']) && is_alias($_POST['srcendport_cust']) && $_POST['srcbeginport_cust'] != $_POST['srcendport_cust']) {
$input_errors[] = 'The same port alias must be used in Source port range from: and to: fields';
}
- if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust']!='')) ||
- ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust']!='') && is_alias($_POST['srcendport_cust']))) {
+ if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust'] != '')) ||
+ ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) {
$input_errors[] = 'You cannot specify numbers and port aliases at the same time in Source port range from: and to: field';
}
}
@@ -477,8 +477,8 @@ if ($_POST) {
if (is_alias($_POST['dstendport_cust']) && is_alias($_POST['dstendport_cust']) && $_POST['dstbeginport_cust'] != $_POST['dstendport_cust']) {
$input_errors[] = 'The same port alias must be used in Destination port range from: and to: fields';
}
- if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust']!='')) ||
- ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust']!='') && is_alias($_POST['dstendport_cust']))) {
+ if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust'] != '')) ||
+ ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) {
$input_errors[] = 'You cannot specify numbers and port aliases at the same time in Destination port range from: and to: field';
}
}
@@ -504,7 +504,7 @@ if ($_POST) {
if (!is_specialnet($_POST['srctype'])) {
if (($_POST['src'] && !is_ipaddroralias($_POST['src']))) {
- $input_errors[] = sprintf(gettext("%s is not a valid source IP address or alias."),$_POST['src']);
+ $input_errors[] = sprintf(gettext("%s is not a valid source IP address or alias."), $_POST['src']);
}
if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
$input_errors[] = gettext("A valid source bit count must be specified.");
@@ -512,7 +512,7 @@ if ($_POST) {
}
if (!is_specialnet($_POST['dsttype'])) {
if (($_POST['dst'] && !is_ipaddroralias($_POST['dst']))) {
- $input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."),$_POST['dst']);
+ $input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."), $_POST['dst']);
}
if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
$input_errors[] = gettext("A valid destination bit count must be specified.");
@@ -594,7 +594,7 @@ if ($_POST) {
}
}
- if (!in_array($_POST['proto'], array("tcp","tcp/udp"))) {
+ if (!in_array($_POST['proto'], array("tcp", "tcp/udp"))) {
if (!empty($_POST['max-src-conn'])) {
$input_errors[] = gettext("You can only specify the maximum number of established connections per host (advanced option) for TCP protocol.");
}
@@ -744,7 +744,7 @@ if ($_POST) {
$filterent['quick'] = $_POST['quick'];
}
$filterent['floating'] = "yes";
- if (isset($_POST['interface']) && count($_POST['interface']) > 0) {
+ if (isset($_POST['interface']) && count($_POST['interface']) > 0) {
$filterent['interface'] = implode(",", $_POST['interface']);
}
}
@@ -919,7 +919,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("Rules"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Rules"), gettext("Edit"));
$shortcut_section = "firewall";
$closehead = false;
@@ -1001,7 +1001,7 @@ include("head.inc");
$edit_disabled = "disabled";
if (is_array($config['nat']['rule'])) {
foreach ($config['nat']['rule'] as $index => $nat_rule) {
- if (isset($nat_rule['associated-rule-id']) && $nat_rule['associated-rule-id']==$pconfig['associated-rule-id']) {
+ if (isset($nat_rule['associated-rule-id']) && $nat_rule['associated-rule-id'] == $pconfig['associated-rule-id']) {
echo "<a href=\"firewall_nat_edit.php?id={$index}\">" . gettext("View the NAT rule") . "</a><br />";
break;
}
@@ -1065,7 +1065,7 @@ include("head.inc");
}
}
/* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
}
if (is_array($pconfig['interface'])) {
@@ -1091,7 +1091,7 @@ include("head.inc");
</td>
<td width="78%" class="vtable">
<select name="direction" class="formselect">
- <?php $directions = array('any','in','out');
+ <?php $directions = array('any', 'in', 'out');
foreach ($directions as $direction): ?>
<option value="<?=$direction;?>"
<?php if ($direction == $pconfig['direction']): ?>
@@ -1109,7 +1109,7 @@ include("head.inc");
<td width="78%" class="vtable">
<select name="ipprotocol" class="formselect" onchange="proto_change()">
<?php
- $ipproto = array('inet' => 'IPv4','inet6' => 'IPv6', 'inet46' => 'IPv4+IPv6');
+ $ipproto = array('inet' => 'IPv4', 'inet6' => 'IPv6', 'inet46' => 'IPv4+IPv6');
foreach ($ipproto as $proto => $name):
?>
<option value="<?=$proto;?>"
@@ -1213,7 +1213,7 @@ include("head.inc");
?>
<?php if (have_ruleint_access($ifent)): ?>
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net");?></option>
- <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
+ <option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected=\"selected\""; } ?>>
<?=$ifdesc?> <?=gettext("address");?>
</option>
<?php endif; ?>
@@ -1509,13 +1509,13 @@ include("head.inc");
$tcpflags1 = "<td width='40' class='nowrap'>set</td>";
$tcpflags2 = "<td width='40' class='nowrap'>out of</td>";
foreach ($tcpflags as $tcpflag) {
- $header .= "<td width='40' class='nowrap'><strong>" . strtoupper($tcpflag) . "</strong></td>\n";
- $tcpflags1 .= "<td width='40' class='nowrap'> <input type='checkbox' name='tcpflags1_{$tcpflag}' value='on' ";
+ $header .= "<td width='40' class='nowrap'><strong>" . strtoupper($tcpflag) . "</strong></td>\n";
+ $tcpflags1 .= "<td width='40' class='nowrap'> <input type='checkbox' name='tcpflags1_{$tcpflag}' value='on' ";
if (array_search($tcpflag, $setflags) !== false) {
$tcpflags1 .= "checked=\"checked\"";
}
$tcpflags1 .= " /></td>\n";
- $tcpflags2 .= "<td width='40' class='nowrap'> <input type='checkbox' name='tcpflags2_{$tcpflag}' value='on' ";
+ $tcpflags2 .= "<td width='40' class='nowrap'> <input type='checkbox' name='tcpflags2_{$tcpflag}' value='on' ";
if (array_search($tcpflag, $outofflags) !== false) {
$tcpflags2 .= "checked=\"checked\"";
}
@@ -1550,7 +1550,7 @@ include("head.inc");
<select name="statetype">
<option value="keep state" <?php if (!isset($pconfig['statetype']) or $pconfig['statetype'] == "keep state") echo "selected=\"selected\""; ?>><?=gettext("keep state");?></option>
<option value="sloppy state" <?php if ($pconfig['statetype'] == "sloppy state") echo "selected=\"selected\""; ?>><?=gettext("sloppy state");?></option>
- <option value="synproxy state"<?php if ($pconfig['statetype'] == "synproxy state") echo "selected=\"selected\""; ?>><?=gettext("synproxy state");?></option>
+ <option value="synproxy state"<?php if ($pconfig['statetype'] == "synproxy state") echo "selected=\"selected\""; ?>><?=gettext("synproxy state");?></option>
<option value="none"<?php if ($pconfig['statetype'] == "none") echo "selected=\"selected\""; ?>><?=gettext("none");?></option>
</select><br />
<span class="vexpl">
@@ -1926,7 +1926,7 @@ $has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]
<?php endif; ?>
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
- var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
+ var customarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
var oTextbox1 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
var oTextbox2 = new AutoSuggestControl(document.getElementById("srcbeginport_cust"), new StateSuggestions(customarray));
diff --git a/usr/local/www/firewall_schedule.php b/usr/local/www/firewall_schedule.php
index 347f806..e6b7a21 100644
--- a/usr/local/www/firewall_schedule.php
+++ b/usr/local/www/firewall_schedule.php
@@ -41,14 +41,14 @@
##|-PRIV
-$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
-$monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
+$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
+$monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December'));
require("guiconfig.inc");
require_once("filter.inc");
require("shaper.inc");
-$pgtitle = array(gettext("Firewall"),gettext("Schedules"));
+$pgtitle = array(gettext("Firewall"), gettext("Schedules"));
if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
@@ -76,7 +76,7 @@ if ($_GET['act'] == "del") {
}
if ($is_schedule_referenced == true) {
- $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"),$referenced_by);
+ $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"), $referenced_by);
} else {
unset($a_schedules[$_GET['id']]);
write_config();
@@ -137,7 +137,7 @@ include("head.inc");
if ($timerange['month']) {
$tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
+ $tempdayarray = explode(",", $timerange['day']);
$arraycounter = 0;
$firstDayFound = false;
$firstPrint = false;
@@ -162,7 +162,7 @@ include("head.inc");
if ($currentDay != $firstDay) {
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
} else {
- $dayFriendly .= $monthArray[$month-1] . " " . $day;
+ $dayFriendly .= $monthArray[$month-1] . " " . $day;
}
$firstDayFound = false;
$firstPrint = true;
diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php
index a6df301..c0b46c0 100644
--- a/usr/local/www/firewall_schedule_edit.php
+++ b/usr/local/www/firewall_schedule_edit.php
@@ -60,12 +60,12 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Schedules"), gettext("Edit"));
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php');
-$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
-$monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
+$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
+$monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December'));
if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
@@ -126,7 +126,7 @@ if ($_POST) {
$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
$timerangeFound = false;
- for ($x=0; $x<99; $x++) {
+ for ($x = 0; $x < 99; $x++) {
if ($_POST['schedule' . $x]) {
if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) {
$input_errors[] = sprintf(gettext("Invalid start time - '%s'"), $_POST['starttime' . $x]);
@@ -162,7 +162,7 @@ if ($_POST) {
$monthpos = strpos($currentselection, "m");
$daypos = strpos($currentselection, "d");
$monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1);
- $daystr .= substr($currentselection, $daypos+1);
+ $daystr .= substr($currentselection, $daypos+1);
$firstprint = true;
}
}
@@ -220,8 +220,8 @@ $jscriptstr = <<<EOD
<script type="text/javascript">
//<![CDATA[
var daysSelected = "";
-var month_array = ['January','February','March','April','May','June','July','August','September','October','November','December'];
-var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
+var month_array = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+var day_array = ['Mon', 'Tues', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun'];
var schCounter = 0;
function rgb2hex(rgb) {
@@ -239,10 +239,10 @@ function repeatExistingDays() {
var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
var dayarray = daysSelected.split(",");
- for (i=0; i<=dayarray.length; i++) {
+ for (i = 0; i <= dayarray.length; i++) {
tempstr = dayarray[i];
tempstrdaypos = tempstr.search("p");
- week = tempstr.substring(1,tempstrdaypos);
+ week = tempstr.substring(1, tempstrdaypos);
week = parseInt(week);
dashpos = tempstr.search("-");
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
@@ -253,21 +253,21 @@ function repeatExistingDays() {
daycell = eval('document.getElementById(tempstr)');
if (daydone == "-1") {
if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
- daytogglerepeating(week,daypos,true);
+ daytogglerepeating(week, daypos, true);
} else {
- daytogglerepeating(week,daypos,false);
+ daytogglerepeating(week, daypos, false);
}
dayposdone += daypos + ",";
}
}
}
-function daytogglerepeating(week,daypos,bExists) {
+function daytogglerepeating(week, daypos, bExists) {
var tempstr, daycell, dayoriginal = "";
for (j=1; j<=53; j++) {
tempstr = 'w' + j + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
- dayoriginalpos = daysSelected.indexOf(tempstr);
+ dayoriginalpos = daysSelected.indexOf(tempstr);
//if bExists set to true, means cell is already select it
//unselect it and remove original day from daysSelected string
@@ -295,7 +295,7 @@ function daytoggle(id) {
iddashpos = id.search("-");
var tempstrdaypos = id.search("p");
- var week = id.substring(1,tempstrdaypos);
+ var week = id.substring(1, tempstrdaypos);
week = parseInt(week);
if (iddashpos == "-1") {
@@ -303,8 +303,8 @@ function daytoggle(id) {
runrepeat = true;
var daypos = id.substr(tempstrdaypos+1);
} else {
- idmod = id.substring(0,iddashpos);
- var daypos = id.substring(tempstrdaypos+1,iddashpos);
+ idmod = id.substring(0, iddashpos);
+ var daypos = id.substring(tempstrdaypos+1, iddashpos);
}
daypos = parseInt(daypos);
@@ -318,14 +318,14 @@ function daytoggle(id) {
str = id + ",";
daysSelected = daysSelected.replace(str, "");
} else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
- daytogglerepeating(week,daypos,true);
+ daytogglerepeating(week, daypos, true);
} else {
//color is white cell
if (!runrepeat) {
daycell.style.backgroundColor = "#FF0000"; // red
} else {
daycell.style.backgroundColor = "#F08080"; // lightcoral
- daytogglerepeating(week,daypos,false);
+ daytogglerepeating(week, daypos, false);
}
daysSelected += id + ",";
}
@@ -343,7 +343,7 @@ function update_month() {
var indexNum = document.forms[0].monthsel.selectedIndex;
var selected = document.forms[0].monthsel.options[indexNum].text;
- for (i=0; i<=11; i++) {
+ for (i = 0; i <= 11; i++) {
option = document.forms[0].monthsel.options[i].text;
document.popupMonthLayer = eval('document.getElementById (option)');
@@ -413,7 +413,7 @@ function addTimeRange() {
//check for existing entries
var findCurrentCounter;
- for (u=0; u<99; u++) {
+ for (u = 0; u < 99; u++) {
findCurrentCounter = document.getElementById("schedule" + u);
if (!findCurrentCounter) {
schCounter = u;
@@ -423,11 +423,11 @@ function addTimeRange() {
if (daysSelected != "") {
//get days selected
- for (i=0; i<tempdayarray.length; i++) {
+ for (i = 0; i < tempdayarray.length; i++) {
tempstr = tempdayarray[i];
if (tempstr != "") {
tempstrdaypos = tempstr.search("p");
- week = tempstr.substring(1,tempstrdaypos);
+ week = tempstr.substring(1, tempstrdaypos);
week = parseInt(week);
dashpos = tempstr.search("-");
@@ -461,7 +461,7 @@ function addTimeRange() {
var tempFriendlyMonthArray = monthstr.split(",");
var tempFriendlyDayArray = daystr.split(",");
var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = "";
- for (k=0; k<tempFriendlyMonthArray.length; k++) {
+ for (k = 0; k < tempFriendlyMonthArray.length; k++) {
tempstr = tempFriendlyMonthArray[k];
if (tempstr != "") {
if (!firstDayFound) {
@@ -502,7 +502,7 @@ function addTimeRange() {
tempFriendlyDayArray = rtempFriendlyDay.split(",");
tempFriendlyDayArray.sort();
currentDay, firstDay, nextDay = "";
- for (k=0; k<tempFriendlyDayArray.length; k++) {
+ for (k = 0; k < tempFriendlyDayArray.length; k++) {
tempstr = tempFriendlyDayArray[k];
if (tempstr != "") {
if (!firstDayFound) {
@@ -538,7 +538,7 @@ function addTimeRange() {
tempsortArray.sort();
//clear tempID
rtempID = "";
- for (t=0; t<tempsortArray.length; t++) {
+ for (t = 0; t < tempsortArray.length; t++) {
if (tempsortArray[t] != "") {
if (!isFirstdone) {
rtempID += tempsortArray[t];
@@ -551,7 +551,7 @@ function addTimeRange() {
//get time specified
- starttimehour = document.getElementById("starttimehour").value
+ starttimehour = document.getElementById("starttimehour").value
starttimemin = document.getElementById("starttimemin").value;
stoptimehour = document.getElementById("stoptimehour").value;
stoptimemin = document.getElementById("stoptimemin").value;
@@ -694,7 +694,7 @@ function editRow(incTime, el) {
document.getElementById("timerangedescr").value = descr;
//toggle the appropriate days
- for (i=0; i<tempdayArray.length; i++) {
+ for (i = 0; i < tempdayArray.length; i++) {
if (tempdayArray[i]) {
var tempweekstr = tempdayArray[i];
dashpos = tempweekstr.search("-");
@@ -762,7 +762,7 @@ EOD;
<td width="15%" valign="top" class="vncellreq"><?=gettext("Schedule Name");?></td>
<td width="85%" class="vtable">
<?php if (is_schedule_inuse($pconfig['name']) == true): ?>
- <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
<?php echo $pconfig['name']; ?>
<p>
<span class="vexpl"><?=gettext("NOTE: This schedule is in use so the name may not be modified!");?></span>
@@ -793,7 +793,7 @@ EOD;
$monthcounter = date("n");
$monthlimit = $monthcounter + 12;
$yearcounter = date("Y");
- for ($k=0; $k<12; $k++) {?>
+ for ($k = 0; $k < 12; $k++) {?>
<option value="<?php echo $monthcounter;?>"><?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></option>
<?php
if ($monthcounter == 12) {
@@ -809,7 +809,7 @@ EOD;
$firstmonth = TRUE;
$monthcounter = date("n");
$yearcounter = date("Y");
- for ($k=0; $k<12; $k++) {
+ for ($k = 0; $k < 12; $k++) {
$firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
if ($firstdayofmonth == 0) {
$firstdayofmonth = 7;
@@ -822,7 +822,7 @@ EOD;
$lasttr = FALSE;
$positioncounter = 1;//7 for Sun, 1 for Mon, 2 for Tues, etc
?>
- <div id="<?php echo date("F_y",mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if ($firstmonth)echo "block";else echo "none";?>">
+ <div id="<?php echo date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?>" style=" position:relative; display:<?php if ($firstmonth)echo "block";else echo "none";?>">
<table border="1" cellspacing="1" cellpadding="1" id="calTable<?=$monthcounter . $yearcounter;?>" class="tabcont" summary="month">
<tr>
<td colspan="7" align="center" class="listbg"><b><?php echo date("F_Y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));?></b></td>
@@ -839,7 +839,7 @@ EOD;
<?php
$firstmonth = FALSE;
while ($daycounter<=$numberofdays) {
- $weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
+ $weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
$weekcounter = ltrim($weekcounter, "0");
if ($positioncounter == 1) {
echo "<tr>";
@@ -898,7 +898,7 @@ EOD;
<td>
<select name="starttimehour" class="formselect" id="starttimehour">
<?php
- for ($i=0; $i<24; $i++) {
+ for ($i = 0; $i < 24; $i++) {
echo "<option value=\"$i\">";
echo $i;
echo "</option>";
@@ -917,8 +917,8 @@ EOD;
<td>
<select name="stoptimehour" class="formselect" id="stoptimehour">
<?php
- for ($i=0; $i<24; $i++) {
- if ($i==23) {
+ for ($i = 0; $i < 24; $i++) {
+ if ($i == 23) {
$selected = "selected=\"selected\"";
} else {
$selected = "";
@@ -955,7 +955,7 @@ EOD;
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <input type="button" value="<?=gettext("Add Time");?>" class="formbtn" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
+ <input type="button" value="<?=gettext("Add Time");?>" class="formbtn" onclick="javascript:processEntries();" />&nbsp;&nbsp;&nbsp;
<input type="button" value="<?=gettext("Clear Selection");?>" class="formbtn" onclick="javascript:clearCalendar(); clearTime(); clearDescr();" />
</td>
</tr>
@@ -1005,7 +1005,7 @@ EOD;
if ($timerange['month']) {
$tempmontharray = explode(",", $timerange['month']);
- $tempdayarray = explode(",",$timerange['day']);
+ $tempdayarray = explode(",", $timerange['day']);
$arraycounter = 0;
foreach ($tempmontharray as $monthtmp) {
$month = $tempmontharray[$arraycounter];
@@ -1021,7 +1021,7 @@ EOD;
if ($firstPrint) {
$tempID .= ",";
}
- $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
+ $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
$firstPrint = true;
if (!$firstDayFound) {
@@ -1041,7 +1041,7 @@ EOD;
if ($currentDay != $firstDay) {
$tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
} else {
- $tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
+ $tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
}
$firstDayFound = false;
$firstprint2 = true;
diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php
index 043200b..7b8f489 100644
--- a/usr/local/www/firewall_shaper.php
+++ b/usr/local/www/firewall_shaper.php
@@ -52,7 +52,7 @@ if ($_GET['reset'] <> "") {
exit;
}
-$pgtitle = array(gettext("Firewall"),gettext("Traffic Shaper"));
+$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"));
$shortcut_section = "trafficshaper";
$shaperIFlist = get_configured_interface_with_descr();
@@ -163,7 +163,7 @@ if ($_GET) {
$q = new cbq_queue();
break;
default:
- /* XXX: Happens when sched==NONE?! */
+ /* XXX: Happens when sched == NONE?! */
$q = new altq_root_queue();
break;
}
@@ -194,8 +194,9 @@ if ($_GET) {
if ($queue) {
$queue->SetEnabled("on");
$output_form .= $queue->build_form();
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('shaper');
+ }
} else {
$input_errors[] = gettext("Queue not found!");
}
@@ -333,7 +334,7 @@ if ($_GET) {
}
read_altq_config();
$output_form .= $queue->build_form();
- } else {
+ } else {
$output_form .= $default_shaper_msg;
$dontshow = true;
}
@@ -405,7 +406,7 @@ if (!$dontshow || $newqueue) {
$output_form .= "</table>";
}
-$output = "<table summary=\"output form\">";
+$output = "<table summary=\"output form\">";
$output .= $output_form;
//$pgtitle = "Firewall: Shaper: By Interface View";
diff --git a/usr/local/www/firewall_shaper_layer7.php b/usr/local/www/firewall_shaper_layer7.php
index ae38988..9a72233 100644
--- a/usr/local/www/firewall_shaper_layer7.php
+++ b/usr/local/www/firewall_shaper_layer7.php
@@ -46,7 +46,7 @@ require_once("shaper.inc");
// Variables protocols (dynamic) and structures (static)
$avail_protos =& generate_protocols_array();
-$avail_structures = array("action","queue","limiter");
+$avail_structures = array("action", "queue", "limiter");
// Available behaviours
$avail_behaviours_action = array("block");
@@ -57,7 +57,7 @@ $avail_behaviours_limiter = get_dummynet_name_list();
$show_proto_form = false;
//More variables
-$pgtitle = array(gettext("Firewall"),gettext("Traffic Shaper"), gettext("Layer7"));
+$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Layer7"));
$shortcut_section = "trafficshaper";
$output_form = "";
@@ -131,17 +131,17 @@ if ($_GET) {
$l7r =& new layer7();
$_POST['divert_port'] = $l7r->gen_divert_port();
}
- for ($i=0; $_POST['protocol'][$i] <> ""; $i++) {
+ for ($i = 0; $_POST['protocol'][$i] <> ""; $i++) {
$_POST['l7rules'][$i]['protocol'] = $_POST['protocol'][$i];
$_POST['l7rules'][$i]['structure'] = $_POST['structure'][$i];
$_POST['l7rules'][$i]['behaviour'] = $_POST['behaviour'][$i];
}
- $l7r->validate_input($_POST,$input_errors);
+ $l7r->validate_input($_POST, $input_errors);
$l7r->ReadConfig($_POST['container'], $_POST);
//Before writing the results, we need to test for repeated protocols
$non_dupes = array();
$dupes = array();
- for ($j=0; $j<$i; $j++) {
+ for ($j = 0; $j < $i; $j++) {
if (!$non_dupes[$_POST['protocol'][$j]]) {
$non_dupes[$_POST['protocol'][$j]] = true;
} else {
@@ -340,7 +340,7 @@ function changeBehaviourValues(row) {
//Build the html statement with the array values previously selected
var new_behav;
var name;
- for (i=0; i<a_behav.length; i++) {
+ for (i = 0; i < a_behav.length; i++) {
new_behav += "<option value=" + a_behav[i] + ">" + a_behav[i] + "<\/option>";
}
@@ -357,8 +357,8 @@ function addRow(table_id) {
initial_count[table_id] = rows_count;
}
// determining real count of added fields
- var tFielsNum = rows_count - initial_count[table_id];
- if (rows_limit!=0 && tFielsNum >= rows_limit) return false;
+ var tFielsNum = rows_count - initial_count[table_id];
+ if (rows_limit != 0 && tFielsNum >= rows_limit) return false;
var remove = '<a onclick="removeRow(\''+table_id+'\',this.parentNode.parentNode)" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="x" /><\/a>';
@@ -380,7 +380,7 @@ function addRow(table_id) {
}
/* Remove row from the table */
-function removeRow(tbl,row) {
+function removeRow(tbl, row) {
var table = document.getElementById(tbl);
try {
table.deleteRow(row.rowIndex);
@@ -402,7 +402,7 @@ function removeRow(tbl,row) {
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('shaper')): ?><p>
-<?php print_info_box_np(gettext("The traffic shaper configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /></p>
+<?php print_info_box_np(gettext("The traffic shaper configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /></p>
<?php endif; ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="traffic shaper layer7">
<tr><td>
@@ -434,7 +434,7 @@ function removeRow(tbl,row) {
?>
<br /><br />
<a href="firewall_shaper_layer7.php?action=add">
- <img src="./themes/<?=$g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("Create new l7 rules group"); ?>" width="17" height="17" border="0" alt="add" /> <?=gettext("Create new l7 rules group"); ?>
+ <img src="./themes/<?=$g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("Create new l7 rules group"); ?>" width="17" height="17" border="0" alt="add" /> <?=gettext("Create new l7 rules group"); ?>
</a>
<br />
</td>
@@ -489,14 +489,14 @@ function removeRow(tbl,row) {
<tr>
<td>
<select name="protocol[]" class="formselect" style="font-size:8pt">
- <?php foreach ($avail_protos as $proto): ?>
+ <?php foreach ($avail_protos as $proto): ?>
<option value="<?=$proto;?>" <?php if ($proto == $l7rule->GetRProtocol()) echo "selected=\"selected\""; ?>><?=$proto;?></option>
- <?php endforeach; ?>
+ <?php endforeach; ?>
</select>
</td>
<td>
<select name="structure[]" class="formselect" style="font-size:8pt" onchange="changeBehaviourValues(this.parentNode.parentNode);">
- <?php foreach ($avail_structures as $struct) {
+ <?php foreach ($avail_structures as $struct) {
if ($struct == "queue") {
if (!empty($avail_behaviours_altq)) { ?>
<option value="<?=$struct ?>" <?php if ($struct == $l7rule->GetRStructure()) echo "selected=\"selected\""; ?>><?=$struct;?></option>
@@ -535,7 +535,7 @@ function removeRow(tbl,row) {
</select>
</td>
<td>
- <a onclick="removeRow('maintable',this.parentNode.parentNode); return false;" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="x" /></a>
+ <a onclick="removeRow('maintable', this.parentNode.parentNode); return false;" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="x" /></a>
</td>
</tr>
<?php
diff --git a/usr/local/www/firewall_shaper_vinterface.php b/usr/local/www/firewall_shaper_vinterface.php
index 8c979ae..ffa3f15 100644
--- a/usr/local/www/firewall_shaper_vinterface.php
+++ b/usr/local/www/firewall_shaper_vinterface.php
@@ -51,7 +51,7 @@ if ($_GET['reset'] <> "") {
exit;
}
-$pgtitle = array(gettext("Firewall"),gettext("Traffic Shaper"), gettext("Limiter"));
+$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Limiter"));
$shortcut_section = "trafficshaper-limiters";
read_dummynet_config();
@@ -121,7 +121,7 @@ if ($_GET) {
}
$output_form .= $queue->build_form();
} else {
- $input_errors[] = sprintf(gettext("No queue with name %s was found!"),$qname);
+ $input_errors[] = sprintf(gettext("No queue with name %s was found!"), $qname);
$output_form .= $dn_default_shaper_msg;
$dontshow = true;
}
@@ -305,7 +305,7 @@ if ($_GET) {
}
read_dummynet_config();
$output_form .= $queue->build_form();
- } else {
+ } else {
$output_form .= $dn_default_shaper_msg;
$dontshow = true;
}
diff --git a/usr/local/www/firewall_shaper_wizards.php b/usr/local/www/firewall_shaper_wizards.php
index 763aa58..583fdef 100644
--- a/usr/local/www/firewall_shaper_wizards.php
+++ b/usr/local/www/firewall_shaper_wizards.php
@@ -72,7 +72,7 @@ if ($_POST['apply']) {
clear_subsystem_dirty('shaper');
}
-$pgtitle = array(gettext("Firewall"),gettext("Traffic Shaper"),gettext("Wizards"));
+$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Wizards"));
$shortcut_section = "trafficshaper";
$wizards = array(
@@ -88,7 +88,7 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
-<?php include("fbegin.inc"); ?>
+<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="firewall_shaper_wizards.php" method="post" id="iform" name="iform">
@@ -112,7 +112,7 @@ include("head.inc");
<tr>
<td>
<div id="mainarea">
- <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
<tr>
<td class="listhdrr" width="25%" align="center" ><?=gettext("Wizard function");?></td>
<td class="listhdrr" width="75%" align="center"><?=gettext("Wizard Link");?></td>
diff --git a/usr/local/www/firewall_virtual_ip.php b/usr/local/www/firewall_virtual_ip.php
index 200e9ac..148477f 100644
--- a/usr/local/www/firewall_virtual_ip.php
+++ b/usr/local/www/firewall_virtual_ip.php
@@ -107,7 +107,7 @@ if ($_GET['act'] == "del") {
/* make sure no inbound NAT mappings reference this entry */
if (is_array($config['nat']['rule'])) {
foreach ($config['nat']['rule'] as $rule) {
- if($rule['destination']['address'] <> "") {
+ if ($rule['destination']['address'] <> "") {
if ($rule['destination']['address'] == $a_vip[$_GET['id']]['subnet']) {
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping.");
break;
@@ -152,7 +152,7 @@ if ($_GET['act'] == "del") {
$if_subnet .= "/" . $if_subnet_bits;
if (is_array($config['gateways']['gateway_item'])) {
- foreach($config['gateways']['gateway_item'] as $gateway) {
+ foreach ($config['gateways']['gateway_item'] as $gateway) {
if ($a_vip[$_GET['id']]['interface'] != $gateway['interface']) {
continue;
}
@@ -242,7 +242,7 @@ if ($_GET['act'] == "del") {
$id = $_GET['id'];
}
-$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Addresses"));
+$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Addresses"));
include("head.inc");
?>
@@ -299,20 +299,20 @@ include("head.inc");
$interfaces['lo0'] = "Localhost";
$i = 0;
foreach ($a_vip as $vipent):
- if($vipent['subnet'] <> "" or $vipent['range'] <> "" or $vipent['subnet_bits'] <> "" or (isset($vipent['range']['from']) && $vipent['range']['from'] <> "")):
+ if ($vipent['subnet'] <> "" or $vipent['range'] <> "" or $vipent['subnet_bits'] <> "" or (isset($vipent['range']['from']) && $vipent['range']['from'] <> "")):
?>
<tr>
<td class="listlr" ondblclick="document.location='firewall_virtual_ip_edit.php?id=<?=$i;?>';">
<?php
if (($vipent['type'] == "single") || ($vipent['type'] == "network")) {
- if($vipent['subnet_bits']) {
+ if ($vipent['subnet_bits']) {
echo "{$vipent['subnet']}/{$vipent['subnet_bits']}";
}
}
if ($vipent['type'] == "range") {
echo "{$vipent['range']['from']}-{$vipent['range']['to']}";
}
- if($vipent['mode'] == "carp") {
+ if ($vipent['mode'] == "carp") {
echo " (vhid {$vipent['vhid']})";
}
?>
@@ -321,7 +321,7 @@ include("head.inc");
<?=htmlspecialchars($interfaces[$vipent['interface']]);?>&nbsp;
</td>
<td class="listr" align="center" ondblclick="document.location='firewall_virtual_ip_edit.php?id=<?=$i;?>';">
- <?php if($vipent['mode'] == "proxyarp") echo "<img src='./themes/".$g['theme']."/images/icons/icon_parp.gif' title='Proxy ARP' alt='proxy arp' />"; elseif($vipent['mode'] == "carp") echo "<img src='./themes/".$g['theme']."/images/icons/icon_carp.gif' title='CARP' alt='carp' />"; elseif($vipent['mode'] == "other") echo "<img src='./themes/".$g['theme']."/images/icons/icon_other.gif' title='Other' alt='other' />"; elseif($vipent['mode'] == "ipalias") echo "<img src='./themes/".$g['theme']."/images/icons/icon_ifalias.gif' title='IP Alias' alt='ip alias' />";?>
+ <?php if ($vipent['mode'] == "proxyarp") echo "<img src='./themes/".$g['theme']."/images/icons/icon_parp.gif' title='Proxy ARP' alt='proxy arp' />"; elseif ($vipent['mode'] == "carp") echo "<img src='./themes/".$g['theme']."/images/icons/icon_carp.gif' title='CARP' alt='carp' />"; elseif ($vipent['mode'] == "other") echo "<img src='./themes/".$g['theme']."/images/icons/icon_other.gif' title='Other' alt='other' />"; elseif ($vipent['mode'] == "ipalias") echo "<img src='./themes/".$g['theme']."/images/icons/icon_ifalias.gif' title='IP Alias' alt='ip alias' />";?>
</td>
<td class="listbg" ondblclick="document.location='firewall_virtual_ip_edit.php?id=<?=$i;?>';">
<?=htmlspecialchars($vipent['descr']);?>&nbsp;
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php
index 174f6ee..709f10c 100644
--- a/usr/local/www/firewall_virtual_ip_edit.php
+++ b/usr/local/www/firewall_virtual_ip_edit.php
@@ -186,7 +186,7 @@ if ($_POST) {
$idtracker = 0;
foreach ($config['virtualip']['vip'] as $vip) {
if ($vip['vhid'] == $_POST['vhid'] && $vip['interface'] == $_POST['interface'] && $idtracker <> $id) {
- $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."),$_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
+ $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."), $_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
}
$idtracker++;
}
@@ -214,7 +214,7 @@ if ($_POST) {
if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") &&
!ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
$cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ;
- $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find);
+ $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."), $cannot_find);
}
unset($parent_ip, $parent_sn, $subnet);
}
@@ -299,7 +299,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Address"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Address"), gettext("Edit"));
include("head.inc");
?>
@@ -337,9 +337,9 @@ function enable_change() {
document.iform.vhid.disabled = $mode != "carp";
document.iform.advskew.disabled = $mode != "carp";
document.iform.advbase.disabled = $mode != "carp";
- document.iform.type.disabled = $mode in {"carp":1,"ipalias":1};
+ document.iform.type.disabled = $mode in {"carp":1, "ipalias":1};
- if ($mode in {"carp":1,"ipalias":1}) {
+ if ($mode in {"carp":1, "ipalias":1}) {
document.iform.type.selectedIndex = 0;// single-adress
}
switch ($mode) {
@@ -357,13 +357,13 @@ function typesel_change() {
document.iform.subnet.disabled = 0;
document.iform.subnet_bits.disabled = (get_radio_value(document.iform.mode) == "proxyarp") || (get_radio_value(document.iform.mode) == "other");
document.iform.noexpand.disabled = 1;
- jQuery('#noexpandrow').css('display','none');
+ jQuery('#noexpandrow').css('display', 'none');
break;
case 1: // network
document.iform.subnet.disabled = 0;
document.iform.subnet_bits.disabled = 0;
document.iform.noexpand.disabled = 0;
- jQuery('#noexpandrow').css('display','');
+ jQuery('#noexpandrow').css('display', '');
//document.iform.range_from.disabled = 1;
//document.iform.range_to.disabled = 1;
break;
@@ -371,7 +371,7 @@ function typesel_change() {
document.iform.subnet.disabled = 1;
document.iform.subnet_bits.disabled = 1;
document.iform.noexpand.disabled = 1;
- jQuery('#noexpandrow').css('display','none');
+ jQuery('#noexpandrow').css('display', 'none');
//document.iform.range_from.disabled = 0;
//document.iform.range_to.disabled = 0;
break;
@@ -379,7 +379,7 @@ function typesel_change() {
document.iform.subnet.disabled = 1;
document.iform.subnet_bits.disabled = 0;
document.iform.noexpand.disabled = 1;
- jQuery('#noexpandrow').css('display','none');
+ jQuery('#noexpandrow').css('display', 'none');
//document.iform.range_from.disabled = 0;
//document.iform.range_to.disabled = 0;
break;
@@ -485,7 +485,7 @@ function typesel_change() {
</tr>
<tr valign="top">
<td width="22%" class="vncellreq"><?=gettext("Virtual IP Password");?></td>
- <td class="vtable"><input type='password' name='password' value="<?=htmlspecialchars($pconfig['password']);?>" />
+ <td class="vtable"><input type='password' name='password' value="<?=htmlspecialchars($pconfig['password']);?>" />
<br /><?=gettext("Enter the VHID group password.");?>
</td>
</tr>
diff --git a/usr/local/www/getserviceproviders.php b/usr/local/www/getserviceproviders.php
index 40365e6..cb456aa 100644
--- a/usr/local/www/getserviceproviders.php
+++ b/usr/local/www/getserviceproviders.php
@@ -41,7 +41,7 @@ require_once("pfsense-utils.inc");
$serviceproviders_xml = "/usr/local/share/mobile-broadband-provider-info/serviceproviders.xml";
$serviceproviders_contents = file_get_contents($serviceproviders_xml);
-$serviceproviders_attr = xml2array($serviceproviders_contents,1,"attr");
+$serviceproviders_attr = xml2array($serviceproviders_contents, 1, "attr");
$serviceproviders = &$serviceproviders_attr['serviceproviders']['country'];
@@ -74,7 +74,7 @@ function providers_list($country) {
}
}
-function provider_plan_data($country,$provider,$connection) {
+function provider_plan_data($country, $provider, $connection) {
header("Content-type: application/xml;");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<connection>\n";
@@ -100,7 +100,7 @@ function provider_plan_data($country,$provider,$connection) {
echo "<username>" . $conndata['username']['value'] . "</username>\n";
echo "<password>" . $conndata['password']['value'] . "</password>\n";
- $dns_arr = is_array($conndata['dns'][0]) ? $conndata['dns'] : array( $conndata['dns'] );
+ $dns_arr = is_array($conndata['dns'][0]) ? $conndata['dns'] : array($conndata['dns']);
foreach ($dns_arr as $dns) {
echo '<dns>' . $dns['value'] . "</dns>\n";
}
@@ -111,12 +111,12 @@ function provider_plan_data($country,$provider,$connection) {
echo "</connection>";
}
-function provider_plans_list($country,$provider) {
+function provider_plans_list($country, $provider) {
$serviceproviders = get_country_providers($country);
foreach ($serviceproviders as $sp) {
if (strtolower($sp['name']['value']) == strtolower($provider)) {
- if (array_key_exists('gsm',$sp)) {
- if (array_key_exists('attr',$sp['gsm']['apn'])) {
+ if (array_key_exists('gsm', $sp)) {
+ if (array_key_exists('attr', $sp['gsm']['apn'])) {
$name = ($sp['gsm']['apn']['name'] ? $sp['gsm']['apn']['name'] : $sp['name']['value']);
echo $name . ":" . $sp['gsm']['apn']['attr']['value'];
} else {
@@ -126,7 +126,7 @@ function provider_plans_list($country,$provider) {
}
}
}
- if (array_key_exists('cdma',$sp)) {
+ if (array_key_exists('cdma', $sp)) {
$name = $sp['cdma']['name']['value'] ? $sp['cdma']['name']['value']:$sp['name']['value'];
echo $name . ":" . "CDMA";
}
@@ -140,9 +140,9 @@ if (isset($_GET_OR_POST['country']) && !isset($_GET_OR_POST['provider'])) {
providers_list($_GET_OR_POST['country']);
} elseif (isset($_GET_OR_POST['country']) && isset($_GET_OR_POST['provider'])) {
if (isset($_GET_OR_POST['plan'])) {
- provider_plan_data($_GET_OR_POST['country'],$_GET_OR_POST['provider'],$_GET_OR_POST['plan']);
+ provider_plan_data($_GET_OR_POST['country'], $_GET_OR_POST['provider'], $_GET_OR_POST['plan']);
} else {
- provider_plans_list($_GET_OR_POST['country'],$_GET_OR_POST['provider']);
+ provider_plans_list($_GET_OR_POST['country'], $_GET_OR_POST['provider']);
}
} else {
country_list();
diff --git a/usr/local/www/getstats.php b/usr/local/www/getstats.php
index bca6557..886114b 100644
--- a/usr/local/www/getstats.php
+++ b/usr/local/www/getstats.php
@@ -37,9 +37,9 @@
##|*MATCH=getstats.php*
##|-PRIV
-header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
-header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
-header("Cache-Control: no-cache, no-store, must-revalidate" ); // HTTP/1.1
+header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
+header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
require_once("guiconfig.inc");
diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php
index cede7d9..d637836 100755
--- a/usr/local/www/graph.php
+++ b/usr/local/www/graph.php
@@ -43,16 +43,16 @@
require("globals.inc");
require("guiconfig.inc");
-header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
-header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
-header("Cache-Control: no-cache, no-store, must-revalidate" ); // HTTP/1.1
+header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
+header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
header("Content-type: image/svg+xml");
/********** HTTP GET Based Conf ***********/
-$ifnum=@$_GET["ifnum"]; // BSD / SNMP interface name / number
+$ifnum = @$_GET["ifnum"]; // BSD / SNMP interface name / number
$ifnum = get_real_interface($ifnum);
-$ifname=@$_GET["ifname"]?$_GET["ifname"]:"Interface $ifnum"; //Interface name that will be showed on top right of graph
+$ifname = @$_GET["ifname"]?$_GET["ifname"]:"Interface $ifnum"; //Interface name that will be showed on top right of graph
/********* Other conf *******/
if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) {
@@ -106,74 +106,78 @@ if (file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) {
/********* Graph DATA **************/
print('<?xml version="1.0" encoding="UTF-8"?>' . "\n");?>
<svg width="100%" height="100%" viewBox="0 0 <?=$width?> <?=$height?>" preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt)">
- <g id="graph">
- <rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
- <line id="axis_x" x1="0" y1="0" x2="0" y2="100%" <?=$attribs['axis']?>/>
- <line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?=$attribs['axis']?>/>
- <path id="graph_out" d="M0 <?=$height?> L 0 <?=$height?>" <?=$attribs['graph_out']?>/>
- <path id="graph_in" d="M0 <?=$height?> L 0 <?=$height?>" <?=$attribs['graph_in']?>/>
- <path id="grid" d="M0 <?=$height/4*1?> L <?=$width?> <?=$height/4*1?> M0 <?=$height/4*2?> L <?=$width?> <?=$height/4*2?> M0 <?=$height/4*3?> L <?=$width?> <?=$height/4*3?>" <?=$attribs['grid']?>/>
- <text id="grid_txt1" x="<?=$width?>" y="<?=$height/4*1?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
- <text id="grid_txt2" x="<?=$width?>" y="<?=$height/4*2?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
- <text id="grid_txt3" x="<?=$width?>" y="<?=$height/4*3?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
- <text id="graph_in_lbl" x="5" y="8" <?=$attribs['in']?>><?=gettext("In"); ?></text>
- <text id="graph_out_lbl" x="5" y="16" <?=$attribs['out']?>><?=gettext("Out"); ?></text>
- <text id="graph_in_txt" x="20" y="8" <?=$attribs['in']?>> </text>
- <text id="graph_out_txt" x="20" y="16" <?=$attribs['out']?>> </text>
- <text id="ifname" x="<?=$width?>" y="8" <?=$attribs['graphname']?> text-anchor="end"><?=htmlspecialchars($ifname)?></text>
- <text id="switch_unit" x="<?=$width*0.55?>" y="5" <?=$attribs['switch_unit']?>><?=gettext("Switch to bytes/s"); ?></text>
- <text id="switch_scale" x="<?=$width*0.55?>" y="11" <?=$attribs['switch_scale']?>><?=gettext("AutoScale"); ?> (<?=$scale_type?>)</text>
- <text id="date" x="<?=$width*0.33?>" y="5" <?=$attribs['legend']?>> </text>
- <text id="time" x="<?=$width*0.33?>" y="11" <?=$attribs['legend']?>> </text>
- <text id="graphlast" x="<?=$width*0.55?>" y="17" <?=$attribs['legend']?>><?=gettext("Graph shows last"); ?> <?=$time_interval*$nb_plot?> <?=gettext("seconds"); ?></text>
- <polygon id="axis_arrow_x" <?=$attribs['axis']?> points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
- <text id="error" x="<?=$width*0.5?>" y="<?=$height*0.5?>" visibility="hidden" <?=$attribs['error']?> text-anchor="middle"><?=$error_text?></text>
- <text id="collect_initial" x="<?=$width*0.5?>" y="<?=$height*0.5?>" visibility="hidden" <?=$attribs['collect_initial']?> text-anchor="middle"><?=gettext("Collecting initial data, please wait"); ?>...</text>
- </g>
- <script type="text/ecmascript">
- <![CDATA[
+ <g id="graph">
+ <rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
+ <line id="axis_x" x1="0" y1="0" x2="0" y2="100%" <?=$attribs['axis']?>/>
+ <line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?=$attribs['axis']?>/>
+ <path id="graph_out" d="M0 <?=$height?> L 0 <?=$height?>" <?=$attribs['graph_out']?>/>
+ <path id="graph_in" d="M0 <?=$height?> L 0 <?=$height?>" <?=$attribs['graph_in']?>/>
+ <path id="grid" d="M0 <?=$height/4*1?> L <?=$width?> <?=$height/4*1?> M0 <?=$height/4*2?> L <?=$width?> <?=$height/4*2?> M0 <?=$height/4*3?> L <?=$width?> <?=$height/4*3?>" <?=$attribs['grid']?>/>
+ <text id="grid_txt1" x="<?=$width?>" y="<?=$height/4*1?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
+ <text id="grid_txt2" x="<?=$width?>" y="<?=$height/4*2?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
+ <text id="grid_txt3" x="<?=$width?>" y="<?=$height/4*3?>" <?=$attribs['grid_txt']?> text-anchor="end"> </text>
+ <text id="graph_in_lbl" x="5" y="8" <?=$attribs['in']?>><?=gettext("In"); ?></text>
+ <text id="graph_out_lbl" x="5" y="16" <?=$attribs['out']?>><?=gettext("Out"); ?></text>
+ <text id="graph_in_txt" x="20" y="8" <?=$attribs['in']?>> </text>
+ <text id="graph_out_txt" x="20" y="16" <?=$attribs['out']?>> </text>
+ <text id="ifname" x="<?=$width?>" y="8" <?=$attribs['graphname']?> text-anchor="end"><?=htmlspecialchars($ifname)?></text>
+ <text id="switch_unit" x="<?=$width*0.55?>" y="5" <?=$attribs['switch_unit']?>><?=gettext("Switch to bytes/s"); ?></text>
+ <text id="switch_scale" x="<?=$width*0.55?>" y="11" <?=$attribs['switch_scale']?>><?=gettext("AutoScale"); ?> (<?=$scale_type?>)</text>
+ <text id="date" x="<?=$width*0.33?>" y="5" <?=$attribs['legend']?>> </text>
+ <text id="time" x="<?=$width*0.33?>" y="11" <?=$attribs['legend']?>> </text>
+ <text id="graphlast" x="<?=$width*0.55?>" y="17" <?=$attribs['legend']?>><?=gettext("Graph shows last"); ?> <?=$time_interval*$nb_plot?> <?=gettext("seconds"); ?></text>
+ <polygon id="axis_arrow_x" <?=$attribs['axis']?> points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
+ <text id="error" x="<?=$width*0.5?>" y="<?=$height*0.5?>" visibility="hidden" <?=$attribs['error']?> text-anchor="middle"><?=$error_text?></text>
+ <text id="collect_initial" x="<?=$width*0.5?>" y="<?=$height*0.5?>" visibility="hidden" <?=$attribs['collect_initial']?> text-anchor="middle"><?=gettext("Collecting initial data, please wait"); ?>...</text>
+ </g>
+ <script type="text/ecmascript">
+ <![CDATA[
/**
* getURL is a proprietary Adobe function, but it's simplicity has made it very
* popular. If getURL is undefined we spin our own by wrapping XMLHttpRequest.
*/
if (typeof getURL == 'undefined') {
- getURL = function(url, callback) {
- if (!url)
- throw '<?=gettext("No URL for getURL"); ?>';
-
- try {
- if (typeof callback.operationComplete == 'function')
- callback = callback.operationComplete;
- } catch (e) {}
- if (typeof callback != 'function')
- throw '<?=gettext("No callback function for getURL"); ?>';
-
- var http_request = null;
- if (typeof XMLHttpRequest != 'undefined') {
- http_request = new XMLHttpRequest();
- } else if (typeof ActiveXObject != 'undefined') {
- try {
- http_request = new ActiveXObject('Msxml2.XMLHTTP');
- } catch (e) {
- try {
- http_request = new ActiveXObject('Microsoft.XMLHTTP');
- } catch (e) {}
- }
- }
- if (!http_request)
- throw '<?=gettext("Both getURL and XMLHttpRequest are undefined"); ?>';
-
- http_request.onreadystatechange = function() {
- if (http_request.readyState == 4) {
- callback( { success : true,
- content : http_request.responseText,
- contentType : http_request.getResponseHeader("Content-Type") } );
- }
- }
- http_request.open('GET', url, true);
- http_request.send(null);
- }
+ getURL = function(url, callback) {
+ if (!url) {
+ throw '<?=gettext("No URL for getURL"); ?>';
+ }
+
+ try {
+ if (typeof callback.operationComplete == 'function') {
+ callback = callback.operationComplete;
+ }
+ } catch (e) {}
+ if (typeof callback != 'function') {
+ throw '<?=gettext("No callback function for getURL"); ?>';
+ }
+
+ var http_request = null;
+ if (typeof XMLHttpRequest != 'undefined') {
+ http_request = new XMLHttpRequest();
+ } else if (typeof ActiveXObject != 'undefined') {
+ try {
+ http_request = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject('Microsoft.XMLHTTP');
+ } catch (e) {}
+ }
+ }
+ if (!http_request) {
+ throw '<?=gettext("Both getURL and XMLHttpRequest are undefined"); ?>';
+ }
+
+ http_request.onreadystatechange = function() {
+ if (http_request.readyState == 4) {
+ callback( { success : true,
+ content : http_request.responseText,
+ contentType : http_request.getResponseHeader("Content-Type") } );
+ }
+ }
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ }
}
var SVGDoc = null;
@@ -190,202 +194,215 @@ var unit = 'bits';
var scale_type = '<?=$scale_type?>';
function init(evt) {
- SVGDoc = evt.target.ownerDocument;
- SVGDoc.getElementById("switch_unit").addEventListener("mousedown", switch_unit, false);
- SVGDoc.getElementById("switch_scale").addEventListener("mousedown", switch_scale, false);
+ SVGDoc = evt.target.ownerDocument;
+ SVGDoc.getElementById("switch_unit").addEventListener("mousedown", switch_unit, false);
+ SVGDoc.getElementById("switch_scale").addEventListener("mousedown", switch_scale, false);
- fetch_data();
+ fetch_data();
}
-function switch_unit(event)
-{
- SVGDoc.getElementById('switch_unit').firstChild.data = '<?=gettext("Switch to"); ?> ' + unit + '/s';
- unit = (unit == 'bits') ? 'bytes' : 'bits';
+function switch_unit(event) {
+ SVGDoc.getElementById('switch_unit').firstChild.data = '<?=gettext("Switch to"); ?> ' + unit + '/s';
+ unit = (unit == 'bits') ? 'bytes' : 'bits';
}
-function switch_scale(event)
-{
- scale_type = (scale_type == 'up') ? '<?=gettext("follow"); ?>' : '<?=gettext("up"); ?>';
- SVGDoc.getElementById('switch_scale').firstChild.data = 'AutoScale (' + scale_type + ')';
+function switch_scale(event) {
+ scale_type = (scale_type == 'up') ? '<?=gettext("follow"); ?>' : '<?=gettext("up"); ?>';
+ SVGDoc.getElementById('switch_scale').firstChild.data = 'AutoScale (' + scale_type + ')';
}
function fetch_data() {
- getURL('<?=$fetch_link?>', plot_data);
+ getURL('<?=$fetch_link?>', plot_data);
}
function plot_data(obj) {
- // Show datetimelegend
- var now = new Date();
- var time = LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds());
- SVGDoc.getElementById('time').firstChild.data = time;
- var date = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear();
- SVGDoc.getElementById('date').firstChild.data = date;
-
- if (!obj.success)
- return handle_error(); // getURL failed to get data
-
- var t = obj.content.split("|");
- var ugmt = parseFloat(t[0]); // ugmt is an unixtimestamp style
- var ifin = parseInt(t[1], 10); // number of bytes received by the interface
- var ifout = parseInt(t[2], 10); // number of bytes sent by the interface
- var scale;
-
- if (!isNumber(ifin) || !isNumber(ifout))
- return handle_error();
-
- var diff_ugmt = ugmt - last_ugmt;
- var diff_ifin = ifin - last_ifin;
- var diff_ifout = ifout - last_ifout;
-
- if (diff_ugmt == 0)
- diff_ugmt = 1; /* avoid division by zero */
-
- last_ugmt = ugmt;
- last_ifin = ifin;
- last_ifout = ifout;
- var graphTimerId = 0;
- switch (plot_in.length) {
- case 0:
- SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'visible');
- plot_in[0] = diff_ifin / diff_ugmt;
- plot_out[0] = diff_ifout / diff_ugmt;
- setTimeout('fetch_data()',<?=1000*($time_interval + $init_delay)?>);
- return;
- case 1:
- SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'hidden');
- break;
- case max_num_points:
- // shift plot to left if the maximum number of plot points has been reached
- var i = 0;
- while (i < max_num_points) {
- plot_in[i] = plot_in[i+1];
- plot_out[i] = plot_out[++i];
+ // Show datetimelegend
+ var now = new Date();
+ var time = LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds());
+ SVGDoc.getElementById('time').firstChild.data = time;
+ var date = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear();
+ SVGDoc.getElementById('date').firstChild.data = date;
+
+ if (!obj.success) {
+ return handle_error(); // getURL failed to get data
+ }
+
+ var t = obj.content.split("|");
+ var ugmt = parseFloat(t[0]); // ugmt is an unixtimestamp style
+ var ifin = parseInt(t[1], 10); // number of bytes received by the interface
+ var ifout = parseInt(t[2], 10); // number of bytes sent by the interface
+ var scale;
+
+ if (!isNumber(ifin) || !isNumber(ifout)) {
+ return handle_error();
+ }
+
+ var diff_ugmt = ugmt - last_ugmt;
+ var diff_ifin = ifin - last_ifin;
+ var diff_ifout = ifout - last_ifout;
+
+ if (diff_ugmt == 0) {
+ diff_ugmt = 1; /* avoid division by zero */
+ }
+
+ last_ugmt = ugmt;
+ last_ifin = ifin;
+ last_ifout = ifout;
+ var graphTimerId = 0;
+ switch (plot_in.length) {
+ case 0:
+ SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'visible');
+ plot_in[0] = diff_ifin / diff_ugmt;
+ plot_out[0] = diff_ifout / diff_ugmt;
+ setTimeout('fetch_data()', <?=1000*($time_interval + $init_delay)?>);
+ return;
+ case 1:
+ SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'hidden');
+ break;
+ case max_num_points:
+ // shift plot to left if the maximum number of plot points has been reached
+ var i = 0;
+ while (i < max_num_points) {
+ plot_in[i] = plot_in[i+1];
+ plot_out[i] = plot_out[++i];
+ }
+ plot_in.length--;
+ plot_out.length--;
+ }
+
+ plot_in[plot_in.length] = diff_ifin / diff_ugmt;
+ plot_out[plot_out.length]= diff_ifout / diff_ugmt;
+ var index_plot = plot_in.length - 1;
+
+ SVGDoc.getElementById('graph_in_txt').firstChild.data = formatSpeed(plot_in[index_plot], unit);
+ SVGDoc.getElementById('graph_out_txt').firstChild.data = formatSpeed(plot_out[index_plot], unit);
+
+ /* determine peak for sensible scaling */
+ if (scale_type == 'up') {
+ if (plot_in[index_plot] > max) {
+ max = plot_in[index_plot];
+ }
+ if (plot_out[index_plot] > max) {
+ max = plot_out[index_plot];
+ }
+ } else if (scale_type == 'follow') {
+ i = 0;
+ max = 0;
+ while (i < plot_in.length) {
+ if (plot_in[i] > max) {
+ max = plot_in[i];
+ }
+ if (plot_out[i] > max) {
+ max = plot_out[i];
+ }
+ i++;
+ }
+ }
+
+ var rmax; // max, rounded up
+
+ if (unit == 'bits') {
+ /* round up max, such that
+ 100 kbps -> 200 kbps -> 400 kbps -> 800 kbps -> 1 Mbps -> 2 Mbps -> ... */
+ rmax = 12500;
+ i = 0;
+ while (max > rmax) {
+ i++;
+ if (i && (i % 4 == 0)) {
+ rmax *= 1.25;
+ } else {
+ rmax *= 2;
+ }
+ }
+ } else {
+ /* round up max, such that
+ 10 KB/s -> 20 KB/s -> 40 KB/s -> 80 KB/s -> 100 KB/s -> 200 KB/s -> 400 KB/s -> 800 KB/s -> 1 MB/s ... */
+ rmax = 10240;
+ i = 0;
+ while (max > rmax) {
+ i++;
+ if (i && (i % 4 == 0)) {
+ rmax *= 1.25;
+ } else {
+ rmax *= 2;
+ }
+
+ if (i == 8) {
+ rmax *= 1.024;
+ }
}
- plot_in.length--;
- plot_out.length--;
- }
-
- plot_in[plot_in.length] = diff_ifin / diff_ugmt;
- plot_out[plot_out.length]= diff_ifout / diff_ugmt;
- var index_plot = plot_in.length - 1;
-
- SVGDoc.getElementById('graph_in_txt').firstChild.data = formatSpeed(plot_in[index_plot], unit);
- SVGDoc.getElementById('graph_out_txt').firstChild.data = formatSpeed(plot_out[index_plot], unit);
-
- /* determine peak for sensible scaling */
- if (scale_type == 'up') {
- if (plot_in[index_plot] > max)
- max = plot_in[index_plot];
- if (plot_out[index_plot] > max)
- max = plot_out[index_plot];
- } else if (scale_type == 'follow') {
- i = 0;
- max = 0;
- while (i < plot_in.length) {
- if (plot_in[i] > max)
- max = plot_in[i];
- if (plot_out[i] > max)
- max = plot_out[i];
- i++;
- }
- }
-
- var rmax; // max, rounded up
-
- if (unit == 'bits') {
- /* round up max, such that
- 100 kbps -> 200 kbps -> 400 kbps -> 800 kbps -> 1 Mbps -> 2 Mbps -> ... */
- rmax = 12500;
- i = 0;
- while (max > rmax) {
- i++;
- if (i && (i % 4 == 0))
- rmax *= 1.25;
- else
- rmax *= 2;
- }
- } else {
- /* round up max, such that
- 10 KB/s -> 20 KB/s -> 40 KB/s -> 80 KB/s -> 100 KB/s -> 200 KB/s -> 400 KB/s -> 800 KB/s -> 1 MB/s ... */
- rmax = 10240;
- i = 0;
- while (max > rmax) {
- i++;
- if (i && (i % 4 == 0))
- rmax *= 1.25;
- else
- rmax *= 2;
-
- if (i == 8)
- rmax *= 1.024;
- }
- }
-
- scale = <?=$height?> / rmax;
-
- /* change labels accordingly */
- SVGDoc.getElementById('grid_txt1').firstChild.data = formatSpeed(3*rmax/4,unit);
- SVGDoc.getElementById('grid_txt2').firstChild.data = formatSpeed(2*rmax/4,unit);
- SVGDoc.getElementById('grid_txt3').firstChild.data = formatSpeed(rmax/4,unit);
-
- var path_in = "M 0 " + (<?=$height?> - (plot_in[0] * scale));
- var path_out = "M 0 " + (<?=$height?> - (plot_out[0] * scale));
- for (i = 1; i < plot_in.length; i++)
- {
- var x = step * i;
- var y_in = <?=$height?> - (plot_in[i] * scale);
- var y_out = <?=$height?> - (plot_out[i] * scale);
- path_in += " L" + x + " " + y_in;
- path_out += " L" + x + " " + y_out;
- }
-
- SVGDoc.getElementById('error').setAttributeNS(null, 'visibility', 'hidden');
- SVGDoc.getElementById('graph_in').setAttributeNS(null, 'd', path_in);
- SVGDoc.getElementById('graph_out').setAttributeNS(null, 'd', path_out);
-
- setTimeout('fetch_data()',<?=1000*$time_interval?>);
+ }
+
+ scale = <?=$height?> / rmax;
+
+ /* change labels accordingly */
+ SVGDoc.getElementById('grid_txt1').firstChild.data = formatSpeed(3*rmax/4, unit);
+ SVGDoc.getElementById('grid_txt2').firstChild.data = formatSpeed(2*rmax/4, unit);
+ SVGDoc.getElementById('grid_txt3').firstChild.data = formatSpeed(rmax/4, unit);
+
+ var path_in = "M 0 " + (<?=$height?> - (plot_in[0] * scale));
+ var path_out = "M 0 " + (<?=$height?> - (plot_out[0] * scale));
+ for (i = 1; i < plot_in.length; i++) {
+ var x = step * i;
+ var y_in = <?=$height?> - (plot_in[i] * scale);
+ var y_out = <?=$height?> - (plot_out[i] * scale);
+ path_in += " L" + x + " " + y_in;
+ path_out += " L" + x + " " + y_out;
+ }
+
+ SVGDoc.getElementById('error').setAttributeNS(null, 'visibility', 'hidden');
+ SVGDoc.getElementById('graph_in').setAttributeNS(null, 'd', path_in);
+ SVGDoc.getElementById('graph_out').setAttributeNS(null, 'd', path_out);
+
+ setTimeout('fetch_data()', <?=1000*$time_interval?>);
}
function handle_error() {
- SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'visible');
- setTimeout('fetch_data()',<?=1000*$time_interval?>);
+ SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'visible');
+ setTimeout('fetch_data()', <?=1000*$time_interval?>);
}
function isNumber(a) {
- return typeof a == 'number' && isFinite(a);
+ return typeof a == 'number' && isFinite(a);
}
function formatSpeed(speed, unit) {
- if (unit == 'bits')
- return formatSpeedBits(speed);
- if (unit == 'bytes')
- return formatSpeedBytes(speed);
+ if (unit == 'bits') {
+ return formatSpeedBits(speed);
+ }
+ if (unit == 'bytes') {
+ return formatSpeedBytes(speed);
+ }
}
function formatSpeedBits(speed) {
- // format speed in bits/sec, input: bytes/sec
- if (speed < 125000)
- return Math.round(speed / 125) + " <?=gettext("Kbps"); ?>";
- if (speed < 125000000)
- return Math.round(speed / 1250)/100 + " <?=gettext("Mbps"); ?>";
- // else
- return Math.round(speed / 1250000)/100 + " <?=gettext("Gbps"); ?>"; /* wow! */
+ // format speed in bits/sec, input: bytes/sec
+ if (speed < 125000) {
+ return Math.round(speed / 125) + " <?=gettext("Kbps"); ?>";
+ }
+ if (speed < 125000000) {
+ return Math.round(speed / 1250)/100 + " <?=gettext("Mbps"); ?>";
+ }
+ // else
+ return Math.round(speed / 1250000)/100 + " <?=gettext("Gbps"); ?>"; /* wow! */
}
function formatSpeedBytes(speed) {
- // format speed in bytes/sec, input: bytes/sec
- if (speed < 1048576)
- return Math.round(speed / 10.24)/100 + " <?=gettext("KB/s"); ?>";
- if (speed < 1073741824)
- return Math.round(speed / 10485.76)/100 + " <?=gettext("MB/s"); ?>";
- // else
- return Math.round(speed / 10737418.24)/100 + " <?=gettext("GB/s"); ?>"; /* wow! */
+ // format speed in bytes/sec, input: bytes/sec
+ if (speed < 1048576) {
+ return Math.round(speed / 10.24)/100 + " <?=gettext("KB/s"); ?>";
+ }
+ if (speed < 1073741824) {
+ return Math.round(speed / 10485.76)/100 + " <?=gettext("MB/s"); ?>";
+ }
+ // else
+ return Math.round(speed / 10737418.24)/100 + " <?=gettext("GB/s"); ?>"; /* wow! */
}
function LZ(x) {
- return (x < 0 || x > 9 ? "" : "0") + x;
+ return (x < 0 || x > 9 ? "" : "0") + x;
}
]]>
- </script>
+ </script>
</svg>
diff --git a/usr/local/www/graph_cpu.php b/usr/local/www/graph_cpu.php
index b92c953..80d97f1 100644
--- a/usr/local/www/graph_cpu.php
+++ b/usr/local/www/graph_cpu.php
@@ -42,9 +42,9 @@
require_once("guiconfig.inc");
-header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
-header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
-header("Cache-Control: no-cache, no-store, must-revalidate" ); // HTTP/1.1
+header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
+header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
header("Content-type: image/svg+xml");
@@ -69,64 +69,68 @@ $width=200; // SVG internal width : do not modify
/********* Graph DATA **************/
print('<?xml version="1.0" encoding="UTF-8"?>' . "\n");?>
<svg width="100%" height="100%" viewBox="0 0 <?=$width?> <?=$height?>" preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt);">
- <g id="graph">
- <rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
- <line id="axis_x" x1="0" y1="0" x2="0" y2="100%" <?=$attribs['axis']?>/>
- <line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?=$attribs['axis']?>/>
- <polygon id="axis_arrow_x" <?=$attribs['axis']?> points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
- <path id="graph_cpu" d="" <?=$attribs['graph_cpu']?>/>
- <path id="grid" d="M0 <?=$height/4*1?> L <?=$width?> <?=$height/4*1?> M0 <?=$height/4*2?> L <?=$width?> <?=$height/4*2?> M0 <?=$height/4*3?> L <?=$width?> <?=$height/4*3?>" <?=$attribs['grid']?>/>
- <text id="grid_txt1" x="100%" y="25%" <?=$attribs['grid_txt']?> text-anchor="end">75%</text>
- <text id="grid_txt2" x="100%" y="50%" <?=$attribs['grid_txt']?> text-anchor="end">50%</text>
- <text id="grid_txt3" x="100%" y="75%" <?=$attribs['grid_txt']?> text-anchor="end">25%</text>
- <text id="graph_cpu_txt" x="4" y="8" <?=$attribs['cpu']?>> </text>
- <text id="error" x="50%" y="50%" visibility="hidden" <?=$attribs['error']?> text-anchor="middle"><?=gettext("Cannot get CPU load"); ?></text>
- <text id="collect_initial" x="50%" y="50%" visibility="hidden" <?=$attribs['collect_initial']?> text-anchor="middle"><?=gettext("Collecting initial data, please wait"); ?>...</text>
- </g>
- <script type="text/ecmascript">
- <![CDATA[
+ <g id="graph">
+ <rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
+ <line id="axis_x" x1="0" y1="0" x2="0" y2="100%" <?=$attribs['axis']?>/>
+ <line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?=$attribs['axis']?>/>
+ <polygon id="axis_arrow_x" <?=$attribs['axis']?> points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
+ <path id="graph_cpu" d="" <?=$attribs['graph_cpu']?>/>
+ <path id="grid" d="M0 <?=$height/4*1?> L <?=$width?> <?=$height/4*1?> M0 <?=$height/4*2?> L <?=$width?> <?=$height/4*2?> M0 <?=$height/4*3?> L <?=$width?> <?=$height/4*3?>" <?=$attribs['grid']?>/>
+ <text id="grid_txt1" x="100%" y="25%" <?=$attribs['grid_txt']?> text-anchor="end">75%</text>
+ <text id="grid_txt2" x="100%" y="50%" <?=$attribs['grid_txt']?> text-anchor="end">50%</text>
+ <text id="grid_txt3" x="100%" y="75%" <?=$attribs['grid_txt']?> text-anchor="end">25%</text>
+ <text id="graph_cpu_txt" x="4" y="8" <?=$attribs['cpu']?>> </text>
+ <text id="error" x="50%" y="50%" visibility="hidden" <?=$attribs['error']?> text-anchor="middle"><?=gettext("Cannot get CPU load"); ?></text>
+ <text id="collect_initial" x="50%" y="50%" visibility="hidden" <?=$attribs['collect_initial']?> text-anchor="middle"><?=gettext("Collecting initial data, please wait"); ?>...</text>
+ </g>
+ <script type="text/ecmascript">
+ <![CDATA[
/**
* getURL is a proprietary Adobe function, but it's simplicity has made it very
* popular. If getURL is undefined we spin our own by wrapping XMLHttpRequest.
*/
if (typeof getURL == 'undefined') {
- getURL = function(url, callback) {
- if (!url)
- throw '<?=gettext("No URL for getURL"); ?>';
-
- try {
- if (typeof callback.operationComplete == 'function')
- callback = callback.operationComplete;
- } catch (e) {}
- if (typeof callback != 'function')
- throw '<?=gettext("No callback function for getURL"); ?>';
-
- var http_request = null;
- if (typeof XMLHttpRequest != 'undefined') {
- http_request = new XMLHttpRequest();
- } else if (typeof ActiveXObject != 'undefined') {
- try {
- http_request = new ActiveXObject('Msxml2.XMLHTTP');
- } catch (e) {
- try {
- http_request = new ActiveXObject('Microsoft.XMLHTTP');
- } catch (e) {}
- }
- }
- if (!http_request)
- throw '<?=gettext("Both getURL and XMLHttpRequest are undefined"); ?>';
-
- http_request.onreadystatechange = function() {
- if (http_request.readyState == 4) {
- callback( { success : true,
- content : http_request.responseText,
- contentType : http_request.getResponseHeader("Content-Type") } );
- }
- }
- http_request.open('GET', url, true);
- http_request.send(null);
- }
+ getURL = function(url, callback) {
+ if (!url) {
+ throw '<?=gettext("No URL for getURL"); ?>';
+ }
+
+ try {
+ if (typeof callback.operationComplete == 'function') {
+ callback = callback.operationComplete;
+ }
+ } catch (e) {}
+ if (typeof callback != 'function') {
+ throw '<?=gettext("No callback function for getURL"); ?>';
+ }
+
+ var http_request = null;
+ if (typeof XMLHttpRequest != 'undefined') {
+ http_request = new XMLHttpRequest();
+ } else if (typeof ActiveXObject != 'undefined') {
+ try {
+ http_request = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject('Microsoft.XMLHTTP');
+ } catch (e) {}
+ }
+ }
+ if (!http_request) {
+ throw '<?=gettext("Both getURL and XMLHttpRequest are undefined"); ?>';
+ }
+
+ http_request.onreadystatechange = function() {
+ if (http_request.readyState == 4) {
+ callback( { success : true,
+ content : http_request.responseText,
+ contentType : http_request.getResponseHeader("Content-Type") } );
+ }
+ }
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ }
}
var SVGDoc = null;
@@ -141,65 +145,67 @@ var step = <?=$width?> / max_num_points; // plot X division size
var scale = <?=$height?> / 100;
function init(evt) {
- SVGDoc = evt.target.ownerDocument;
- fetch_data();
+ SVGDoc = evt.target.ownerDocument;
+ fetch_data();
}
function fetch_data() {
- getURL('<?=$fetch_link?>', plot_cpu_data);
+ getURL('<?=$fetch_link?>', plot_cpu_data);
}
function plot_cpu_data(obj) {
- if (!obj.success)
- return handle_error(); // getURL failed to get current CPU load data
-
- var cpu = parseInt(obj.content);
- if (!isNumber(cpu))
- return handle_error();
-
- switch (cpu_data.length) {
- case 0:
- SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'visible');
- cpu_data[0] = cpu;
- fetch_data();
- return;
- case 1:
- SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'hidden');
- break;
- case max_num_points:
- // shift plot to left if the maximum number of plot points has been reached
- var i = 0;
- while (i < max_num_points) {
- cpu_data[i] = cpu_data[++i];
- }
- --cpu_data.length;
- }
-
- cpu_data[cpu_data.length] = cpu;
-
- var path_data = "M 0 " + (<?=$height?> - (cpu_data[0] * scale));
- for (var i = 1; i < cpu_data.length; ++i) {
- var x = step * i;
- var y_cpu = <?=$height?> - (cpu_data[i] * scale);
- path_data += " L" + x + " " + y_cpu;
- }
-
- SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'hidden');
- SVGDoc.getElementById('graph_cpu_txt').firstChild.data = cpu + '%';
- SVGDoc.getElementById('graph_cpu').setAttributeNS(null, "d", path_data);
-
- fetch_data();
+ if (!obj.success) {
+ return handle_error(); // getURL failed to get current CPU load data
+ }
+
+ var cpu = parseInt(obj.content);
+ if (!isNumber(cpu)) {
+ return handle_error();
+ }
+
+ switch (cpu_data.length) {
+ case 0:
+ SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'visible');
+ cpu_data[0] = cpu;
+ fetch_data();
+ return;
+ case 1:
+ SVGDoc.getElementById("collect_initial").setAttributeNS(null, 'visibility', 'hidden');
+ break;
+ case max_num_points:
+ // shift plot to left if the maximum number of plot points has been reached
+ var i = 0;
+ while (i < max_num_points) {
+ cpu_data[i] = cpu_data[++i];
+ }
+ --cpu_data.length;
+ }
+
+ cpu_data[cpu_data.length] = cpu;
+
+ var path_data = "M 0 " + (<?=$height?> - (cpu_data[0] * scale));
+ for (var i = 1; i < cpu_data.length; ++i) {
+ var x = step * i;
+ var y_cpu = <?=$height?> - (cpu_data[i] * scale);
+ path_data += " L" + x + " " + y_cpu;
+ }
+
+ SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'hidden');
+ SVGDoc.getElementById('graph_cpu_txt').firstChild.data = cpu + '%';
+ SVGDoc.getElementById('graph_cpu').setAttributeNS(null, "d", path_data);
+
+ fetch_data();
}
function handle_error() {
- SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'visible');
- fetch_data();
+ SVGDoc.getElementById("error").setAttributeNS(null, 'visibility', 'visible');
+ fetch_data();
}
function isNumber(a) {
- return typeof a == 'number' && isFinite(a);
+ return typeof a == 'number' && isFinite(a);
}
- ]]>
- </script>
+ ]]>
+ </script>
</svg>
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 8ad9e92..a2e17bd 100644
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -37,7 +37,7 @@
if (!$nocsrf) {
function csrf_startup() {
csrf_conf('rewrite-js', '/csrf/csrf-magic.js');
- $timeout_minutes = isset($config['system']['webgui']['session_timeout']) ? $config['system']['webgui']['session_timeout'] : 240;
+ $timeout_minutes = isset($config['system']['webgui']['session_timeout']) ? $config['system']['webgui']['session_timeout'] : 240;
csrf_conf('expires', $timeout_minutes * 60);
}
require_once("csrf/csrf-magic.php");
@@ -152,22 +152,22 @@ $ldap_protvers = array(
$ldap_templates = array(
'open' => array(
- 'desc' => "OpenLDAP",
- 'attr_user' => "cn",
- 'attr_group' => "cn",
- 'attr_member' => "member"),
+ 'desc' => "OpenLDAP",
+ 'attr_user' => "cn",
+ 'attr_group' => "cn",
+ 'attr_member' => "member"),
'msad' => array(
- 'desc' => "Microsoft AD",
- 'attr_user' => "samAccountName",
- 'attr_group' => "cn",
- 'attr_member' => "memberOf"),
+ 'desc' => "Microsoft AD",
+ 'attr_user' => "samAccountName",
+ 'attr_group' => "cn",
+ 'attr_member' => "memberOf"),
'edir' => array(
- 'desc' => "Novell eDirectory",
- 'attr_user' => "cn",
- 'attr_group' => "cn",
- 'attr_member' => "uniqueMember"));
+ 'desc' => "Novell eDirectory",
+ 'attr_user' => "cn",
+ 'attr_group' => "cn",
+ 'attr_member' => "uniqueMember"));
$radius_srvcs = array(
'both' => "Authentication and Accounting",
@@ -307,7 +307,7 @@ function verify_gzip_file($fname) {
}
}
-function print_info_box_np($msg, $name="apply",$value="", $showapply=false) {
+function print_info_box_np($msg, $name = "apply", $value = "", $showapply = false) {
global $g, $nifty_redbox, $nifty_blackbox, $nifty_background;
if (empty($value)) {
@@ -325,7 +325,7 @@ function print_info_box_np($msg, $name="apply",$value="", $showapply=false) {
if ($_POST['if']) {
$savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />";
}
- $savebutton.="</td>";
+ $savebutton .= "</td>";
}
$nifty_redbox = "#990000";
$nifty_blackbox = "#000000";
@@ -380,7 +380,7 @@ EOFnp;
}
-function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) {
+function print_info_box_np_undo($msg, $name = "apply", $value = "Apply changes", $undo) {
global $g;
if (stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) {
@@ -678,11 +678,11 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
echo "<tr valign=\"top\">\n";
if ($withorig) {
if (isset($config['system']['usefifolog'])) {
- $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . ""));
+ $entry_date_time = htmlspecialchars(date("F j, Y, g:i a", "" . $logent[1] . ""));
$entry_text = htmlspecialchars($logent[5]);
} else {
$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
- $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " ";
+ $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " ";
$entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]);
}
echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n";
@@ -779,7 +779,7 @@ function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendp
}
}
-function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
+function pconfig_to_address(&$adr, $padr, $pmask, $pnot = false, $pbeginport = 0, $pendport = 0) {
$adr = array();
if ($padr == "any") {
@@ -836,9 +836,9 @@ function display_widget_tabs(& $tab_array) {
echo "<div id=\"tabs\">";
$tabscounter = 0;
foreach ($tab_array as $ta) {
- $dashpos = strpos($ta[2],'-');
+ $dashpos = strpos($ta[2], '-');
$tabname = $ta[2] . "-tab";
- $tabclass = substr($ta[2],0,$dashpos);
+ $tabclass = substr($ta[2], 0, $dashpos);
$tabclass = $tabclass . "-class";
if ($ta[1] == true) {
$tabActive = "table-cell";
@@ -978,7 +978,7 @@ function print_rfc2616_select($tag, $current) {
}
// Useful debugging function, much cleaner than print_r
-function echo_array($array,$return_me=false) {
+function echo_array($array, $return_me = false) {
if (is_array($array) == false) {
$return = "The provided variable is not an array.";
} else {
@@ -986,7 +986,7 @@ function echo_array($array,$return_me=false) {
if (is_array($value)) {
$return .= "";
$return .= "['<b>$name</b>'] {<div style=\"margin-left:10px;\">\n";
- $return .= echo_array($value,true);
+ $return .= echo_array($value, true);
$return .= "</div>}";
$return .= "\n\n";
} else {
@@ -1073,7 +1073,7 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) {
echo gettext("Currently viewing: ");
echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n";
foreach ($tab_array as $ta) {
- if ($ta[1]=="true") {
+ if ($ta[1] == "true") {
$selected = " selected=\"selected\"";
} else {
$selected = "";
@@ -1120,7 +1120,7 @@ function add_package_tabs($pkgname, &$tab_array) {
return;
}
- foreach($pkg_config['tabs']['tab'] as $tab) {
+ foreach ($pkg_config['tabs']['tab'] as $tab) {
$tab_entry = array();
if ($tab['name']) {
$tab_entry[] = $tab['name'];
@@ -1136,13 +1136,13 @@ function alias_info_popup($alias_id) {
$maxlength = 60;
$close_title="title='".gettext('move mouse out of this alias to hide')."'";
if (is_array($config['aliases']['alias'][$alias_id])) {
- $alias_name=$config['aliases']['alias'][$alias_id];
+ $alias_name = $config['aliases']['alias'][$alias_id];
$alias_objects_with_details = "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" summary=\"alias info popup\">";
if ($alias_name['url']) {
// TODO: Change it when pf supports tables with ports
if ($alias_name['type'] == "urltable") {
exec("/sbin/pfctl -t {$alias_name['name']} -T show | wc -l", $total_entries);
- $counter=preg_replace("/\D/","",$total_entries[0]);
+ $counter = preg_replace("/\D/", "", $total_entries[0]);
exec("/sbin/pfctl -t {$alias_name['name']} -T show | head -10002", $alias_addresses);
} else {
$urlfn = alias_expand_urltable($alias_name['name']);
@@ -1150,8 +1150,8 @@ function alias_info_popup($alias_id) {
$counter = count($alias_addresses);
}
$alias_objects_with_details .= "<tr><td colspan=\"3\" $close_title class=\"vncell\">{$alias_name['url']}</td></tr>";
- $x=0;
- foreach ($alias_addresses as $alias_ports_address ) {
+ $x = 0;
+ foreach ($alias_addresses as $alias_ports_address) {
switch ($x) {
case 0:
$x++;
@@ -1162,8 +1162,8 @@ function alias_info_popup($alias_id) {
$alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>";
break;
default:
- $x=0;
- $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td><tr>";
+ $x = 0;
+ $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td><tr>";
break;
}
}
@@ -1182,7 +1182,7 @@ function alias_info_popup($alias_id) {
$counter = 0;
foreach ($alias_addresses as $alias_ports_address) {
$alias_objects_with_details .= "<tr><td $close_title width=\"5%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_addresses[$counter]}</td>";
- $alias_detail_default = strpos ($alias_details[$counter],"Entry added");
+ $alias_detail_default = strpos ($alias_details[$counter], "Entry added");
if ($alias_details[$counter] != "" && $alias_detail_default === False) {
$alias_objects_with_details .="<td $close_title width=\"95%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_details[$counter]}</td>";
} else {
@@ -1204,8 +1204,8 @@ function alias_info_popup($alias_id) {
print "<h1>{$alias_caption}</h1>" . $alias_objects_with_details;
}
-function rule_popup($src,$srcport,$dst,$dstport) {
- global $config,$g;
+function rule_popup($src, $srcport, $dst, $dstport) {
+ global $config, $g;
$aliases_array = array();
if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) {
$descriptions = array ();
@@ -1232,7 +1232,7 @@ function rule_popup($src,$srcport,$dst,$dstport) {
$descriptions['srcport'] = $span_begin;
$descriptions['srcport_end'] = $span_end;
}
- if ($alias_name['name'] == $dst ) {
+ if ($alias_name['name'] == $dst) {
$descriptions['dst'] = $span_begin;
$descriptions['dst_end'] = $span_end;
}
diff --git a/usr/local/www/halt.php b/usr/local/www/halt.php
index e640e8a..ab4fe99 100755
--- a/usr/local/www/halt.php
+++ b/usr/local/www/halt.php
@@ -52,7 +52,7 @@ if ($_POST['Submit'] == " " . gettext("No") . " ") {
exit;
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Halt system"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Halt system"));
include('head.inc');
?>
@@ -61,7 +61,7 @@ include('head.inc');
<?php if ($_POST['Submit'] == " " . gettext("Yes") . " "):
print_info_box(gettext("The system is halting now. This may take one minute.")); ?>
<pre>
-<?php system_halt(); ?>
+<?php system_halt(); ?>
</pre>
<?php else: ?>
<form action="halt.php" method="post">
diff --git a/usr/local/www/head.inc b/usr/local/www/head.inc
index ba02b40..d8b8867 100755
--- a/usr/local/www/head.inc
+++ b/usr/local/www/head.inc
@@ -87,7 +87,7 @@ if (file_exists("{$g['www_path']}/javascript/global.js")) {
* Coded by: Erik Kristensen
*/
-$dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));
+$dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));
$path = "{$g['www_path']}/javascript/" . $dir . "/";
if (is_dir($path)) {
if ($dh = opendir($path)) {
diff --git a/usr/local/www/headjs.php b/usr/local/www/headjs.php
index 4b54ec2..5e4148f 100644
--- a/usr/local/www/headjs.php
+++ b/usr/local/www/headjs.php
@@ -72,7 +72,7 @@ function getHeadJS() {
}
}
- function submit_form(e){
+ function submit_form(e) {
// debugging helper
//alert(Form.serialize($('iform')));
@@ -88,7 +88,7 @@ function getHeadJS() {
jQuery('#submit').keydown();
jQuery('#submit').css('visibility','hidden');
}
- if(jQuery('#cancelbutton')) {
+ if (jQuery('#cancelbutton')) {
jQuery('#cancelbutton').css('visibility','hidden');
}
jQuery('#loading').css('visibility','visible');
diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php
index 4f07752..68cc6d8 100644
--- a/usr/local/www/ifstats.php
+++ b/usr/local/www/ifstats.php
@@ -56,9 +56,9 @@
$temp = gettimeofday();
$timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;
- header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
- header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
- header("Cache-Control: no-cache, no-store, must-revalidate" ); // HTTP/1.1
+ header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
+ header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
+ header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php
index 8d89969..69b8642 100644
--- a/usr/local/www/includes/functions.inc.php
+++ b/usr/local/www/includes/functions.inc.php
@@ -32,6 +32,13 @@ function get_stats() {
}
function get_gatewaystats() {
+ global $config;
+ if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
+ $display_type = $config["widgets"]["gateways_widget"]["display_type"];
+ } else {
+ $display_type = "gw_ip";
+ }
+
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
@@ -43,8 +50,29 @@ function get_gatewaystats() {
}
$isfirst = false;
$data .= $gw['name'] . ",";
+
+ $monitor_address = "";
+ $monitor_address_disp = "";
+ if ($display_type == "monitor_ip" || $display_type == "both_ip") {
+ $monitor_address = $gw['monitor'];
+ if ($monitor_address != "" && $display_type == "both_ip") {
+ $monitor_address_disp = " (" . $monitor_address . ")";
+ } else {
+ $monitor_address_disp = $monitor_address;
+ }
+ }
+
if ($gateways_status[$gname]) {
- $data .= "<b>" . lookup_gateway_ip_by_name($gname) . "</b>,";
+ if ($display_type == "gw_ip" || $display_type == "both_ip" || ($display_type == "monitor_ip" && $monitor_address == "")) {
+ $if_gw = lookup_gateway_ip_by_name($gname);
+ } else {
+ $if_gw = "";
+ }
+ if ($monitor_address == $if_gw) {
+ $monitor_address_disp = "";
+ }
+
+ $data .= "<b>" . $if_gw . $monitor_address_disp . "</b>,";
$gws = $gateways_status[$gname];
switch (strtolower($gws['status'])) {
case "none":
@@ -68,7 +96,12 @@ function get_gatewaystats() {
break;
}
} else {
- $data .= "~,";
+ if ($display_type == "gw_ip" || $display_type == "both_ip" || ($display_type == "monitor_ip" && $monitor_address == "")) {
+ $if_gw = "~";
+ } else {
+ $if_gw = "";
+ }
+ $data .= $if_gw . $monitor_address_disp . ",";
$gws['delay'] = "~";
$gws['loss'] = "~";
$online = "Unknown";
diff --git a/usr/local/www/index.php b/usr/local/www/index.php
index f9f46a4..4de2852 100644
--- a/usr/local/www/index.php
+++ b/usr/local/www/index.php
@@ -44,7 +44,7 @@
##|-PRIV
// Turn on buffering to speed up rendering
-ini_set('output_buffering','true');
+ini_set('output_buffering', 'true');
// Start buffering with a cache size of 100000
ob_start(null, "1000");
@@ -61,7 +61,7 @@ if (isset($_REQUEST['closenotice'])) {
echo get_menu_messages();
exit;
}
-if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])) {
+if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/", $_REQUEST['aliasid'])) {
alias_info_popup($_REQUEST['aliasid']);
exit;
}
@@ -91,7 +91,7 @@ if ($g['disablecrashreporter'] != true) {
##build list of widgets
$directory = "/usr/local/www/widgets/widgets/";
-$dirhandle = opendir($directory);
+$dirhandle = opendir($directory);
$filename = "";
$widgetnames = array();
$widgetfiles = array();
@@ -142,7 +142,7 @@ require_once('includes/functions.inc.php');
## if true, display, if false, hide it ...
if (file_exists("/usr/sbin/swapinfo")) {
$swapinfo = `/usr/sbin/swapinfo`;
- if (stristr($swapinfo,'%') == true) {
+ if (stristr($swapinfo, '%') == true) {
$showswap=true;
}
}
@@ -195,10 +195,10 @@ EOF;
echo "<center>\n";
echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\" alt=\"logo\" /><p>\n";
echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
- echo sprintf(gettext("Welcome to %s!\n"),$g['product_name']) . "<p>";
+ echo sprintf(gettext("Welcome to %s!\n"), $g['product_name']) . "<p>";
echo gettext("One moment while we start the initial setup wizard.") . "<p>\n";
echo gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.") . "<p>\n";
- echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."),$g['product_name']) . "\n";
+ echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."), $g['product_name']) . "\n";
echo "</div>\n";
echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
echo "<script type=\"text/javascript\">\n";
@@ -239,7 +239,7 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
$colpos = array();
$savedwidgetfiles = array();
$widgetname = "";
- $widgetlist = explode(",",$widgetlist);
+ $widgetlist = explode(",", $widgetlist);
##read the widget position and display information
foreach ($widgetlist as $widget) {
@@ -247,8 +247,8 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
$widgetname = substr($widget, 0, $dashpos);
$colposition = strpos($widget, ":");
$displayposition = strrpos($widget, ":");
- $colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1);
- $displayarray[] = substr($widget,$displayposition+1);
+ $colpos[] = substr($widget, $colposition + 1, $displayposition - $colposition - 1);
+ $displayarray[] = substr($widget, $displayposition + 1);
$savedwidgetfiles[] = $widgetname . ".widget.php";
}
@@ -275,7 +275,7 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
##build list of php include files
$phpincludefiles = array();
$directory = "/usr/local/www/widgets/include/";
-$dirhandle = opendir($directory);
+$dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
$phpincludefiles[] = $filename;
@@ -345,7 +345,7 @@ function configureWidget(selectedDiv) {
}
}
-function showWidget(selectedDiv,swapButtons) {
+function showWidget(selectedDiv, swapButtons) {
//appear element
jQuery('#' + selectedDiv).show('blind');
showSave();
@@ -367,7 +367,7 @@ function showWidget(selectedDiv,swapButtons) {
}
-function minimizeWidget(selectedDiv,swapButtons) {
+function minimizeWidget(selectedDiv, swapButtons) {
//fade element
jQuery('#' + selectedDiv).hide('blind');
showSave();
@@ -407,7 +407,7 @@ function updatePref() {
var widgetSequence = "";
var firstprint = false;
d = document;
- for (i=0; i<widgets.length; i++) {
+ for (i = 0; i < widgets.length; i++) {
if (firstprint) {
widgetSequence += ",";
}
@@ -425,31 +425,31 @@ function updatePref() {
}
function hideAllWidgets() {
- jQuery('#niftyOutter').fadeTo('slow',0.2);
+ jQuery('#niftyOutter').fadeTo('slow', 0.2);
}
function showAllWidgets() {
- jQuery('#niftyOutter').fadeTo('slow',1.0);
+ jQuery('#niftyOutter').fadeTo('slow', 1.0);
}
function changeTabDIV(selectedDiv) {
var dashpos = selectedDiv.indexOf("-");
- var tabclass = selectedDiv.substring(0,dashpos);
+ var tabclass = selectedDiv.substring(0, dashpos);
d = document;
//get deactive tabs first
tabclass = tabclass + "-class-tabdeactive";
var tabs = document.getElementsByClassName(tabclass);
var incTabSelected = selectedDiv + "-deactive";
- for (i=0; i<tabs.length; i++) {
+ for (i = 0; i < tabs.length; i++) {
var tab = tabs[i].id;
dashpos = tab.lastIndexOf("-");
- var tab2 = tab.substring(0,dashpos) + "-deactive";
+ var tab2 = tab.substring(0, dashpos) + "-deactive";
if (tab2 == incTabSelected) {
tablink = d.getElementById(tab2);
tablink.style.display = "none";
- tab2 = tab.substring(0,dashpos) + "-active";
+ tab2 = tab.substring(0, dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
@@ -459,15 +459,15 @@ function changeTabDIV(selectedDiv) {
}
else
{
- tab2 = tab.substring(0,dashpos) + "-deactive";
+ tab2 = tab.substring(0, dashpos) + "-deactive";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
- tab2 = tab.substring(0,dashpos) + "-active";
+ tab2 = tab.substring(0, dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "none";
//hide sections we don't want to see
- tab2 = tab.substring(0,dashpos);
+ tab2 = tab.substring(0, dashpos);
tabmain = d.getElementById(tab2);
tabmain.style.display = "none";
@@ -489,7 +489,7 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
-columns = ['col1','col2','col3','col4', 'col5','col6','col7','col8','col9','col10'];
+columns = ['col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9', 'col10'];
//]]>
</script>
@@ -570,7 +570,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
<input type="hidden" value="" name="sequence" id="sequence" />
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="<?=gettext("Click here to add widgets"); ?>" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" />
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="<?=gettext("Click here for help"); ?>" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" />
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="<?=gettext("Click here for help"); ?>" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" />
&nbsp;&nbsp;&nbsp;
<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="<?=gettext("Save Settings");?>" />
@@ -731,9 +731,9 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
</div>
<div align="right" style="float:right;">
<div id="<?php echo $widgetname;?>-configure" onclick='return configureWidget("<?php echo $widgetname;?>")' style="display:none; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_configure.gif" alt="configure" /></div>
- <div id="<?php echo $widgetname;?>-open" onclick='return showWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $showWidget;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="open" /></div>
- <div id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="minimize" /></div>
- <div id="<?php echo $widgetname;?>-close" onclick='return closeWidget("<?php echo $widgetname;?>",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" /></div>
+ <div id="<?php echo $widgetname;?>-open" onclick='return showWidget("<?php echo $widgetname;?>", true)' style="display:<?php echo $showWidget;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="open" /></div>
+ <div id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>", true)' style="display:<?php echo $mindiv;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="minimize" /></div>
+ <div id="<?php echo $widgetname;?>-close" onclick='return closeWidget("<?php echo $widgetname;?>", true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" /></div>
</div>
<div style="clear:both;"></div>
</div>
@@ -769,9 +769,9 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
{
jQuery('.ui-sortable').sortable({connectWith: '.ui-sortable', dropOnEmpty: true, handle: '.widgetheader', change: showSave});
- <?php if (!$config['widgets'] && $pconfig['sequence'] != "") { ?>
+ <?php if (!$config['widgets'] && $pconfig['sequence'] != "") { ?>
hideAllWidgets();
- domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');
+ domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '', 'delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');
<?php } ?>
});
//]]>
@@ -780,7 +780,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
//build list of javascript include files
$jsincludefiles = array();
$directory = "widgets/javascript/";
- $dirhandle = opendir($directory);
+ $dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
$jsincludefiles[] = $filename;
diff --git a/usr/local/www/installer/index.php b/usr/local/www/installer/index.php
deleted file mode 100644
index 9c97c41..0000000
--- a/usr/local/www/installer/index.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-header("Location: installer.php");
-
-?>
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php
deleted file mode 100644
index 6685034..0000000
--- a/usr/local/www/installer/installer.php
+++ /dev/null
@@ -1,1273 +0,0 @@
-<?php
-/*
- installer.php (pfSense webInstaller)
- part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-$nocsrf = true;
-
-require("globals.inc");
-require("guiconfig.inc");
-
-define('PC_SYSINSTALL', '/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh');
-
-if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
- header("Location: /");
- exit;
-}
-
-// Main switch dispatcher
-switch ($_REQUEST['state']) {
- case "update_installer_status":
- update_installer_status();
- exit;
- case "custominstall":
- installer_custom();
- exit;
- case "begin_install":
- installing_gui();
- begin_install();
- exit;
- case "verify_before_install":
- verify_before_install();
- exit;
- case "easy_install_ufs":
- easy_install("UFS+S");
- exit;
- case "easy_install_ufs":
- easy_install("ZFS");
- exit;
-
- default:
- installer_main();
-}
-
-function easy_install($fstype = "UFS+S") {
- // Calculate swap and disk sizes
- $disks = installer_find_all_disks();
- $memory = get_memory();
- $swap_size = $memory[0] * 2;
- $first_disk = trim(installer_find_first_disk());
- $disk_info = pcsysinstall_get_disk_info($first_disk);
- $size = $disk_info['size'];
- $first_disk_size = $size - $swap_size;
- $disk_setup = array();
- $tmp_array = array();
- // Build the disk layout for /
- $tmp_array['disk'] = $first_disk;
- $tmp_array['size'] = $first_disk_size;
- $tmp_array['mountpoint'] = "/";
- $tmp_array['fstype'] = $fstype;
- $disk_setup[] = $tmp_array;
- unset($tmp_array);
- $tmp_array = array();
- // Build the disk layout for SWAP
- $tmp_array['disk'] = $first_disk;
- $tmp_array['size'] = $swap_size;
- $tmp_array['mountpoint'] = "none";
- $tmp_array['fstype'] = "SWAP";
- $disk_setup[] = $tmp_array;
- unset($tmp_array);
- $bootmanager = "bsd";
- file_put_contents("/tmp/webInstaller_disk_layout.txt", serialize($disk_setup));
- file_put_contents("/tmp/webInstaller_disk_bootmanager.txt", serialize($bootmanager));
- header("Location: installer.php?state=verify_before_install");
- exit;
-}
-
-function write_out_pc_sysinstaller_config($disks, $bootmanager = "bsd") {
- $diskareas = "";
- $fd = fopen("/usr/sbin/pc-sysinstall/examples/pfSense-install.cfg", "w");
- if (!$fd) {
- return true;
- }
- if ($bootmanager == "") {
- $bootmanager = "none";
- }
- // Yes, -1. We ++ early in loop.
- $numdisks = -1;
- $lastdisk = "";
- $diskdefs = "";
- // Run through the disks and create the conf areas for pc-sysinstaller
- foreach ($disks as $disksa) {
- $fstype = $disksa['fstype'];
- $size = $disksa['size'];
- $mountpoint = $disksa['mountpoint'];
- $disk = $disksa['disk'];
- if ($disk <> $lastdisk) {
- $lastdisk = $disk;
- $numdisks++;
- $diskdefs .= "# disk {$disk}\n";
- $diskdefs .= "disk{$numdisks}={$disk}\n";
- $diskdefs .= "partition=all\n";
- $diskdefs .= "bootManager={$bootmanager}\n";
- $diskdefs .= "commitDiskPart\n\n";
- }
- $diskareas .= "disk{$numdisks}-part={$fstype} {$size} {$mountpoint} \n";
- if ($encpass) {
- $diskareas .= "encpass={$encpass}\n";
- }
- }
-
- $config = <<<EOF
-# Sample configuration file for an installation using pc-sysinstall
-# This file was automatically generated by installer.php
-
-installMode=fresh
-installInteractive=yes
-installType=FreeBSD
-installMedium=LiveCD
-
-# Set the disk parameters
-{$diskdefs}
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# Size 0 means use the rest of the slice size
-# Alternatively, you can append .eli to any of
-# the above filesystem types to encrypt that disk.
-# If you with to use a passphrase with this
-# encrypted partition, on the next line
-# the flag "encpass=" should be entered:
-# encpass=mypass
-# disk0-part=UFS 500 /boot
-# disk0-part=UFS.eli 500 /
-# disk0-part=UFS.eli 500 /usr
-{$diskareas}
-
-# Do it now!
-commitDiskLabel
-
-# Set if we are installing via optical, USB, or FTP
-installType=FreeBSD
-
-packageType=cpdup
-
-# Optional Components
-cpdupPaths=boot,COPYRIGHT,bin,conf,conf.default,dev,etc,home,kernels,libexec,lib,root,sbin,usr,var
-
-# runExtCommand=chmod a+rx /usr/local/bin/after_installation_routines.sh ; cd / ; /usr/local/bin/after_installation_routines.sh
-EOF;
- fwrite($fd, $config);
- fclose($fd);
- return;
-}
-
-function start_installation() {
- global $g, $fstype, $savemsg;
- if (file_exists("/tmp/install_complete")) {
- return;
- }
- $ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'");
- if ($ps_running) {
- return;
- }
- $fd = fopen("/tmp/installer.sh", "w");
- if (!$fd) {
- die(gettext("Could not open /tmp/installer.sh for writing"));
- exit;
- }
- fwrite($fd, "/bin/rm /tmp/.pc-sysinstall/pc-sysinstall.log 2>/dev/null\n");
- fwrite($fd, "/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh -c /usr/sbin/pc-sysinstall/examples/pfSense-install.cfg \n");
- fwrite($fd, "/bin/chmod a+rx /usr/local/bin/after_installation_routines.sh\n");
- fwrite($fd, "cd / && /usr/local/bin/after_installation_routines.sh\n");
- fwrite($fd, "/bin/mkdir /mnt/tmp\n");
- fwrite($fd, "/usr/bin/touch /tmp/install_complete\n");
- fclose($fd);
- exec("/bin/chmod a+rx /tmp/installer.sh");
- mwexec_bg("/bin/sh /tmp/installer.sh");
-}
-
-function installer_find_first_disk() {
- global $g, $fstype, $savemsg;
- $disk = `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list | head -n1 | cut -d':' -f1`;
- return trim($disk);
-}
-
-function pcsysinstall_get_disk_info($diskname) {
- global $g, $fstype, $savemsg;
- $disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`);
- $disks_array = array();
- foreach ($disk as $d) {
- $disks_info = explode(":", $d);
- $tmp_array = array();
- if ($disks_info[0] == $diskname) {
- $disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`);
- $disk_info_split = explode("=", $disk_info);
- foreach ($disk_info as $di) {
- $di_s = explode("=", $di);
- if ($di_s[0]) {
- $tmp_array[$di_s[0]] = $di_s[1];
- }
- }
- $tmp_array['size']--;
- $tmp_array['disk'] = trim($disks_info[0]);
- $tmp_array['desc'] = trim(htmlentities($disks_info[1]));
- return $tmp_array;
- }
- }
-}
-
-// Return an array with all disks information.
-function installer_find_all_disks() {
- global $g, $fstype, $savemsg;
- $disk = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-list`);
- $disks_array = array();
- foreach ($disk as $d) {
- if (!$d) {
- continue;
- }
- $disks_info = explode(":", $d);
- $tmp_array = array();
- $disk_info = explode("\n", `/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh disk-info {$disks_info[0]}`);
- foreach ($disk_info as $di) {
- $di_s = explode("=", $di);
- if ($di_s[0]) {
- $tmp_array[$di_s[0]] = $di_s[1];
- }
- }
- $tmp_array['size']--;
- $tmp_array['disk'] = trim($disks_info[0]);
- $tmp_array['desc'] = trim(htmlentities($disks_info[1]));
- $disks_array[] = $tmp_array;
- }
- return $disks_array;
-}
-
-function update_installer_status() {
- global $g, $fstype, $savemsg;
- // Ensure status files exist
- if (!file_exists("/tmp/installer_installer_running")) {
- touch("/tmp/installer_installer_running");
- }
- $status = `cat /tmp/.pc-sysinstall/pc-sysinstall.log`;
- $status = str_replace("\n", "\\n", $status);
- $status = str_replace("\n", "\\r", $status);
- $status = str_replace("'", "\\'", $status);
- echo "document.forms[0].installeroutput.value='$status';\n";
- echo "document.forms[0].installeroutput.scrollTop = document.forms[0].installeroutput.scrollHeight;\n";
- // Find out installer progress
- $progress = "5";
- if (strstr($status, "Running: dd")) {
- $progress = "6";
- }
- if (strstr($status, "Running: gpart create -s GPT")) {
- $progress = "7";
- }
- if (strstr($status, "Running: gpart bootcode")) {
- $progress = "7";
- }
- if (strstr($status, "Running: newfs -U")) {
- $progress = "8";
- }
- if (strstr($status, "Running: sync")) {
- $progress = "9";
- }
- if (strstr($status, "/boot /mnt/boot")) {
- $progress = "10";
- }
- if (strstr($status, "/COPYRIGHT /mnt/COPYRIGHT")) {
- $progress = "11";
- }
- if (strstr($status, "/bin /mnt/bin")) {
- $progress = "12";
- }
- if (strstr($status, "/conf /mnt/conf")) {
- $progress = "15";
- }
- if (strstr($status, "/conf.default /mnt/conf.default")) {
- $progress = "20";
- }
- if (strstr($status, "/dev /mnt/dev")) {
- $progress = "25";
- }
- if (strstr($status, "/etc /mnt/etc")) {
- $progress = "30";
- }
- if (strstr($status, "/home /mnt/home")) {
- $progress = "35";
- }
- if (strstr($status, "/kernels /mnt/kernels")) {
- $progress = "40";
- }
- if (strstr($status, "/libexec /mnt/libexec")) {
- $progress = "50";
- }
- if (strstr($status, "/lib /mnt/lib")) {
- $progress = "60";
- }
- if (strstr($status, "/root /mnt/root")) {
- $progress = "70";
- }
- if (strstr($status, "/sbin /mnt/sbin")) {
- $progress = "75";
- }
- if (strstr($status, "/sys /mnt/sys")) {
- $progress = "80";
- }
- if (strstr($status, "/usr /mnt/usr")) {
- $progress = "95";
- }
- if (strstr($status, "/usr /mnt/usr")) {
- $progress = "90";
- }
- if (strstr($status, "/var /mnt/var")) {
- $progress = "95";
- }
- if (strstr($status, "cap_mkdb /etc/login.conf")) {
- $progress = "96";
- }
- if (strstr($status, "Setting hostname")) {
- $progress = "97";
- }
- if (strstr($status, "umount -f /mnt")) {
- $progress = "98";
- }
- if (strstr($status, "umount -f /mnt")) {
- $progress = "99";
- }
- if (strstr($status, "Installation finished")) {
- $progress = "100";
- }
- // Check for error and bail if we see one.
- if (stristr($status, "error")) {
- $error = true;
- 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'); ";
- echo "\$('#progressbar').css('width','100%');\n";
- unlink_if_exists("/tmp/install_complete");
- return;
- }
- $running_old = trim(file_get_contents("/tmp/installer_installer_running"));
- if ($installer_running <> "running") {
- $ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'");
- if ($ps_running) {
- $running = "\$('#installerrunning').html('<table><tr><td valign=\"middle\"><img src=\"/themes/{$g['theme']}/images/misc/loader.gif\"></td><td valign=\"middle\">&nbsp;<font size=\"2\"><b>Installer running ({$progress}% completed)...</td></tr></table>'); ";
- if ($running_old <> $running) {
- echo $running;
- file_put_contents("/tmp/installer_installer_running", "$running");
- }
- }
- }
- if ($progress) {
- echo "\$('#progressbar').css('width','{$progress}%');\n";
- }
- if (file_exists("/tmp/install_complete")) {
- 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";
- echo "\$('#pbdiv').fadeOut();\n";
- unlink_if_exists("/tmp/installer.sh");
- file_put_contents("/tmp/installer_installer_running", "finished");
- }
-}
-
-function update_installer_status_win($status) {
- global $g, $fstype, $savemsg;
- echo "<script type=\"text/javascript\">\n";
- echo " \$('#installeroutput').val('" . str_replace(htmlentities($status), "\n", "") . "');\n";
- echo "</script>\n";
-}
-
-function begin_install() {
- global $g, $savemsg;
- if (file_exists("/tmp/install_complete")) {
- return;
- }
- unlink_if_exists("/tmp/install_complete");
- update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."),$disk));
- start_installation();
-}
-
-function head_html() {
- global $g, $fstype, $savemsg;
- echo <<<EOF
-<html>
- <head>
- <style type='text/css'>
- hr {
- border: 0;
- color: #000000;
- background-color: #000000;
- height: 1px;
- width: 100%;
- text-align: left;
- }
- a:link {
- color: #000000;
- text-decoration:underline;
- font-size:14;
- }
- a:visited {
- color: #000000;
- text-decoration:underline;
- font-size:14;
- }
- a:hover {
- color: #FFFF00;
- text-decoration: none;
- font-size:14;
- }
- a:active {
- color: #FFFF00;
- text-decoration:underline;
- font-size:14;
- }
- </style>
- </head>
-EOF;
-
-}
-
-function body_html() {
- global $g, $fstype, $savemsg;
- $pgtitle = array("{$g['product_name']}", gettext("Installer"));
- include("head.inc");
- echo <<<EOF
- <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
- <script type="text/javascript" src="/javascript/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="/javascript/jquery-migrate-1.2.1.min.js"></script>
- <script type="text/javascript" src="/javascript/jquery/jquery-ui-1.11.1.min.js"></script>
- <script type="text/javascript">
- function getinstallerprogress() {
- url = '/installer/installer.php';
- pars = 'state=update_installer_status';
- callajax(url, pars, installcallback);
- }
- function callajax(url, pars, activitycallback) {
- jQuery.ajax(
- url,
- {
- type: 'post',
- data: pars,
- complete: activitycallback
- });
- }
- function installcallback(transport) {
- setTimeout('getinstallerprogress()', 2000);
- eval(transport.responseText);
- }
- </script>
-EOF;
-
- if ($one_two) {
- echo "<p class=\"pgtitle\">{$pgtitle}</font></p>";
- }
-
- if ($savemsg) {
- print_info_box($savemsg);
- }
-}
-
-function end_html() {
- global $g, $fstype, $savemsg;
- echo "</form>";
- echo "</body>";
- echo "</html>";
-}
-
-function template() {
- global $g, $fstype, $savemsg;
- head_html();
- body_html();
- echo <<<EOF
- <div id="mainlevel">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <form action="installer.php" method="post">
- <div id="pfsensetemplate">
-
-
- </div>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </div>
-EOF;
- end_html();
-}
-
-function verify_before_install() {
- global $g, $fstype, $savemsg;
- $encrypted_root = false;
- $non_encrypted_boot = false;
- $non_encrypted_notice = false;
- head_html();
- body_html();
- page_table_start($g['product_name'] . " installer - Verify final installation settings");
- // If we are visiting this step from anything but the row editor / custom install
- // then load the on disk layout contents if they are available.
- if (!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) {
- $disks = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
- $bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt"));
- $restored_layout_from_file = true;
- $restored_layout_txt = "The previous disk layout was restored from disk";
- } else {
- $disks = array();
- }
- if (!$bootmanager) {
- $bootmanager = $_REQUEST['bootmanager'];
- }
- // echo "\n<!--" . print_r($_REQUEST, true) . " -->\n";
- $disk = pcsysinstall_get_disk_info(htmlspecialchars($_REQUEST['disk']));
- $disksize = format_bytes($disk['size'] * 1048576);
- // Loop through posted items and create an array
- for ($x=0; $x<99; $x++) { // XXX: Make this more optimal
- if (!$_REQUEST['fstype' . $x]) {
- continue;
- }
- $tmparray = array();
- if ($_REQUEST['fstype' . $x] <> "SWAP") {
- $tmparray['mountpoint'] = $_REQUEST['mountpoint' . $x];
- // Check for encrypted slice /
- if (stristr($_REQUEST['fstype' . $x], ".eli")) {
- if ($tmparray['mountpoint'] == "/") {
- $encrypted_root = true;
- }
- }
- // Check if we have a non-encrypted /boot
- if ($tmparray['mountpoint'] == "/boot") {
- if (!stristr($_REQUEST['fstype' . $x], ".eli")) {
- $non_encrypted_boot = true;
- }
- }
- if ($tmparray['mountpoint'] == "/conf") {
- $tmparray['mountpoint'] = "/conf{$x}";
- $error_txt[] = "/conf is not an allowed mount point and has been renamed to /conf{$x}.";
- }
- } else {
- $tmparray['mountpoint'] = "none";
- }
- // If we have an encrypted /root and lack a non encrypted /boot, throw an error/warning
- if ($encrypted_root && !$non_encrypted_boot && !$non_encrypted_notice) {
- $error_txt[] = "A non-encrypted /boot slice is required when encrypting the / slice";
- $non_encrypted_notice = true;
- }
- $tmparray['disk'] = $_REQUEST['disk' . $x];
- $tmparray['fstype'] = $_REQUEST['fstype' . $x];
- $tmparray['size'] = $_REQUEST['size' . $x];
- $tmparray['encpass'] = $_REQUEST['encpass' . $x];
- $disks[] = $tmparray;
- }
- // echo "\n<!-- " . print_r($disks, true) . " --> \n";
- $bootmanagerupper = strtoupper($bootmanager);
- echo <<<EOFAMBAC
- <form method="post" action="installer.php">
- <input type="hidden" name="fstype" value="{$fstype_echo}">
- <input type="hidden" name="disk" value="{$disk_echo}">
- <input type="hidden" name="state" value="begin_install">
- <input type="hidden" name="swapsize" value="{$swapsize}">
- <input type="hidden" name="encpass" value="{$encpass}">
- <input type="hidden" name="bootmanager" value="{$bootmanager}">
- <div id="mainlevel">
- <table width="800" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <div id="mainarea">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td >
- <div>
- <center>
- <div id="pfsensetemplate">
- <table width='100%'>
-EOFAMBAC;
- // If errors are found, throw the big red box.
- if ($error_txt) {
- echo "<tr><td colspan=\"5\">&nbsp;</td>";
- echo "<tr><td colspan=\"5\">";
- print_input_errors($error_txt);
- echo "</td></tr>";
- } else {
- echo "<tr><td>&nbsp;</td></tr>";
- }
-
- echo <<<EOFAMBACBAF
-
- <tr><td colspan='5' align="center"><b>Boot manager: {$bootmanagerupper}</td></tr>
- <tr><td>&nbsp;</td></tr>
- <tr>
- <td align='left'>
- <b>Mount point</b>
- </td>
- <td align='left'>
- <b>Filesysytem type</b>
- </td>
- <td align='left'>
- <b>Disk</b>
- </td>
- <td align='left'>
- <b>Size</b>
- </td>
- <td align='left'>
- <b>Encryption password</b>
- </td>
- </tr>
- <tr><td colspan='5'><hr></td></tr>
-
-EOFAMBACBAF;
-
- foreach ($disks as $disk) {
- $desc = pcsysinstall_get_disk_info($disk['disk']);
- echo "<tr>";
- echo "<td>&nbsp;&nbsp;&nbsp;" . htmlspecialchars($disk['mountpoint']) . "</td>";
- echo "<td>" . htmlspecialchars($disk['fstype']) . "</td>";
- echo "<td>" . htmlspecialchars($disk['disk']) . " " . htmlspecialchars($desc['desc']) . "</td>";
- echo "<td>" . htmlspecialchars($disk['size']) . "</td>";
- echo "<td>" . htmlspecialchars($disk['encpass']) . "</td>";
- echo "</tr>";
- }
-
-echo <<<EOFAMB
- <tr><td colspan="5"><hr></td></tr>
- </table>
- </div>
- </center>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <center>
- <p/>
- <input type="button" value="Cancel" onClick="javascript:document.location='installer.php?state=custominstall';"> &nbsp;&nbsp;
-EOFAMB;
- if (!$error_txt) {
- echo "<input type=\"submit\" value=\"Begin installation\"> <br />&nbsp;";
- }
-echo <<<EOFAMBASDF
-
- </center>
- </td>
- </tr>
- </table>
- </div>
-EOFAMBASDF;
-
-
- page_table_end();
- end_html();
- write_out_pc_sysinstaller_config($disks, $bootmanager);
- // Serialize layout to disk so it can be read in later.
- file_put_contents("/tmp/webInstaller_disk_layout.txt", serialize($disks));
- file_put_contents("/tmp/webInstaller_disk_bootmanager.txt", serialize($bootmanager));
-}
-
-function installing_gui() {
- global $g, $fstype, $savemsg;
- head_html();
- body_html();
- echo "<form action=\"installer.php\" method=\"post\" state=\"step1_post\">";
- page_table_start();
- echo <<<EOF
- <center>
- <table width="100%">
- <tr><td>
- <div id="mainlevel">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <div id="mainarea">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <div id="pfsenseinstaller" width="100%">
- <div id='installerrunning' width='100%' style="padding:8px; border:1px dashed #000000">
- <table>
- <tr>
- <td valign="middle">
- <img src="/themes/{$g['theme']}/images/misc/loader.gif">
- </td>
- <td valign="middle">
- &nbsp;<font size="2"><b>Starting Installer... Please wait...
- </td>
- </tr>
- </table>
- </div>
- <div id='pbdiv'>
- <br />
- <center>
- <table id='pbtable' height='15' width='640' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
- <tr>
- <td background="/themes/{$g['theme']}/images/misc/bar_left.gif" height='15' width='5'>
- </td>
- <td>
- <table id="progholder" name="progholder" height='15' width='630' border='0' colspacing='0' cellpadding='0' cellspacing='0'>
- <td background="/themes/{$g['theme']}/images/misc/bar_gray.gif" valign="top" align="left">
- <img src='/themes/{$g['theme']}/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'>
- </td>
- </table>
- </td>
- <td background="/themes/{$g['theme']}/images/misc/bar_right.gif" height='15' width='5'>
- </td>
- </tr>
- </table>
- <br />
- </div>
- <textarea name='installeroutput' id='installeroutput' rows="31" cols="90">
- </textarea>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </td></tr>
- </table>
- </center>
- <script type="text/javascript">setTimeout('getinstallerprogress()', 250);</script>
-
-EOF;
- page_table_end();
- end_html();
-}
-
-function page_table_start($pgtitle = "") {
- global $g, $fstype, $savemsg;
- if ($pgtitle == "") {
- $pgtitle = "{$g['product_name']} installer";
- }
- echo <<<EOF
- <center>
- <img border="0" src="/themes/{$g['theme']}/images/logo.gif"></a><br />
- <table cellpadding="6" cellspacing="0" width="550" style="border:1px solid #000000">
- <tr height="10" bgcolor="#990000">
- <td style="border-bottom:1px solid #000000">
- <font color='white'>
- <b>
- {$pgtitle}
- </b>
- </font>
- </td>
- </tr>
- <tr>
- <td>
-
-EOF;
-
-}
-
-function page_table_end() {
- global $g, $fstype, $savemsg;
- echo <<<EOF
- </td>
- </tr>
- </table>
- </center>
-
-EOF;
-
-}
-
-function installer_custom() {
- global $g, $fstype, $savemsg;
- global $select_txt, $custom_disks;
- if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
- unlink("/tmp/.pc-sysinstall/pc-sysinstall.log");
- }
- $disks = installer_find_all_disks();
- // Pass size of disks down to javascript.
- $disk_sizes_js_txt = "var disk_sizes = new Array();\n";
- foreach ($disks as $disk) {
- $disk_sizes_js_txt .= "disk_sizes['{$disk['disk']}'] = '{$disk['size']}';\n";
- }
- head_html();
- body_html();
- page_table_start($g['product_name'] . " installer - Customize disk(s) layout");
- echo <<<EOF
- <script type="text/javascript">
- Array.prototype.in_array = function(p_val) {
- for (var i = 0, l = this.length; i < l; i++) {
- if (this[i] == p_val) {
- return true;
- }
- }
- return false;
- }
- function row_helper_dynamic_custom() {
- var totalsize = 0;
- {$disk_sizes_js_txt}
- // Run through all rows and process data
- for (var x = 0; x<99; x++) { //optimize me better
- if (\$('#fstype' + x).length) {
- if (\$('#size' + x).val() == '') {
- \$('#size' + x).val(disk_sizes[\$('disk' + x).value]);
- }
- var fstype = \$('#fstype' + x).val();
- if (fstype.substring(fstype.length - 4) == ".eli") {
- \$('#encpass' + x).prop('disabled',false);
- if (!encryption_warning_shown) {
- alert('NOTE: If you define a disk encryption password you will need to enter it on *EVERY* bootup!');
- encryption_warning_shown = true;
- }
- } else {
- \$('#encpass' + x).prop('disabled',true);
- }
- }
- // Calculate size allocations
- if (\$('#size' + x).length) {
- if (parseInt($('#size' + x).val()) > 0) {
- totalsize += parseInt($('#size' + x).val());
- }
- }
- }
- // If the totalsize element exists, set it and disable
- if (\$('#totalsize').length) {
- if (\$('#totalsize').val() != totalsize) {
- // When size allocation changes, draw attention.
- jQuery('#totalsize').effect('highlight');
- \$('#totalsize').val(totalsize);
- }
- \$('#totalsize').prop('disabled',true);
- }
- if (\$('#disktotals').length) {
- var disks_seen = new Array();
- var tmp_sizedisks = 0;
- var disksseen = 0;
- for (var xx = 0; xx<99; xx++) {
- if (\$('#disk' + xx).length) {
- if (!disks_seen.in_array(\$('#disk' + xx).val())) {
- tmp_sizedisks += parseInt(disk_sizes[\$('#disk' + xx).val()]);
- disks_seen[disksseen] = \$('#disk' + xx).val();
- disksseen++;
- }
- }
- \$('#disktotals').val(tmp_sizedisks);
- \$('#disktotals').prop('disabled',true);
- \$('#disktotals').css('color','#000000');
- var remaining = parseInt(\$('#disktotals').val()) - parseInt(\$('#totalsize').val());
- if (remaining == 0) {
- if (\$('#totalsize').length)
- \$('#totalsize').css({
- 'background':'#00FF00',
- 'color':'#000000'
- });
- } else {
- if (\$('#totalsize').length)
- \$('#totalsize').css({
- 'background':'#FFFFFF',
- 'color':'#000000'
- });
- }
- if (parseInt(\$('#totalsize').val()) > parseInt(\$('#disktotals').val())) {
- if (\$('#totalsize'))
- \$('#totalsize').css({
- 'background':'#FF0000',
- 'color':'#000000'
- });
- }
- if (\$('#availalloc').length) {
- \$('#availalloc').prop('disabled',true);
- \$('#availalloc').val(remaining);
- \$('#availalloc').css({
- 'background':'#FFFFFF',
- 'color':'#000000'
- });
- }
- }
- }
- }
- </script>
- <script type="text/javascript" src="/javascript/row_helper_dynamic.js"></script>
- <script type="text/javascript">
- // Setup rowhelper data types
- rowname[0] = "mountpoint";
- rowtype[0] = "textbox";
- rowsize[0] = "8";
- rowname[1] = "fstype";
- rowtype[1] = "select";
- rowsize[1] = "1";
- rowname[2] = "disk";
- rowtype[2] = "select";
- rowsize[2] = "1";
- rowname[3] = "size";
- rowtype[3] = "textbox";
- rowsize[3] = "8";
- rowname[4] = "encpass";
- rowtype[4] = "textbox";
- rowsize[4] = "8";
- field_counter_js = 5;
- rows = 1;
- totalrows = 1;
- loaded = 1;
- rowhelper_onChange = " onChange='javascript:row_helper_dynamic_custom()' ";
- rowhelper_onDelete = "row_helper_dynamic_custom(); ";
- rowhelper_onAdd = "row_helper_dynamic_custom();";
- </script>
- <form action="installer.php" method="post">
- <input type="hidden" name="state" value="verify_before_install">
- <div id="mainlevel">
- <center>
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <center>
- <div id="mainarea">
- <center>
- <table width="100%" border="0" cellpadding="5" cellspacing="5">
- <tr>
- <td>
- <div id="pfsenseinstaller">
- <center>
- <div id='loadingdiv'>
- <table>
- <tr>
- <td valign="center">
- <img src="/themes/{$g['theme']}/images/misc/loader.gif">
- </td>
- <td valign="center">
- &nbsp;Probing disks, please wait...
- </td>
- </tr>
- </table>
- </div>
-EOF;
- ob_flush();
- // Read bootmanager setting from disk if found
- if (file_exists("/tmp/webInstaller_disk_bootmanager.txt")) {
- $bootmanager = unserialize(file_get_contents("/tmp/webInstaller_disk_bootmanager.txt"));
- }
- if ($bootmanager == "none") {
- $noneselected = " SELECTED";
- }
- if ($bootmanager == "bsd") {
- $bsdeselected = " SELECTED";
- }
- if (!$disks) {
- $custom_txt = gettext("ERROR: Could not find any suitable disks for installation.");
- } else {
- // Prepare disk selection dropdown
- $custom_txt = <<<EOF
- <center>
- <table>
- <tr>
- <td align='right'>
- Boot manager:
- </td>
- <td>
- <select name='bootmanager'>
- <option value='none' $noneselected>
- None
- </option>
- <option value='bsd' $bsdeselected>
- BSD
- </option>
- </select>
- </td>
- </tr>
- </table>
- <hr>
- <table id='maintable'><tbody>
- <tr>
- <td align="middle">
- <b>Mount</b>
- </td>
- <td align='middle'>
- <b>Filesysytem</b>
- </td>
- <td align="middle">
- <b>Disk</b>
- </td>
- <td align="middle">
- <b>Size</b>
- </td>
- <td align="middle">
- <b>Encryption password</b>
- </td>
- <td>
- &nbsp;
- </td>
- </tr>
- <tr>
-
-EOF;
-
- // Calculate swap disk sizes
- $memory = get_memory();
- $swap_size = $memory[0] * 2;
- $first_disk = trim(installer_find_first_disk());
- $disk_info = pcsysinstall_get_disk_info($first_disk);
- $size = $disk_info['size'];
- $first_disk_size = $size - $swap_size;
-
- // Debugging
- // echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size - $first_disk_size -->\n\n";
-
- // Check to see if a on disk layout exists
- if (file_exists("/tmp/webInstaller_disk_layout.txt")) {
- $disks_restored = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
- $restored_layout_from_file = true;
- $restored_layout_txt = "<br />* The previous disk layout was restored from a previous session";
- }
-
- // If we restored disk layout(s) from a file then build the rows
- if ($restored_layout_from_file == true) {
- $diskcounter = 0;
- foreach ($disks_restored as $dr) {
- $custom_txt .= return_rowhelper_row("$diskcounter", $dr['mountpoint'], $dr['fstype'], $dr['disk'], $dr['size'], $dr['encpass']);
- $diskcounter++;
- }
- } else {
- // Construct the default rows that outline the disks configuration.
- $custom_txt .= return_rowhelper_row("0", "/", "UFS+S", $first_disk, "{$first_disk_size}", "");
- $custom_txt .= return_rowhelper_row("1", "none", "SWAP", $first_disk, "$swap_size", "");
- }
-
- // tfoot and tbody are used by rowhelper
- $custom_txt .= "</tr>";
- $custom_txt .= "<tfoot></tfoot></tbody>";
- // Total allocation box
- $custom_txt .= "<tr><td></td><td></td><td align='right'>Total allocated:</td><td><input style='border:0px; background-color: #FFFFFF;' size='8' id='totalsize' name='totalsize'></td>";
- // Add row button
- $custom_txt .= "</td><td>&nbsp;</td><td>";
- $custom_txt .= "<div id=\"addrowbutton\">";
- $custom_txt .= "<a onclick=\"javascript:addRowTo('maintable', 'formfldalias'); return false;\" href=\"#\">";
- $custom_txt .= "<img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" alt=\"\" title=\"add another entry\" /></a>";
- $custom_txt .= "</div>";
- $custom_txt .= "</td></tr>";
- // Disk capacity box
- $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>";
- // Remaining allocation box
- $custom_txt .= "<tr><td></td><td></td><td align='right'>Available space for allocation:</td><td><input style='border:0px; background-color: #FFFFFF;' size='8' id='availalloc' name='availalloc'></td></tr>";
- $custom_txt .= "</table>";
- $custom_txt .= "<script type=\"text/javascript\">row_helper_dynamic_custom();</script>";
- }
- echo <<<EOF
-
- <tr>
- <td colspan='4'>
- <script type="text/javascript">
- \$('#loadingdiv').css('visibility','hidden');
- </script>
- <div id='contentdiv' style="display:none;">
- <p/>
- {$custom_txt}<p/>
- <hr><p/>
- <input type="button" value="Cancel" onClick="javascript:document.location='/installer/installer.php';"> &nbsp;&nbsp
- <input type="submit" value="Next">
- </div>
- <script type="text/javascript">
- var encryption_warning_shown = false;
- \$('#contentdiv').fadeIn();
- row_helper_dynamic_custom();
- </script>
- </center>
- </td></tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </center>
- <span class="vexpl">
- <span class="red">
- <strong>
- NOTES:
- </strong>
- </span>
- <br />* Sizes are in megabytes.
- <br />* Mount points named /conf are not allowed. Use /cf if you want to make a configuration slice/mount.
- {$restored_layout_txt}
- </span>
- </strong>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </center>
- <script type="text/javascript">
- <!--
- newrow[1] = "{$select_txt}";
- newrow[2] = "{$custom_disks}";
- -->
- </script>
-
-
-EOF;
- page_table_end();
- end_html();
-}
-
-function installer_main() {
- global $g, $fstype, $savemsg;
- if (file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) {
- unlink("/tmp/.pc-sysinstall/pc-sysinstall.log");
- }
- head_html();
- body_html();
- $disk = installer_find_first_disk();
- // Only enable ZFS if this exists. The install will fail otherwise.
- if (file_exists("/boot/gptzfsboot")) {
- $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>";
- }
- page_table_start();
- echo <<<EOF
- <form action="installer.php" method="post" state="step1_post">
- <div id="mainlevel">
- <center>
- <b><font face="arial" size="+2">Welcome to the {$g['product_name']} webInstaller!</b></font><p/>
- <font face="arial" size="+1">This utility will install {$g['product_name']} to a hard disk, flash drive, etc.</font>
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <center>
- <div id="mainarea">
- <br />
- <center>
- Please select an installer option to begin:
- <p/>
- <table width="100%" border="0" cellpadding="5" cellspacing="5">
- <tr>
- <td>
- <div id="pfsenseinstaller">
- <center>
-EOF;
- if (!$disk) {
- echo gettext("ERROR: Could not find any suitable disks for installation.");
- echo "</div></td></tr></table></div></table></div>";
- end_html();
- exit;
- }
- echo <<<EOF
-
- <table cellspacing="5" cellpadding="5" style="border: 1px dashed;">
- <tr bgcolor="#CECECE"><td align="center">
- <a href="installer.php?state=easy_install_ufs">Easy installation of {$g['product_name']} using the UFS filesystem on disk {$disk}</a>
- </td></tr>
- {$zfs_enabled}
- <tr bgcolor="#AAAAAA"><td align="center">
- <a href="installer.php?state=custominstall">Custom installation of {$g['product_name']}</a>
- </td></tr>
- <tr bgcolor="#CECECE"><td align="center">
- <a href='/'>Cancel and return to Dashboard</a>
- </td></tr>
- </table>
- </center>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </div>
-EOF;
- page_table_end();
- end_html();
-}
-
-function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encpass) {
- global $g, $select_txt, $custom_disks, $savemsg;
- $release = php_uname("r");
- // Get release number like 8.3 or 10.1
- $relnum = strtok($release, "-");
-
- // Mount point
- $disks = installer_find_all_disks();
- $custom_txt .= "<tr>";
- $custom_txt .= "<td><input size='8' id='mountpoint{$rownum}' name='mountpoint{$rownum}' value='{$mountpoint}'></td>";
-
- // Filesystem type array
- $types = array(
- 'UFS' => 'UFS',
- 'UFS+S' => 'UFS + Softupdates',
- 'UFS.eli' => 'Encrypted UFS',
- 'UFS+S.eli' => 'Encrypted UFS + Softupdates',
- 'SWAP' => 'SWAP'
- );
-
- // UFS + Journaling was introduced in 9.0
- if ($relnum >= 9) {
- $types['UFS+J'] = "UFS + Journaling";
- $types['UFS+J.eli'] = "Encrypted UFS + Journaling";
- }
-
- // Add ZFS Boot loader if it exists
- if (file_exists("/boot/gptzfsboot")) {
- $types['ZFS'] = "Zetabyte Filesystem";
- $types['ZFS.eli'] = "Encrypted Zetabyte Filesystem";
- }
-
- // fstype form field
- $custom_txt .= "<td><select onChange='javascript:row_helper_dynamic_custom()' id='fstype{$rownum}' name='fstype{$rownum}'>";
- $select_txt = "";
- foreach ($types as $type => $desc) {
- if ($type == $fstype) {
- $SELECTED="SELECTED";
- } else {
- $SELECTED="";
- }
- $select_txt .= "<option value='$type' $SELECTED>$desc</option>";
- }
- $custom_txt .= "{$select_txt}</select>\n";
- $custom_txt .= "</td>";
-
- // Disk selection form field
- $custom_txt .= "<td><select id='disk{$rownum}' name='disk{$rownum}'>\n";
- $custom_disks = "";
- foreach ($disks as $dsk) {
- $disksize_bytes = format_bytes($dsk['size'] * 1048576);
- $disksize = $dsk['size'];
- if ($disk == $dsk['disk']) {
- $SELECTED="SELECTED";
- } else {
- $SELECTED="";
- }
- $custom_disks .= "<option value='{$dsk['disk']}' $SELECTED>{$dsk['disk']} - {$dsk['desc']} - {$disksize}MB ({$disksize_bytes})</option>";
- }
- $custom_txt .= "{$custom_disks}</select></td>\n";
-
- // Slice size
- $custom_txt .= "<td><input onChange='javascript:row_helper_dynamic_custom();' name='size{$rownum}' id='size{$rownum}' size='8' type='text' value='{$size}'></td>";
-
- // Encryption password
- $custom_txt .= "<td>";
- $custom_txt .= "<input id='encpass{$rownum}' name='encpass{$rownum}' size='8' value='{$encpass}'>";
- $custom_txt .= "</td>";
-
- // Add Rowhelper + button
- if ($rownum > 0) {
- $custom_txt .= "<td><a onclick=\"removeRow(this); return false;\" href=\"#\"><img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" alt=\"\" title=\"remove this entry\"/></a></td>";
- }
-
- $custom_txt .= "</tr>";
- return $custom_txt;
-}
-
-?>
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 078857e..73f23d1 100644
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -88,7 +88,7 @@ if (!is_array($config['ppps']['ppp'])) {
$a_ppps = &$config['ppps']['ppp'];
function remove_bad_chars($string) {
- return preg_replace('/[^a-z_0-9]/i','',$string);
+ return preg_replace('/[^a-z_0-9]/i', '', $string);
}
if (!is_array($config['gateways']['gateway_item'])) {
@@ -180,9 +180,9 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
} else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp") {
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
- $pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
- $pconfig['pptp_subnet'] = explode(",",$a_ppps[$pppid]['subnet']);
- $pconfig['pptp_remote'] = explode(",",$a_ppps[$pppid]['gateway']);
+ $pconfig['pptp_local'] = explode(",", $a_ppps[$pppid]['localip']);
+ $pconfig['pptp_subnet'] = explode(",", $a_ppps[$pppid]['subnet']);
+ $pconfig['pptp_remote'] = explode(",", $a_ppps[$pppid]['gateway']);
$pconfig['pptp_dialondemand'] = isset($a_ppps[$pppid]['ondemand']);
$pconfig['pptp_idletimeout'] = $a_ppps[$pppid]['timeout'];
}
@@ -255,7 +255,7 @@ $pconfig['enable'] = isset($wancfg['enable']);
if (is_array($config['aliases']['alias'])) {
foreach ($config['aliases']['alias'] as $alias) {
if ($alias['name'] == $wancfg['descr']) {
- $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."),$wancfg['descr']);
+ $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $wancfg['descr']);
}
}
}
@@ -504,7 +504,7 @@ if ($_POST['apply']) {
}
conf_mount_rw();
- /* filter out spaces from descriptions */
+ /* filter out spaces from descriptions */
$_POST['descr'] = remove_bad_chars($_POST['descr']);
/* okay first of all, cause we are just hiding the PPPoE HTML
@@ -531,17 +531,17 @@ if ($_POST['apply']) {
$input_errors[] = gettext("The interface description cannot contain only numbers.");
}
/* input validation */
- if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (! preg_match("/^staticv4/", $_POST['type']))) {
+ if (isset($config['dhcpd']) && isset($config['dhcpd'][$if]['enable']) && (!preg_match("/^staticv4/", $_POST['type']))) {
$input_errors[] = gettext("The DHCP Server is active on this interface and it can be used only with a static IP configuration. Please disable the DHCP Server service on this interface first, then change the interface configuration.");
}
- if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6']))) {
+ if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (!preg_match("/^staticv6/", $_POST['type6']))) {
$input_errors[] = gettext("The DHCP6 Server is active on this interface and it can be used only with a static IPv6 configuration. Please disable the DHCPv6 Server service on this interface first, then change the interface configuration.");
}
switch (strtolower($_POST['type'])) {
case "staticv4":
$reqdfields = explode(" ", "ipaddr subnet gateway");
- $reqdfieldsn = array(gettext("IPv4 address"),gettext("Subnet bit count"),gettext("Gateway"));
+ $reqdfieldsn = array(gettext("IPv4 address"), gettext("Subnet bit count"), gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "none":
@@ -555,36 +555,36 @@ if ($_POST['apply']) {
break;
case "ppp":
$reqdfields = explode(" ", "port phone");
- $reqdfieldsn = array(gettext("Modem Port"),gettext("Phone Number"));
+ $reqdfieldsn = array(gettext("Modem Port"), gettext("Phone Number"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "pppoe":
if ($_POST['pppoe_dialondemand']) {
$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
- $reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"),gettext("Dial on demand"),gettext("Idle timeout value"));
+ $reqdfieldsn = array(gettext("PPPoE username"), gettext("PPPoE password"), gettext("Dial on demand"), gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "pppoe_username pppoe_password");
- $reqdfieldsn = array(gettext("PPPoE username"),gettext("PPPoE password"));
+ $reqdfieldsn = array(gettext("PPPoE username"), gettext("PPPoE password"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "pptp":
if ($_POST['pptp_dialondemand']) {
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
- $reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
+ $reqdfieldsn = array(gettext("PPTP username"), gettext("PPTP password"), gettext("PPTP local IP address"), gettext("PPTP subnet"), gettext("PPTP remote IP address"), gettext("Dial on demand"), gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
- $reqdfieldsn = array(gettext("PPTP username"),gettext("PPTP password"),gettext("PPTP local IP address"),gettext("PPTP subnet"),gettext("PPTP remote IP address"));
+ $reqdfieldsn = array(gettext("PPTP username"), gettext("PPTP password"), gettext("PPTP local IP address"), gettext("PPTP subnet"), gettext("PPTP remote IP address"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "l2tp":
if ($_POST['pptp_dialondemand']) {
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout");
- $reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
+ $reqdfieldsn = array(gettext("L2TP username"), gettext("L2TP password"), gettext("L2TP remote IP address"), gettext("Dial on demand"), gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote");
- $reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"));
+ $reqdfieldsn = array(gettext("L2TP username"), gettext("L2TP password"), gettext("L2TP remote IP address"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
@@ -592,7 +592,7 @@ if ($_POST['apply']) {
switch (strtolower($_POST['type6'])) {
case "staticv6":
$reqdfields = explode(" ", "ipaddrv6 subnetv6 gatewayv6");
- $reqdfieldsn = array(gettext("IPv6 address"),gettext("Subnet bit count"),gettext("Gateway"));
+ $reqdfieldsn = array(gettext("IPv6 address"), gettext("Subnet bit count"), gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "none":
@@ -606,7 +606,7 @@ if ($_POST['apply']) {
break;
case "dhcp6":
if (in_array($wancfg['ipaddrv6'], array())) {
- $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']);
}
if ($_POST['dhcp6-ia-pd-send-hint'] && strtolower($_POST['dhcp6-ia-pd-len']) == 'none') {
$input_errors[] = gettext('DHCPv6 Prefix Delegation size must be provided when Send IPv6 prefix hint flag is checked');
@@ -622,24 +622,24 @@ if ($_POST['apply']) {
}
}
if (in_array($wancfg['ipaddrv6'], array())) {
- $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']);
}
break;
case "6to4":
foreach ($ifdescrs as $ifent => $ifdescr) {
if ($if != $ifent && ($config[interfaces][$ifent]['ipaddrv6'] == $_POST['type6'])) {
- $input_errors[] = sprintf(gettext("You can only have one interface configured as 6to4."),$_POST['type6']);
+ $input_errors[] = sprintf(gettext("You can only have one interface configured as 6to4."), $_POST['type6']);
break;
}
}
if (in_array($wancfg['ipaddrv6'], array())) {
- $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']);
}
break;
case "track6":
/* needs to check if $track6-prefix-id is used on another interface */
if (in_array($wancfg['ipaddrv6'], array())) {
- $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."), $_POST['type6']);
}
if ($_POST['track6-prefix-id--hex'] != "" && !is_numeric("0x" . $_POST['track6-prefix-id--hex'])) {
@@ -656,8 +656,9 @@ if ($_POST['apply']) {
}
if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' &&
$config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] &&
- $config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id)
+ $config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id) {
$input_errors[] = sprintf(gettext("This track6 prefix ID is already being used in %s."), $ifdescr);
+ }
}
}
}
@@ -948,7 +949,7 @@ if ($_POST['apply']) {
if (strlen($_POST['key' . $i]) == 28) {
continue;
}
- $input_errors[] = gettext("Invalid WEP key. Enter a valid 40, 64, 104 or 128 bit WEP key.");
+ $input_errors[] = gettext("Invalid WEP key. Enter a valid 40, 64, 104 or 128 bit WEP key.");
break;
}
}
@@ -1090,7 +1091,7 @@ if ($_POST['apply']) {
}
$wancfg['descr'] = remove_bad_chars($_POST['descr']);
- $wancfg['enable'] = $_POST['enable'] == "yes" ? true : false;
+ $wancfg['enable'] = $_POST['enable'] == "yes" ? true : false;
/* let return_gateways_array() do the magic on dynamic interfaces for us */
switch ($_POST['type']) {
@@ -1747,12 +1748,12 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
function show_mon_config() {
jQuery("#showmonbox").html('');
- jQuery('#showmon').css('display','block');
+ jQuery('#showmon').css('display', 'block');
}
function openwindow(url) {
- var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
- if (oWin==null || typeof(oWin)=="undefined") {
+ var oWin = window.open(url, "pfSensePop", "width=620,height=400,top=150,left=150");
+ if (oWin == null || typeof(oWin) == "undefined") {
return false;
} else {
return true;
@@ -1776,7 +1777,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
});
}
});
- jQuery('#trcountry').css('display',"table-row");
+ jQuery('#trcountry').css('display', "table-row");
}
function providers_list() {
@@ -1796,8 +1797,8 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
});
}
});
- jQuery('#trprovider').css("display","table-row");
- jQuery('#trproviderplan').css("display","none");
+ jQuery('#trprovider').css("display", "table-row");
+ jQuery('#trproviderplan').css("display", "none");
}
function providerplan_list() {
@@ -1821,14 +1822,14 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
});
}
});
- jQuery('#trproviderplan').css("display","table-row");
+ jQuery('#trproviderplan').css("display", "table-row");
}
function prefill_provider() {
jQuery.ajax("getserviceproviders.php",{
type: 'post',
data: {country : jQuery('#country').val(), provider : jQuery('#provider_list').val(), plan : jQuery('#providerplan').val()},
- success: function(data,textStatus,response) {
+ success: function(data, textStatus, response) {
var xmldoc = response.responseXML;
var provider = xmldoc.getElementsByTagName('connection')[0];
jQuery('#ppp_username').val('');
@@ -1869,7 +1870,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<form action="interfaces.php" method="post" name="iform" id="iform">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if (is_subsystem_dirty('interfaces')): ?><p>
- <?php print_info_box_np(sprintf(gettext("The %s configuration has been changed."),$wancfg['descr'])."</p><p>".gettext("You must apply the changes in order for them to take effect.")."</p><p>".gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?></p><br />
+ <?php print_info_box_np(sprintf(gettext("The %s configuration has been changed."), $wancfg['descr']) . "</p><p>" . gettext("You must apply the changes in order for them to take effect.") . "</p><p>" . gettext("Don't forget to adjust the DHCP Server range if needed after applying."));?></p><br />
<?php endif; ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces">
@@ -2039,7 +2040,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php
if (count($a_gateways) > 0) {
foreach ($a_gateways as $gateway) {
- if (($gateway['interface'] == $if) && (is_ipaddrv4($gateway['gateway']))) {
+ if (($gateway['interface'] == $if) && (is_ipaddrv4($gateway['gateway']))) {
?>
<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected=\"selected\""; ?>>
<?=htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);?>
@@ -2081,7 +2082,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
}
?>
<tr>
- <td width="45%" align="right"><font color="white"><?=gettext("Default gateway:"); ?></font></td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?> /></td>
+ <td width="45%" align="right"><font color="white"><?=gettext("Default gateway:"); ?></font></td><td><input type="checkbox" id="defaultgw" name="defaultgw"<?=$checked?> /></td>
</tr>
<tr>
<td align="right"><font color="white"><?=gettext("Gateway Name:"); ?></font></td><td><input id="name" name="name" value="<?=$wancfg['descr'] . "GW"?>" /></td>
@@ -2307,7 +2308,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
&nbsp; &nbsp; &nbsp; &nbsp;
Presets: &nbsp;
<input name="adv_dhcp_pt_values" type="radio" value="DHCP" id="customdhcpptdhcpdefaults" onclick="customdhcpptsetvalues(this, iform);" />FreeBSD Default &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="Clear" id="customdhcpptclear" onclick="customdhcpptsetvalues(this, iform);" />Clear
+ <input name="adv_dhcp_pt_values" type="radio" value="Clear" id="customdhcpptclear" onclick="customdhcpptsetvalues(this, iform);" />Clear
<br />
Reboot: <input name="adv_dhcp_pt_reboot" type="text" class="formfld unknown" id="adv_dhcp_pt_reboot" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_reboot']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
@@ -2315,8 +2316,8 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
Initial Interval: <input name="adv_dhcp_pt_initial_interval" type="text" class="formfld unknown" id="adv_dhcp_pt_initial_interval" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>" onchange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');" />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="pfSense" id="customdhcpptpfsensedefaults" onclick="customdhcpptsetvalues(this, iform);" />pfSense Default &nbsp;
- <input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked="checked" id="customdhcpptsavedcfg" onclick="customdhcpptsetvalues(this, iform);" />Saved Cfg
+ <input name="adv_dhcp_pt_values" type="radio" value="pfSense" id="customdhcpptpfsensedefaults" onclick="customdhcpptsetvalues(this, iform);" />pfSense Default &nbsp;
+ <input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked="checked" id="customdhcpptsavedcfg" onclick="customdhcpptsetvalues(this, iform);" />Saved Cfg
<br />
<?=gettext("The values in these fields are DHCP protocol timings used when requesting a lease. <br /> "); ?>
@@ -2396,7 +2397,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr style='display:none' id="show_adv_dhcp_config_file_override">
<td width="22%" valign="top" class="vncell"><?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&amp;sektion=5\">Configuration File</a> Override"); ?></td>
<td width="78%" class="vtable">
- <input name="adv_dhcp_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>" />
+ <input name="adv_dhcp_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>" />
<br />
<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br /> " .
"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
@@ -2481,7 +2482,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php if (is_readable("/var/db/dhcp6c_duid")) {
// $current_duid = file_get_contents("/var/db/dhcp6c_duid");
}
- printf(gettext("The current DUID is: '%s'"),$current_duid);
+ printf(gettext("The current DUID is: '%s'"), $current_duid);
// hexdump -e '"%07.7_ax " 1/2 "%04x" " " 14/1 "%02x:" "\n"'
?>
</td>
@@ -2506,7 +2507,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<td width="78%" class="vtable">
<select name="dhcp6-ia-pd-len" class="formselect" id="dhcp6-ia-pd-len">
<?php
- $sizes = array("none" => "None", 16 => "48", 12 => "52", 8 => "56", 4 => "60", 2 => "62", 1 => "63", 0 => "64");
+ $sizes = array("none" => "None", 16 => "48", 12 => "52", 8 => "56", 4 => "60", 3 => "61", 2 => "62", 1 => "63", 0 => "64");
foreach ($sizes as $bits => $length) {
echo "<option value=\"{$bits}\" ";
if (is_numeric($pconfig['dhcp6-ia-pd-len']) && ($bits == $pconfig['dhcp6-ia-pd-len'])) {
@@ -2568,7 +2569,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<input name="adv_dhcp6_id_assoc_statement_address_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_address_enable" value="" onclick="show_adv_dhcp6_config(this);" />
<?=gettext("Non-Temporary Address Allocation"); ?>
- <div style='display:none' id="show_adv_dhcp6_id_assoc_statement_address">
+ <div style='display:none' id="show_adv_dhcp6_id_assoc_statement_address">
<?=gettext("id-assoc na"); ?>
<?=gettext("<i>ID</i>"); ?>
<input name="adv_dhcp6_id_assoc_statement_address_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_id']);?>" />
@@ -2585,7 +2586,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<input name="adv_dhcp6_id_assoc_statement_prefix_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_prefix_enable" value="" onclick="show_adv_dhcp6_config(this)" />
<?=gettext("Prefix Delegation"); ?>
- <div style='display:none' id="show_adv_dhcp6_id_assoc_statement_prefix">
+ <div style='display:none' id="show_adv_dhcp6_id_assoc_statement_prefix">
<?=gettext("id-assoc pd"); ?>
<?=gettext("<i>ID</i>"); ?>
<input name="adv_dhcp6_id_assoc_statement_prefix_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_id']);?>" />
@@ -2654,7 +2655,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?=gettext("<a target=\"FreeBSD_DHCP\" href=\"http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+10.1-RELEASE+and+Ports\">Configuration File</a> Override"); ?>
</td>
<td width="78%" class="vtable">
- <input name="adv_dhcp6_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>" />
+ <input name="adv_dhcp6_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>" />
<br />
<?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br /> " .
"Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br />" .
@@ -2699,13 +2700,13 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
document.getElementById("show_adv_dhcp6_id_assoc_statement").style.display = advanced;
document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = 'none';
- if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked) {
+ if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked) {
document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = advanced;
}
document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = 'none';
document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = 'none';
- if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked) {
+ if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked) {
document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = advanced;
document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = advanced;
}
@@ -3035,9 +3036,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<?php else: ?>
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
<?php endif; ?>
- <input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
+ <input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= htmlspecialchars($pconfig['pppoe_resethour']); ?>" size="3" />
<?=gettext("hour (0-23)"); ?><br />
- <input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" />
+ <input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= htmlspecialchars($pconfig['pppoe_resetminute']); ?>" size="3" />
<?=gettext("minute (0-59)"); ?><br />
<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" />
<?=gettext("reset at a specific date (mm/dd/yyyy)"); ?>
@@ -3109,7 +3110,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Local IP address"); ?></td>
<td width="78%" class="vtable">
- <input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>" />
+ <input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local'][0]);?>" />
/
<select name="pptp_subnet" class="formselect" id="pptp_subnet">
<?php for ($i = 31; $i > 0; $i--): ?>
@@ -3170,7 +3171,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="top" class="vncell"><?=gettext("Persist common settings");?></td>
<td class="vtable">
- <input name="persistcommonwireless" type="checkbox" value="yes" class="formfld" id="persistcommonwireless" <?php if ($pconfig['persistcommonwireless']) echo "checked=\"checked\"";?> />
+ <input name="persistcommonwireless" type="checkbox" value="yes" class="formfld" id="persistcommonwireless" <?php if ($pconfig['persistcommonwireless']) echo "checked=\"checked\"";?> />
<br /><?=gettext("Enabling this preserves the common wireless configuration through interface deletions and reassignments.");?>
</td>
</tr>
@@ -3229,10 +3230,11 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<select name="txpower" class="formselect" id="txpower">
<?
for ($x = 99; $x > 0; $x--) {
- if ($pconfig["txpower"] == $x)
+ if ($pconfig["txpower"] == $x) {
$SELECTED = " selected=\"selected\"";
- else
+ } else {
$SELECTED = "";
+ }
echo "<option {$SELECTED}>{$x}</option>\n";
}
?>
@@ -3424,7 +3426,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="top" class="vncell"><?=gettext("802.11g only"); ?></td>
<td class="vtable">
- <input name="puremode" type="checkbox" value="11g" class="formfld" id="puremode" <?php if ($pconfig['puremode'] == '11g') echo "checked=\"checked\"";?> />
+ <input name="puremode" type="checkbox" value="11g" class="formfld" id="puremode" <?php if ($pconfig['puremode'] == '11g') echo "checked=\"checked\"";?> />
<br /><?=gettext("When operating as an access point in 802.11g mode, allow only 11g-capable stations to associate (11b-only stations are not permitted to associate)."); ?>
</td>
</tr>
@@ -3432,7 +3434,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="top" class="vncell"><?=gettext("Allow intra-BSS communication"); ?></td>
<td class="vtable">
- <input name="apbridge_enable" type="checkbox" value="yes" class="formfld" id="apbridge_enable" <?php if ($pconfig['apbridge_enable']) echo "checked=\"checked\"";?> />
+ <input name="apbridge_enable" type="checkbox" value="yes" class="formfld" id="apbridge_enable" <?php if ($pconfig['apbridge_enable']) echo "checked=\"checked\"";?> />
<br />
<?=gettext("When operating as an access point, enable this if you want to pass packets between wireless clients directly."); ?>
<br />
@@ -3574,28 +3576,28 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<tr>
<td valign="top" class="vncell"><?=gettext("Key Rotation"); ?></td>
<td class="vtable">
- <input name="wpa_group_rekey" type="text" class="formfld unknown" id="wpa_group_rekey" size="30" value="<?php echo $pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60";?>" />
+ <input name="wpa_group_rekey" type="text" class="formfld unknown" id="wpa_group_rekey" size="30" value="<?php echo htmlspecialchars($pconfig['wpa_group_rekey']) ? $pconfig['wpa_group_rekey'] : "60";?>" />
<br /><?=gettext("Specified in seconds. Allowed values are 1-9999. Must be shorter than Master Key Regeneration time."); ?>
</td>
</tr>
<tr>
<td valign="top" class="vncell"><?=gettext("Master Key Regeneration"); ?></td>
<td class="vtable">
- <input name="wpa_gmk_rekey" type="text" class="formfld" id="wpa_gmk_rekey" size="30" value="<?php echo $pconfig['wpa_gmk_rekey'] ? $pconfig['wpa_gmk_rekey'] : "3600";?>" />
+ <input name="wpa_gmk_rekey" type="text" class="formfld" id="wpa_gmk_rekey" size="30" value="<?php echo htmlspecialchars($pconfig['wpa_gmk_rekey']) ? $pconfig['wpa_gmk_rekey'] : "3600";?>" />
<br /><?=gettext("Specified in seconds. Allowed values are 1-9999. Must be longer than Key Rotation time."); ?>
</td>
</tr>
<tr>
<td valign="top" class="vncell"><?=gettext("Strict Key Regeneration"); ?></td>
<td class="vtable">
- <input name="wpa_strict_rekey" type="checkbox" value="yes" class="formfld" id="wpa_strict_rekey" <?php if ($pconfig['wpa_strict_rekey']) echo "checked=\"checked\""; ?> />
+ <input name="wpa_strict_rekey" type="checkbox" value="yes" class="formfld" id="wpa_strict_rekey" <?php if ($pconfig['wpa_strict_rekey']) echo "checked=\"checked\""; ?> />
<br /><?=gettext("Setting this option will force the AP to rekey whenever a client disassociates."); ?>
</td>
</tr>
<tr>
<td valign="top" class="vncell"><?=gettext("Enable IEEE802.1X Authentication"); ?></td>
<td class="vtable">
- <input name="ieee8021x" type="checkbox" value="yes" class="formfld" id="ieee8021x" <?php if ($pconfig['ieee8021x']) echo "checked=\"checked\"";?> />
+ <input name="ieee8021x" type="checkbox" value="yes" class="formfld" id="ieee8021x" <?php if ($pconfig['ieee8021x']) echo "checked=\"checked\"";?> />
<br /><?=gettext("Setting this option will enable 802.1X authentication."); ?>
<br /><span class="red"><strong><?=gettext("NOTE"); ?>:</strong></span> <?=gettext("this option requires checking the \"Enable WPA box\"."); ?>
</td>
@@ -3663,7 +3665,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
<input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Block private networks"); ?></strong><br />
<?=gettext("When set, this option blocks traffic from IP addresses that are reserved " .
- "for private networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as"); ?>
+ "for private networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as"); ?>
<?=gettext("well as loopback addresses (127/8)."); ?>&nbsp;&nbsp; <?=gettext("You should generally " .
"leave this option turned on, unless your WAN network lies in such " .
"a private address space, too."); ?>
@@ -3798,22 +3800,22 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
success: save_callback_v6
});
}
- function addOption(selectbox,text,value)
+ function addOption(selectbox, text, value)
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.append(optn);
- selectbox.prop('selectedIndex',selectbox.children().length-1);
+ selectbox.prop('selectedIndex', selectbox.children().length - 1);
jQuery('#notebox').html("<p><strong><?=gettext("NOTE:"); ?><\/strong> <?=gettext("You can manage Gateways"); ?> <a target='_blank' href='system_gateways.php'><?=gettext("here"); ?><\/a>.<\/p>");
}
- function addOption_v6(selectbox,text,value)
+ function addOption_v6(selectbox, text, value)
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.append(optn);
- selectbox.prop('selectedIndex',selectbox.children().length-1);
+ selectbox.prop('selectedIndex', selectbox.children().length - 1);
jQuery('#noteboxv6').html("<p><strong><?=gettext("NOTE:"); ?><\/strong> <?=gettext("You can manage Gateways"); ?> <a target='_blank' href='system_gateways.php'><?=gettext("here"); ?><\/a>.<\/p>");
}
function report_failure(request, textStatus, errorThrown) {
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index c93e32c..03fe582 100644
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -41,7 +41,7 @@
##|*MATCH=interfaces_assign.php*
##|-PRIV
-$pgtitle = array(gettext("Interfaces"),gettext("Assign network ports"));
+$pgtitle = array(gettext("Interfaces"), gettext("Assign network ports"));
$shortcut_section = "interfaces";
require("guiconfig.inc");
@@ -56,7 +56,7 @@ require_once("rrd.inc");
function interface_assign_description($portinfo, $portname) {
global $ovpn_descrs;
if ($portinfo['isvlan']) {
- $descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']);
+ $descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']);
if ($portinfo['descr']) {
$descr .= " (" . $portinfo['descr'] . ")";
}
@@ -88,7 +88,7 @@ function interface_assign_description($portinfo, $portname) {
$descr .= " (" . $portinfo['descr'] . ")";
}
} elseif ($portinfo['isqinq']) {
- $descr = $portinfo['descr'];
+ $descr = $portinfo['descr'];
} elseif (substr($portname, 0, 4) == 'ovpn') {
$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
} else {
@@ -531,7 +531,7 @@ if ($input_errors) {
<?php
foreach ($portlist as $portname => $portinfo):
?>
- <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
+ <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
<?=interface_assign_description($portinfo, $portname);?>
</option>
<?php
@@ -565,7 +565,7 @@ if ($input_errors) {
<?php
foreach ($unused_portlist as $portname => $portinfo):
?>
- <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
+ <option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
<?=interface_assign_description($portinfo, $portname);?>
</option>
<?php
diff --git a/usr/local/www/interfaces_bridge.php b/usr/local/www/interfaces_bridge.php
index 7856a2a..b7e557f 100644
--- a/usr/local/www/interfaces_bridge.php
+++ b/usr/local/www/interfaces_bridge.php
@@ -86,7 +86,7 @@ if ($_GET['act'] == "del") {
}
-$pgtitle = array(gettext("Interfaces"),gettext("Bridge"));
+$pgtitle = array(gettext("Interfaces"), gettext("Bridge"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_bridge_edit.php b/usr/local/www/interfaces_bridge_edit.php
index 59d9072..cef2493 100644
--- a/usr/local/www/interfaces_bridge_edit.php
+++ b/usr/local/www/interfaces_bridge_edit.php
@@ -89,7 +89,7 @@ if (isset($id) && $a_bridges[$id]) {
$pconfig['ifpriority'] = explode(",", $a_bridges[$id]['ifpriority']);
$ifpriority = array();
foreach ($pconfig['ifpriority'] as $cfg) {
- list ($key, $value) = explode(":", $cfg);
+ list ($key, $value) = explode(":", $cfg);
$embprioritycfg[$key] = $value;
foreach ($embprioritycfg as $key => $value) {
$ifpriority[$key] = $value;
@@ -101,7 +101,7 @@ if (isset($id) && $a_bridges[$id]) {
$pconfig['ifpathcost'] = explode(",", $a_bridges[$id]['ifpathcost']);
$ifpathcost = array();
foreach ($pconfig['ifpathcost'] as $cfg) {
- list ($key, $value) = explode(":", $cfg);
+ list ($key, $value) = explode(":", $cfg);
$embpathcfg[$key] = $value;
foreach ($embpathcfg as $key => $value) {
$ifpathcost[$key] = $value;
@@ -273,7 +273,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("Bridge"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("Bridge"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -339,7 +339,7 @@ function show_source_port_range() {
</td>
</tr>
<tr style="display:none" id="sprtable1">
- <td valign="top" class="vncell" align="center"><?=gettext("RSTP/STP"); ?> </td>
+ <td valign="top" class="vncell" align="center"><?=gettext("RSTP/STP"); ?> </td>
<td class="vtable">
<input type="checkbox" name="enablestp" id="enablestp" <?php if ($pconfig['enablestp']) echo "checked=\"checked\"";?> />
<span class="vexpl"><strong><?=gettext("Enable spanning tree options for this bridge."); ?> </strong></span>
@@ -447,8 +447,10 @@ function show_source_port_range() {
<td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
<td class="vtable" width="80%">
<table summary="priority">
- <?php foreach ($ifacelist as $ifn => $ifdescr)
- echo "<tr><td>{$ifdescr}</td><td><input size=\"5\" name=\"{$ifn}\" type=\"text\" class=\"formfld unknown\" id=\"{$ifn}\" value=\"{$ifpriority[$ifn]}\" /></td></tr>";
+ <?php
+ foreach ($ifacelist as $ifn => $ifdescr) {
+ echo "<tr><td>{$ifdescr}</td><td><input size=\"5\" name=\"{$ifn}\" type=\"text\" class=\"formfld unknown\" id=\"{$ifn}\" value=\"{$ifpriority[$ifn]}\" /></td></tr>";
+ }
?>
<tr>
<td></td>
diff --git a/usr/local/www/interfaces_gif.php b/usr/local/www/interfaces_gif.php
index 10c1548..0730090 100644
--- a/usr/local/www/interfaces_gif.php
+++ b/usr/local/www/interfaces_gif.php
@@ -80,7 +80,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("GIF"));
+$pgtitle = array(gettext("Interfaces"), gettext("GIF"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -120,7 +120,7 @@ include("head.inc");
$i = 0;
foreach ($a_gifs as $gif):
?>
- <tr ondblclick="document.location='interfaces_gif_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='interfaces_gif_edit.php?id=<?=$i;?>'">
<td class="listlr">
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']));?>
</td>
diff --git a/usr/local/www/interfaces_gif_edit.php b/usr/local/www/interfaces_gif_edit.php
index 74ba136..76a24ed 100644
--- a/usr/local/www/interfaces_gif_edit.php
+++ b/usr/local/www/interfaces_gif_edit.php
@@ -88,7 +88,7 @@ if ($_POST) {
$input_errors[] = gettext("The tunnel local and tunnel remote fields must have valid IP addresses.");
}
- $alias = strstr($_POST['if'],'|');
+ $alias = strstr($_POST['if'], '|');
if ((is_ipaddrv4($alias) && !is_ipaddrv4($_POST['remote-addr'])) ||
(is_ipaddrv6($alias) && !is_ipaddrv6($_POST['remote-addr']))) {
$input_errors[] = gettext("The alias IP address family has to match the family of the remote peer address.");
@@ -108,7 +108,7 @@ if ($_POST) {
if (!$input_errors) {
$gif = array();
- list($gif['if'], $gif['ipaddr']) = explode("|",$_POST['if']);
+ list($gif['if'], $gif['ipaddr']) = explode("|", $_POST['if']);
$gif['tunnel-local-addr'] = $_POST['tunnel-local-addr'];
$gif['tunnel-remote-addr'] = $_POST['tunnel-remote-addr'];
$gif['tunnel-remote-net'] = $_POST['tunnel-remote-net'];
@@ -141,7 +141,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("GIF"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("GIF"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_gre.php b/usr/local/www/interfaces_gre.php
index 29313d6..3431987 100644
--- a/usr/local/www/interfaces_gre.php
+++ b/usr/local/www/interfaces_gre.php
@@ -81,7 +81,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("GRE"));
+$pgtitle = array(gettext("Interfaces"), gettext("GRE"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -121,7 +121,7 @@ include("head.inc");
$i = 0;
foreach ($a_gres as $gre):
?>
- <tr ondblclick="document.location='interfaces_gre_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='interfaces_gre_edit.php?id=<?=$i;?>'">
<td class="listlr">
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gre['if']));?>
</td>
diff --git a/usr/local/www/interfaces_gre_edit.php b/usr/local/www/interfaces_gre_edit.php
index 64dea83..474e57b 100644
--- a/usr/local/www/interfaces_gre_edit.php
+++ b/usr/local/www/interfaces_gre_edit.php
@@ -77,7 +77,7 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "if tunnel-remote-addr tunnel-remote-net tunnel-local-addr");
- $reqdfieldsn = array(gettext("Parent interface"),gettext("Local address"),gettext("Remote tunnel address"),gettext("Remote tunnel network"), gettext("Local tunnel address"));
+ $reqdfieldsn = array(gettext("Parent interface"), gettext("Local address"), gettext("Remote tunnel address"), gettext("Remote tunnel network"), gettext("Local tunnel address"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -93,7 +93,7 @@ if ($_POST) {
}
if (($gre['if'] == $_POST['if']) && ($gre['tunnel-remote-addr'] == $_POST['tunnel-remote-addr'])) {
- $input_errors[] = sprintf(gettext("A GRE tunnel with the network %s is already defined."),$gre['remote-network']);
+ $input_errors[] = sprintf(gettext("A GRE tunnel with the network %s is already defined."), $gre['remote-network']);
break;
}
}
@@ -134,7 +134,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("GRE"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("GRE"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php
index defb01f..6342bcf 100644
--- a/usr/local/www/interfaces_groups.php
+++ b/usr/local/www/interfaces_groups.php
@@ -55,7 +55,7 @@ if ($_GET['act'] == "del") {
foreach ($members as $ifs) {
$realif = get_real_interface($ifs);
if ($realif) {
- mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
+ mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
}
}
unset($a_ifgroups[$_GET['id']]);
@@ -65,7 +65,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
+$pgtitle = array(gettext("Interfaces"), gettext("Groups"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php
index 916b7c1..22b8567 100644
--- a/usr/local/www/interfaces_groups_edit.php
+++ b/usr/local/www/interfaces_groups_edit.php
@@ -44,7 +44,7 @@
require("guiconfig.inc");
require_once("functions.inc");
-$pgtitle = array(gettext("Interfaces"),gettext("Groups"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("Groups"), gettext("Edit"));
$shortcut_section = "interfaces";
if (!is_array($config['ifgroups']['ifgroupentry'])) {
@@ -93,7 +93,7 @@ if ($_POST) {
$members = "";
$isfirst = 0;
/* item is a normal ifgroupentry type */
- for ($x=0; $x<9999; $x++) {
+ for ($x = 0; $x < 9999; $x++) {
if ($_POST["members{$x}"] <> "") {
if ($isfirst > 0) {
$members .= " ";
@@ -318,10 +318,11 @@ function removeRow(el) {
}
if ($found === false) {
- foreach ($iflist_disabled as $ifnam => $ifdescr)
+ foreach ($iflist_disabled as $ifnam => $ifdescr) {
if ($ifnam == $members) {
echo "<option value=\"{$ifnam}\" selected=\"selected\">{$ifdescr}</option>";
}
+ }
}
?>
</select>
diff --git a/usr/local/www/interfaces_lagg.php b/usr/local/www/interfaces_lagg.php
index 60870c3..32b2a21 100644
--- a/usr/local/www/interfaces_lagg.php
+++ b/usr/local/www/interfaces_lagg.php
@@ -87,7 +87,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("LAGG"));
+$pgtitle = array(gettext("Interfaces"), gettext("LAGG"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -127,7 +127,7 @@ include("head.inc");
$i = 0;
foreach ($a_laggs as $lagg):
?>
- <tr ondblclick="document.location='interfaces_lagg_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='interfaces_lagg_edit.php?id=<?=$i;?>'">
<td class="listlr">
<?=htmlspecialchars(strtoupper($lagg['laggif']));?>
</td>
diff --git a/usr/local/www/interfaces_lagg_edit.php b/usr/local/www/interfaces_lagg_edit.php
index cfd24d4..c7894a6 100644
--- a/usr/local/www/interfaces_lagg_edit.php
+++ b/usr/local/www/interfaces_lagg_edit.php
@@ -146,7 +146,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("LAGG"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("LAGG"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_ppps.php b/usr/local/www/interfaces_ppps.php
index fb44fc9..85b5181 100644
--- a/usr/local/www/interfaces_ppps.php
+++ b/usr/local/www/interfaces_ppps.php
@@ -119,7 +119,7 @@ include("head.inc");
$i = 0;
foreach ($a_ppps as $id => $ppp):
?>
- <tr ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
<td class="listr">
<?=htmlspecialchars($ppp['if']);?>
</td>
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php
index 69e2959..035f915 100644
--- a/usr/local/www/interfaces_ppps_edit.php
+++ b/usr/local/www/interfaces_ppps_edit.php
@@ -89,10 +89,10 @@ if (isset($id) && $a_ppps[$id]) {
$pconfig['idletimeout'] = $a_ppps[$id]['idletimeout'];
$pconfig['uptime'] = $a_ppps[$id]['uptime'];
$pconfig['descr'] = $a_ppps[$id]['descr'];
- $pconfig['bandwidth'] = explode(",",$a_ppps[$id]['bandwidth']);
- $pconfig['mtu'] = explode(",",$a_ppps[$id]['mtu']);
- $pconfig['mru'] = explode(",",$a_ppps[$id]['mru']);
- $pconfig['mrru'] = explode(",",$a_ppps[$id]['mrru']);
+ $pconfig['bandwidth'] = explode(",", $a_ppps[$id]['bandwidth']);
+ $pconfig['mtu'] = explode(",", $a_ppps[$id]['mtu']);
+ $pconfig['mru'] = explode(",", $a_ppps[$id]['mru']);
+ $pconfig['mrru'] = explode(",", $a_ppps[$id]['mrru']);
if (isset($a_ppps[$id]['shortseq'])) {
$pconfig['shortseq'] = true;
}
@@ -117,14 +117,14 @@ if (isset($id) && $a_ppps[$id]) {
$pconfig['apnum'] = $a_ppps[$id]['apnum'];
$pconfig['phone'] = $a_ppps[$id]['phone'];
$pconfig['connect-timeout'] = $a_ppps[$id]['connect-timeout'];
- $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
- $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
+ $pconfig['localip'] = explode(",", $a_ppps[$id]['localip']);
+ $pconfig['gateway'] = explode(",", $a_ppps[$id]['gateway']);
break;
case "l2tp":
case "pptp":
- $pconfig['localip'] = explode(",",$a_ppps[$id]['localip']);
- $pconfig['subnet'] = explode(",",$a_ppps[$id]['subnet']);
- $pconfig['gateway'] = explode(",",$a_ppps[$id]['gateway']);
+ $pconfig['localip'] = explode(",", $a_ppps[$id]['localip']);
+ $pconfig['subnet'] = explode(",", $a_ppps[$id]['subnet']);
+ $pconfig['gateway'] = explode(",", $a_ppps[$id]['gateway']);
case "pppoe":
$pconfig['provider'] = $a_ppps[$id]['provider'];
if (isset($a_ppps[$id]['provider']) and empty($a_ppps[$id]['provider'])) {
@@ -202,16 +202,16 @@ if ($_POST) {
switch ($_POST['type']) {
case "ppp":
$reqdfields = explode(" ", "interfaces phone");
- $reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Phone Number"));
+ $reqdfieldsn = array(gettext("Link Interface(s)"), gettext("Phone Number"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
case "pppoe":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username passwordfld ondemand idletimeout");
- $reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Dial on demand"),gettext("Idle timeout value"));
+ $reqdfieldsn = array(gettext("Link Interface(s)"), gettext("Username"), gettext("Password"), gettext("Dial on demand"), gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "interfaces username passwordfld");
- $reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"));
+ $reqdfieldsn = array(gettext("Link Interface(s)"), gettext("Username"), gettext("Password"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
@@ -219,10 +219,10 @@ if ($_POST) {
case "pptp":
if ($_POST['ondemand']) {
$reqdfields = explode(" ", "interfaces username passwordfld localip subnet gateway ondemand idletimeout");
- $reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
+ $reqdfieldsn = array(gettext("Link Interface(s)"), gettext("Username"), gettext("Password"), gettext("Local IP address"), gettext("Subnet"), gettext("Remote IP address"), gettext("Dial on demand"), gettext("Idle timeout value"));
} else {
$reqdfields = explode(" ", "interfaces username passwordfld localip subnet gateway");
- $reqdfieldsn = array(gettext("Link Interface(s)"),gettext("Username"),gettext("Password"),gettext("Local IP address"),gettext("Subnet"),gettext("Remote IP address"));
+ $reqdfieldsn = array(gettext("Link Interface(s)"), gettext("Username"), gettext("Password"), gettext("Local IP address"), gettext("Subnet"), gettext("Remote IP address"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
break;
@@ -254,7 +254,7 @@ if ($_POST) {
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
}
if ($_POST['pppoe-reset-type'] == "custom" && $_POST['pppoe_resetdate'] <> "" && is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
- $date_nums = explode("/",$_POST['pppoe_resetdate']);
+ $date_nums = explode("/", $_POST['pppoe_resetdate']);
if ($date_nums[0] < 1 || $date_nums[0] > 12) {
$input_errors[] = gettext("A valid PPPoE reset month must be specified (1-12) in the Custom PPPoE Periodic reset fields.");
}
@@ -268,19 +268,19 @@ if ($_POST) {
foreach ($_POST['interfaces'] as $iface) {
if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) {
- $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface);
+ $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."), $iface);
}
if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) {
- $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface);
+ $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."), $iface);
}
if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) {
- $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface);
+ $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."), $iface);
}
if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) {
- $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface);
+ $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface);
}
if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) {
- $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface);
+ $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface);
}
}
@@ -302,7 +302,7 @@ if ($_POST) {
$ppp['ptpid'] = $_POST['ptpid'];
$ppp['type'] = $_POST['type'];
$ppp['if'] = $ppp['type'].$ppp['ptpid'];
- $ppp['ports'] = implode(',',$_POST['interfaces']);
+ $ppp['ports'] = implode(',', $_POST['interfaces']);
$ppp['username'] = $_POST['username'];
$ppp['password'] = base64_encode($_POST['passwordfld']);
$ppp['ondemand'] = $_POST['ondemand'] ? true : false;
@@ -351,8 +351,8 @@ if ($_POST) {
unset($ppp['apnum']);
}
$ppp['phone'] = $_POST['phone'];
- $ppp['localip'] = implode(',',$port_data['localip']);
- $ppp['gateway'] = implode(',',$port_data['gateway']);
+ $ppp['localip'] = implode(',', $port_data['localip']);
+ $ppp['gateway'] = implode(',', $port_data['gateway']);
if (!empty($_POST['connect-timeout'])) {
$ppp['connect-timeout'] = $_POST['connect-timeout'];
} else {
@@ -375,9 +375,9 @@ if ($_POST) {
break;
case "pptp":
case "l2tp":
- $ppp['localip'] = implode(',',$port_data['localip']);
- $ppp['subnet'] = implode(',',$port_data['subnet']);
- $ppp['gateway'] = implode(',',$port_data['gateway']);
+ $ppp['localip'] = implode(',', $port_data['localip']);
+ $ppp['subnet'] = implode(',', $port_data['subnet']);
+ $ppp['gateway'] = implode(',', $port_data['gateway']);
break;
default:
break;
@@ -425,11 +425,11 @@ if ($_POST) {
} // end if ($_POST)
$closehead = false;
-$pgtitle = array(gettext("Interfaces"),gettext("PPPs"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("PPPs"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
-$types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "L2TP"/*, "tcp" => "TCP", "udp" => "UDP"*/);
+$types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE", "pptp" => "PPTP", "l2tp" => "L2TP"/*, "tcp" => "TCP", "udp" => "UDP"*/);
?>
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
@@ -479,7 +479,7 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
<tr style="display:none" name="portlists" id="portlists">
<td id="serialports">
<?php
- $selected_ports = explode(',',$pconfig['interfaces']);
+ $selected_ports = explode(',', $pconfig['interfaces']);
if (!is_dir("/var/spool/lock")) {
mwexec("/bin/mkdir -p /var/spool/lock");
}
@@ -488,7 +488,7 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
$serport_count = 0;
foreach ($serialports as $port) {
$serport_count++;
- echo $port.",".trim($port);
+ echo $port . "," . trim($port);
if (in_array($port, $selected_ports)) {
echo ",1|";
} else {
@@ -538,7 +538,7 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
</tr>
<tr style="display:none" name="select" id="select"><td style="display:none"></td></tr>
<?php
- $k=0;
+ $k = 0;
?>
<tr style="display:none" name="ppp_provider" id="ppp_provider">
<td width="22%" valign="top" class="vncell">
@@ -685,9 +685,9 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
<?php else: ?>
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
<?php endif; ?>
- <input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
+ <input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= htmlspecialchars($pconfig['pppoe_resethour']); ?>" size="3" />
<?= gettext("hour (0-23)"); ?><br />
- <input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" />
+ <input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= htmlspecialchars($pconfig['pppoe_resetminute']); ?>" size="3" />
<?= gettext("minute (0-59)"); ?><br />
<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" />
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
@@ -722,13 +722,13 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
</tr>
<?php
- for ($j=0; $j < $port_count; $j++) :
+ for ($j = 0; $j < $port_count; $j++) :
?>
<tr style="display:none" id="gw_fields<?=$j;?>">
<td width="22%" id="localiplabel<?=$j;?>" valign="top" class="vncell"><?= gettext("Local IP"); ?></td>
<td width="78%" class="vtable">
- <input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>" />
+ <input name="localip[]" type="text" class="formfld unknown" id="localip<?=$j;?>" size="20" value="<?=htmlspecialchars($pconfig['localip'][$j]);?>" />
/
<select name="subnet[]" class="formselect" id="subnet<?=$j;?>" disabled="disabled">
<?php for ($i = 31; $i > 0; $i--): ?>
@@ -828,7 +828,7 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
<td style="display:none" id="adv_show" name="adv_show">0</td>
</tr>
<?php
- for ($i=0; $i < $port_count; $i++) :
+ for ($i = 0; $i < $port_count; $i++) :
?>
<tr style="display:none" id="link<?=$i;?>">
<td width="22%" valign="top" id="linklabel<?=$i;?>" class="vncell"> <?=gettext("Link Parameters");?></td>
diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php
index 9be532c..f088862 100644
--- a/usr/local/www/interfaces_qinq.php
+++ b/usr/local/www/interfaces_qinq.php
@@ -90,7 +90,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("QinQ"));
+$pgtitle = array(gettext("Interfaces"), gettext("QinQ"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -131,7 +131,7 @@ include("head.inc");
$i = 0;
foreach ($a_qinqs as $qinq):
?>
- <tr ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
<td class="listlr">
<?=htmlspecialchars($qinq['if']);?>
</td>
diff --git a/usr/local/www/interfaces_qinq_edit.php b/usr/local/www/interfaces_qinq_edit.php
index 4efe42b..93048a9 100644
--- a/usr/local/www/interfaces_qinq_edit.php
+++ b/usr/local/www/interfaces_qinq_edit.php
@@ -39,7 +39,7 @@
##|*MATCH=interfaces_qinq_edit.php*
##|-PRIV
-$pgtitle = array(gettext("Interfaces"),gettext("QinQ"), gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("QinQ"), gettext("Edit"));
$shortcut_section = "interfaces";
require("guiconfig.inc");
@@ -134,11 +134,11 @@ if ($_POST) {
$members = "";
$isfirst = 0;
/* item is a normal qinqentry type */
- for ($x=0; $x<9999; $x++) {
+ for ($x = 0; $x < 9999; $x++) {
if ($_POST["members{$x}"] <> "") {
$member = explode("-", $_POST["members{$x}"]);
if (count($member) > 1) {
- if (preg_match("/([^0-9])+/", $member[0], $match) ||
+ if (preg_match("/([^0-9])+/", $member[0], $match) ||
preg_match("/([^0-9])+/", $member[1], $match)) {
$input_errors[] = gettext("Tags can contain only numbers or a range in format #-#.");
}
@@ -398,7 +398,7 @@ function removeRow(el) {
?>
<tr>
<td class="vtable">
- <input name="members<?php echo $counter; ?>" class="formselect" id="members<?php echo $counter; ?>" value="<?php echo $member;?>" />
+ <input name="members<?php echo $counter; ?>" class="formselect" id="members<?php echo $counter; ?>" value="<?php echo htmlspecialchars($member);?>" />
</td>
<td>
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="remove" /></a>
diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php
index a3f481e..20453b4 100644
--- a/usr/local/www/interfaces_vlan.php
+++ b/usr/local/www/interfaces_vlan.php
@@ -84,7 +84,7 @@ if ($_GET['act'] == "del") {
}
-$pgtitle = array(gettext("Interfaces"),gettext("VLAN"));
+$pgtitle = array(gettext("Interfaces"), gettext("VLAN"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -151,7 +151,7 @@ include("head.inc");
<span class="red"><strong>
<?=gettext("Note:");?><br />
</strong></span>
- <?php printf(gettext("Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the %s handbook for information on supported cards."),$g['product_name']);?> </p>
+ <?php printf(gettext("Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the %s handbook for information on supported cards."), $g['product_name']);?> </p>
</td>
<td class="list">&nbsp;</td>
</tr>
diff --git a/usr/local/www/interfaces_vlan_edit.php b/usr/local/www/interfaces_vlan_edit.php
index eeb3c47..05940ad 100644
--- a/usr/local/www/interfaces_vlan_edit.php
+++ b/usr/local/www/interfaces_vlan_edit.php
@@ -80,7 +80,7 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "if tag");
- $reqdfieldsn = array(gettext("Parent interface"),gettext("VLAN tag"));
+ $reqdfieldsn = array(gettext("Parent interface"), gettext("VLAN tag"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -105,7 +105,7 @@ if ($_POST) {
}
if (($vlan['if'] == $_POST['if']) && ($vlan['tag'] == $_POST['tag'])) {
- $input_errors[] = sprintf(gettext("A VLAN with the tag %s is already defined on this interface."),$vlan['tag']);
+ $input_errors[] = sprintf(gettext("A VLAN with the tag %s is already defined on this interface."), $vlan['tag']);
break;
}
}
@@ -161,7 +161,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("VLAN"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("VLAN"), gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
diff --git a/usr/local/www/interfaces_wireless.php b/usr/local/www/interfaces_wireless.php
index a1fd5fe..86fc077 100644
--- a/usr/local/www/interfaces_wireless.php
+++ b/usr/local/www/interfaces_wireless.php
@@ -79,7 +79,7 @@ if ($_GET['act'] == "del") {
}
-$pgtitle = array(gettext("Interfaces"),gettext("Wireless"));
+$pgtitle = array(gettext("Interfaces"), gettext("Wireless"));
$shortcut_section = "wireless";
include("head.inc");
diff --git a/usr/local/www/interfaces_wireless_edit.php b/usr/local/www/interfaces_wireless_edit.php
index cceca00..ab206f0 100644
--- a/usr/local/www/interfaces_wireless_edit.php
+++ b/usr/local/www/interfaces_wireless_edit.php
@@ -92,7 +92,7 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "if mode");
- $reqdfieldsn = array(gettext("Parent interface"),gettext("Mode"));
+ $reqdfieldsn = array(gettext("Parent interface"), gettext("Mode"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -156,7 +156,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"),gettext("Wireless"),gettext("Edit"));
+$pgtitle = array(gettext("Interfaces"), gettext("Wireless"), gettext("Edit"));
include("head.inc");
?>
diff --git a/usr/local/www/license.php b/usr/local/www/license.php
index a93901d..2247d6a 100644
--- a/usr/local/www/license.php
+++ b/usr/local/www/license.php
@@ -74,7 +74,7 @@ include("head.inc");
<?=gettext("POSSIBILITY OF SUCH DAMAGE");?></strong>.</p>
<hr size="1">
<p><?= "{$g['product_name']} " . gettext("is based upon/includes various free software packages, listed below.");?><br />
- <?php printf(gettext("The authors of %s would like to thank the authors of these software packages for their efforts"),$g['product_name']);?>.</p>
+ <?php printf(gettext("The authors of %s would like to thank the authors of these software packages for their efforts"), $g['product_name']);?>.</p>
<p>FreeBSD (<a href="http://www.freebsd.org" target="_blank">http://www.freebsd.org</a>)<br />
<?=gettext("Copyright");?> &copy;<?=gettext("1992-2015 The FreeBSD Project. All rights reserved");?>.<br />
<br />
diff --git a/usr/local/www/load_balancer_monitor.php b/usr/local/www/load_balancer_monitor.php
index 3fdf0d5..87884e5 100644
--- a/usr/local/www/load_balancer_monitor.php
+++ b/usr/local/www/load_balancer_monitor.php
@@ -86,7 +86,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Monitor"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Monitor"));
$shortcut_section = "relayd";
include("head.inc");
@@ -119,9 +119,9 @@ include("head.inc");
$t = new MainTable();
$t->edit_uri('load_balancer_monitor_edit.php');
$t->my_uri('load_balancer_monitor.php');
- $t->add_column(gettext('Name'),'name',20);
- $t->add_column(gettext('Type'),'type',10);
- $t->add_column(gettext('Description'),'descr',30);
+ $t->add_column(gettext('Name'), 'name', 20);
+ $t->add_column(gettext('Type'), 'type', 10);
+ $t->add_column(gettext('Description'), 'descr', 30);
$t->add_button('edit');
$t->add_button('dup');
$t->add_button('del');
diff --git a/usr/local/www/load_balancer_monitor_edit.php b/usr/local/www/load_balancer_monitor_edit.php
index b8806e1..45a5dab 100644
--- a/usr/local/www/load_balancer_monitor_edit.php
+++ b/usr/local/www/load_balancer_monitor_edit.php
@@ -81,7 +81,7 @@ if ($_POST) {
foreach ($_POST as $key => $val) {
if (stristr($key, 'options') !== false) {
if (stristr($key, $pconfig['type'].'_') !== false) {
- $opt = explode('_',$key);
+ $opt = explode('_', $key);
$pconfig['options'][$opt[2]] = $val;
}
unset($pconfig[$key]);
@@ -90,12 +90,12 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "name type descr");
- $reqdfieldsn = array(gettext("Name"),gettext("Type"),gettext("Description"));
+ $reqdfieldsn = array(gettext("Name"), gettext("Type"), gettext("Description"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* Ensure that our monitor names are unique */
- for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
+ for ($i = 0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
if (($_POST['name'] == $config['load_balancer']['monitor_type'][$i]['name']) && ($i != $id)) {
$input_errors[] = gettext("This monitor name has already been used. Monitor names must be unique.");
}
@@ -206,7 +206,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Monitor"),gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Monitor"), gettext("Edit"));
$shortcut_section = "relayd";
include("head.inc");
@@ -292,13 +292,13 @@ function updateType(t) {
</td>
</tr>
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td>
<td class="vtable" colspan="2">
<input name="http_options_host" type="text" <?if (isset($pconfig['options']['host'])) echo "value=\"" . htmlspecialchars($pconfig['options']['host']) . "\"";?> size="64" /><br /><?=gettext("Hostname for Host: header if needed."); ?>
</td>
</tr>
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td>
<td class="vtable" colspan="2">
<?= print_rfc2616_select("http_options_code", $pconfig['options']['code']); ?>
</td>
@@ -319,19 +319,19 @@ function updateType(t) {
<td width="78%" class="vtable" colspan="2">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="https">
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("Path"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("Path"); ?></td>
<td class="vtable" colspan="2">
<input name="https_options_path" type="text" <?if (isset($pconfig['options']['path'])) echo "value=\"" . htmlspecialchars($pconfig['options']['path']) ."\"";?> size="64" />
</td>
</tr>
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td>
<td class="vtable" colspan="2">
<input name="https_options_host" type="text" <?if (isset($pconfig['options']['host'])) echo "value=\"" . htmlspecialchars($pconfig['options']['host']) . "\"";?> size="64" /><br /><?=gettext("Hostname for Host: header if needed."); ?>
</td>
</tr>
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td>
<td class="vtable" colspan="2">
<?= print_rfc2616_select("https_options_code", $pconfig['options']['code']); ?>
</td>
@@ -353,13 +353,13 @@ function updateType(t) {
<td width="78%" class="vtable" colspan="2">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="send expect">
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("Send string"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("Send string"); ?></td>
<td class="vtable" colspan="2">
<input name="send_options_send" type="text" <?if (isset($pconfig['options']['send'])) echo "value=\"" . htmlspecialchars($pconfig['options']['send']) . "\"";?> size="64" />
</td>
</tr>
<tr align="left">
- <td valign="top" align="right" class="vtable"><?=gettext("Expect string"); ?></td>
+ <td valign="top" align="right" class="vtable"><?=gettext("Expect string"); ?></td>
<td class="vtable" colspan="2">
<input name="send_options_expect" type="text" <?if (isset($pconfig['options']['expect'])) echo "value=\"" . htmlspecialchars($pconfig['options']['expect']) . "\"";?> size="64" />
</td>
diff --git a/usr/local/www/load_balancer_pool.php b/usr/local/www/load_balancer_pool.php
index a2e8c54..47f3a89 100644
--- a/usr/local/www/load_balancer_pool.php
+++ b/usr/local/www/load_balancer_pool.php
@@ -95,7 +95,7 @@ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
$a_pool[$i]['monitor'] = "<a href=\"/load_balancer_monitor_edit.php?id={$mondex[$a_pool[$i]['monitor']]}\">" . htmlspecialchars($a_pool[$i]['monitor']) . "</a>";
}
-$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Pool"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Pool"));
$shortcut_section = "relayd";
include("head.inc");
@@ -128,12 +128,12 @@ include("head.inc");
$t = new MainTable();
$t->edit_uri('load_balancer_pool_edit.php');
$t->my_uri('load_balancer_pool.php');
- $t->add_column(gettext('Name'),'name',10);
- $t->add_column(gettext('Mode'),'mode',10);
- $t->add_column(gettext('Servers'),'servers',15);
- $t->add_column(gettext('Port'),'port',10);
- $t->add_column(gettext('Monitor'),'monitor',10);
- $t->add_column(gettext('Description'),'descr',25);
+ $t->add_column(gettext('Name'), 'name', 10);
+ $t->add_column(gettext('Mode'), 'mode', 10);
+ $t->add_column(gettext('Servers'), 'servers', 15);
+ $t->add_column(gettext('Port'), 'port', 10);
+ $t->add_column(gettext('Monitor'), 'monitor', 10);
+ $t->add_column(gettext('Description'), 'descr', 25);
$t->add_button('edit');
$t->add_button('dup');
$t->add_button('del');
diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php
index ec90aee..91aef71 100644
--- a/usr/local/www/load_balancer_pool_edit.php
+++ b/usr/local/www/load_balancer_pool_edit.php
@@ -80,12 +80,12 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "name mode port monitor servers");
- $reqdfieldsn = array(gettext("Name"),gettext("Mode"),gettext("Port"),gettext("Monitor"),gettext("Server List"));
+ $reqdfieldsn = array(gettext("Name"), gettext("Mode"), gettext("Port"), gettext("Monitor"), gettext("Server List"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* Ensure that our pool names are unique */
- for ($i=0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
+ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
if (($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name']) && ($i != $id)) {
$input_errors[] = gettext("This pool name has already been used. Pool names must be unique.");
}
@@ -135,7 +135,7 @@ if ($_POST) {
}
}
$m = array();
- for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
+ for ($i = 0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
$m[$config['load_balancer']['monitor_type'][$i]['name']] = $config['load_balancer']['monitor_type'][$i];
}
@@ -184,7 +184,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Pool"),gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Pool"), gettext("Edit"));
$shortcut_section = "relayd";
include("head.inc");
@@ -196,7 +196,7 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
function clearcombo() {
- for (var i=document.iform.serversSelect.options.length-1; i>=0; i--) {
+ for (var i = document.iform.serversSelect.options.length - 1; i >= 0; i--) {
document.iform.serversSelect.options[i] = null;
}
document.iform.serversSelect.selectedIndex = -1;
@@ -225,7 +225,7 @@ function clearcombo() {
<td width="78%" class="vtable" colspan="2">
<select id="mode" name="mode" onchange="enforceFailover(); checkPoolControls();">
<option value="loadbalance" <?if (!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "selected=\"selected\"";?>><?=gettext("Load Balance");?></option>
- <option value="failover" <?if ($pconfig['mode'] == "failover") echo "selected=\"selected\"";?>><?=gettext("Manual Failover");?></option>
+ <option value="failover" <?if ($pconfig['mode'] == "failover") echo "selected=\"selected\"";?>><?=gettext("Manual Failover");?></option>
</select>
</td>
</tr>
@@ -239,7 +239,7 @@ function clearcombo() {
<tr align="left">
<td width="22%" valign="top" id="monitorport_text" class="vncellreq"><?=gettext("Port"); ?></td>
<td width="78%" class="vtable" colspan="2">
- <input class="formfldalias" id="port" name="port" type="text" <?if (isset($pconfig['port'])) echo "value=\"{$pconfig['port']}\"";?> size="16" maxlength="16" /><br />
+ <input class="formfldalias" id="port" name="port" type="text" <?if (isset($pconfig['port'])) echo "value=\"" . htmlspecialchars($pconfig['port']) . "\"";?> size="16" maxlength="16" /><br />
<div id="monitorport_desc">
<?=gettext("This is the port your servers are listening on."); ?><br />
<?=gettext("You may also specify a port alias listed in Firewall -&gt; Aliases here."); ?>
@@ -255,7 +255,7 @@ function clearcombo() {
<tr align="left">
<td width="22%" valign="top" id="retry_text" class="vncell"><?=gettext("Retry"); ?></td>
<td width="78%" class="vtable" colspan="2">
- <input name="retry" type="text" <?if (isset($pconfig['retry'])) echo "value=\"{$pconfig['retry']}\"";?> size="16" maxlength="16" /><br />
+ <input name="retry" type="text" <?if (isset($pconfig['retry'])) echo "value=\"" . htmlspecialchars($pconfig['retry']) . "\"";?> size="16" maxlength="16" /><br />
<div id="retry_desc"><?=gettext("Optionally specify how many times to retry checking a server before declaring it down."); ?></div>
</td>
</tr>
diff --git a/usr/local/www/load_balancer_setting.php b/usr/local/www/load_balancer_setting.php
index e48e38e..d82f341 100644
--- a/usr/local/www/load_balancer_setting.php
+++ b/usr/local/www/load_balancer_setting.php
@@ -79,7 +79,7 @@ if ($_POST) {
if (!is_numeric($_POST['prefork'])) {
$input_errors[] = gettext("Prefork must be a numeric value");
} else {
- if (($_POST['prefork']<=0) || ($_POST['prefork']>32)) {
+ if (($_POST['prefork'] <= 0) || ($_POST['prefork'] > 32)) {
$input_errors[] = gettext("Prefork value must be between 1 and 32");
}
}
@@ -97,7 +97,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Settings"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Settings"));
$shortcut_section = "relayd";
include("head.inc");
diff --git a/usr/local/www/load_balancer_virtual_server.php b/usr/local/www/load_balancer_virtual_server.php
index e68c32c..dec55f1 100644
--- a/usr/local/www/load_balancer_virtual_server.php
+++ b/usr/local/www/load_balancer_virtual_server.php
@@ -96,7 +96,7 @@ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
}
}
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Virtual Servers"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Virtual Servers"));
$shortcut_section = "relayd-virtualservers";
include("head.inc");
@@ -129,13 +129,13 @@ include("head.inc");
$t = new MainTable();
$t->edit_uri('load_balancer_virtual_server_edit.php');
$t->my_uri('load_balancer_virtual_server.php');
- $t->add_column(gettext('Name'),'name',10);
- $t->add_column(gettext('Protocol'),'relay_protocol',10);
- $t->add_column(gettext('IP Address'),'ipaddr',15);
- $t->add_column(gettext('Port'),'port',10);
- $t->add_column(gettext('Pool'),'poolname',15);
- $t->add_column(gettext('Fall Back Pool'),'sitedown',15);
- $t->add_column(gettext('Description'),'descr',30);
+ $t->add_column(gettext('Name'), 'name', 10);
+ $t->add_column(gettext('Protocol'), 'relay_protocol', 10);
+ $t->add_column(gettext('IP Address'), 'ipaddr', 15);
+ $t->add_column(gettext('Port'), 'port', 10);
+ $t->add_column(gettext('Pool'), 'poolname', 15);
+ $t->add_column(gettext('Fall Back Pool'), 'sitedown', 15);
+ $t->add_column(gettext('Description'), 'descr', 30);
$t->add_button('edit');
$t->add_button('dup');
$t->add_button('del');
diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php
index a6cea52..5326b99 100644
--- a/usr/local/www/load_balancer_virtual_server_edit.php
+++ b/usr/local/www/load_balancer_virtual_server_edit.php
@@ -75,19 +75,19 @@ if ($_POST) {
switch ($pconfig['mode']) {
case "redirect": {
$reqdfields = explode(" ", "ipaddr name mode");
- $reqdfieldsn = array(gettext("IP Address"),gettext("Name"),gettext("Mode"));
+ $reqdfieldsn = array(gettext("IP Address"), gettext("Name"), gettext("Mode"));
break;
}
case "relay": {
$reqdfields = explode(" ", "ipaddr name mode relay_protocol");
- $reqdfieldsn = array(gettext("IP Address"),gettext("Name"),gettext("Relay Protocol"));
+ $reqdfieldsn = array(gettext("IP Address"), gettext("Name"), gettext("Relay Protocol"));
break;
}
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
- for ($i=0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
+ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
if (($_POST['name'] == $config['load_balancer']['virtual_server'][$i]['name']) && ($i != $id)) {
$input_errors[] = gettext("This virtual server name has already been used. Virtual server names must be unique.");
}
@@ -160,7 +160,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Virtual Server"),gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Virtual Server"), gettext("Edit"));
$shortcut_section = "relayd-virtualservers";
include("head.inc");
diff --git a/usr/local/www/pkg.php b/usr/local/www/pkg.php
index 9b0ae61..c56ece5 100755
--- a/usr/local/www/pkg.php
+++ b/usr/local/www/pkg.php
@@ -181,7 +181,7 @@ include("head.inc");
cursor: 'move',
distance: 10,
opacity: 0.8,
- helper: function(e,ui) {
+ helper: function(e, ui) {
ui.children().each(function() {
jQuery(this).width(jQuery(this).width());
});
@@ -190,8 +190,8 @@ include("head.inc");
});
});
function save_changes_to_xml(xml) {
- var ids=jQuery('#mainarea table tbody').sortable('serialize',{key:"ids[]"});
- var strloading="<img src='/themes/<?= $g['theme']; ?>/images/misc/loader.gif' alt='loader' /> " + "<?=gettext('Saving changes...');?>";
+ var ids=jQuery('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
+ var strloading="<img src='/themes/<?= $g['theme']; ?>/images/misc/loader.gif' alt='loader' /> " + "<?=gettext('Saving changes...');?>";
if (confirm("<?=gettext("Do you really want to save changes?");?>")) {
jQuery.ajax({
type: 'get',
@@ -332,7 +332,7 @@ include("head.inc");
<tr>
<?php
if ($display_maximum_rows) {
- $totalpages = ceil(round((count($evaledvar) / $display_maximum_rows),9));
+ $totalpages = ceil(round((count($evaledvar) / $display_maximum_rows), 9));
$page = 1;
$tmpcount = 0;
$tmppp = 0;
@@ -354,7 +354,7 @@ include("head.inc");
echo "<tr>";
echo "<td align='left'>Displaying page $page of $totalpages</b></td>";
echo "<td align='right'>Rows per page: <select onchange='document.pkgform.submit();' name='display_maximum_rows'>";
- for ($x=0; $x<250; $x++) {
+ for ($x = 0; $x < 250; $x++) {
if ($x == $display_maximum_rows) {
$SELECTED = "selected=\"selected\"";
} else {
@@ -378,8 +378,8 @@ include("head.inc");
</tr>
<?php
$i = 0;
- $pagination_startingrow=0;
- $pagination_counter=0;
+ $pagination_startingrow = 0;
+ $pagination_counter = 0;
if ($evaledvar) {
foreach ($evaledvar as $ip) {
if ($startdisplayingat) {
@@ -453,11 +453,11 @@ include("head.inc");
echo gettext("Yes");
}
} else if ($column['type'] == "interface") {
- echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
+ echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
} else {
#Check if columnitem has an encoding field declared
if ($column['encoding'] == "base64") {
- echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
+ echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
#Check if there is a custom info to show when $fieldname is not empty
} else if ($column['listmodeon'] && $fieldname != "") {
echo $column['prefix'] . gettext($column['listmodeon']). $column['suffix'];
@@ -499,29 +499,29 @@ include("head.inc");
$colcount = count($pkg['adddeleteeditpagefields']['columnitem']);
$final_footer = "";
$final_footer .= "<tr><td colspan='$colcount'>";
- $final_footer .= "<table width='100%' summary=''><tr>";
- $final_footer .= "<td align='left'>";
+ $final_footer .= "<table width='100%' summary=''><tr>";
+ $final_footer .= "<td align='left'>";
$startingat = $startdisplayingat - $display_maximum_rows;
if ($startingat > -1) {
- $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat={$startingat}&amp;display_maximum_rows={$display_maximum_rows}'>";
+ $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat={$startingat}&amp;display_maximum_rows={$display_maximum_rows}'>";
} else if ($startdisplayingat > 1) {
- $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=0&amp;display_maximum_rows={$display_maximum_rows}'>";
+ $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=0&amp;display_maximum_rows={$display_maximum_rows}'>";
}
- $final_footer .= "<font size='2'><< Previous page</font></a>";
+ $final_footer .= "<font size='2'><< Previous page</font></a>";
if ($tmppp + $display_maximum_rows > count($evaledvar)) {
$endingrecord = count($evaledvar);
} else {
$endingrecord = $tmppp + $display_maximum_rows;
}
- $final_footer .= "</td><td align='center'>";
+ $final_footer .= "</td><td align='center'>";
$tmppp++;
- $final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
- $final_footer .= "</font></td><td align='right'>&nbsp;";
+ $final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
+ $final_footer .= "</font></td><td align='right'>&nbsp;";
if (($i+1) < count($evaledvar)) {
- $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&amp;display_maximum_rows={$display_maximum_rows}'>";
+ $final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&amp;display_maximum_rows={$display_maximum_rows}'>";
}
- $final_footer .= "<font size='2'>Next page >></font></a>";
- $final_footer .= "</td></tr></table></td></tr>";
+ $final_footer .= "<font size='2'>Next page >></font></a>";
+ $final_footer .= "</td></tr></table></td></tr>";
$i = count($evaledvar);
break;
}
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php
index f6827df..0b01a28 100644
--- a/usr/local/www/pkg_edit.php
+++ b/usr/local/www/pkg_edit.php
@@ -59,9 +59,9 @@ function gentitle_pkg($pgname) {
function domTT_title($title_msg) {
if (!empty($title_msg)) {
- $title_msg=preg_replace("/\s+/"," ",$title_msg);
- $title_msg=preg_replace("/'/","\'",$title_msg);
- return "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'delay',300,'styleClass', 'niceTitle');\"";
+ $title_msg = preg_replace("/\s+/", " ", $title_msg);
+ $title_msg = preg_replace("/'/", "\'", $title_msg);
+ return "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'delay', 300, 'styleClass', 'niceTitle');\"";
}
}
@@ -210,13 +210,14 @@ if ($_POST) {
$rowhelpername="row";
foreach ($fields['rowhelper']['rowhelperfield'] as $rowhelperfield) {
foreach ($_POST as $key => $value) {
- if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/",$key,$matches))
- $pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']]=$value;
+ if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/", $key, $matches)) {
+ $pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']] = $value;
+ }
}
}
break;
default:
- $fieldname = $fields['fieldname'];
+ $fieldname = $fields['fieldname'];
if ($fieldname == "interface_array") {
$fieldvalue = $_POST[$fieldname];
} elseif (is_array($_POST[$fieldname])) {
@@ -283,7 +284,7 @@ if ($_POST) {
}
if ($pkg['title'] <> "") {
- $edit = ($only_edit ? '' : ": " . gettext("Edit"));
+ $edit = ($only_edit ? '' : ": " . gettext("Edit"));
$title = $pkg['title'] . $edit;
} else {
$title = gettext("Package Editor");
@@ -321,7 +322,7 @@ if ($pkg['custom_php_after_head_command']) {
cursor: 'move',
distance: 10,
opacity: 0.8,
- helper: function(e,ui) {
+ helper: function(e, ui) {
ui.children().each(function() {
jQuery(this).width(jQuery(this).width());
});
@@ -497,7 +498,7 @@ if ($pkg['tabs'] <> "") {
continue;
}
- if ($pkga['combinefields']=="begin") {
+ if ($pkga['combinefields'] == "begin") {
$input="<tr valign='top' id='tr_{$pkga['fieldname']}'>";
if (isset($pkga['advancedfield']) && isset($adv_filed_count)) {
$advanced .= $input;
@@ -553,7 +554,7 @@ if ($pkg['tabs'] <> "") {
echo $input;
}
}
- if ($pkga['combinefields']=="begin") {
+ if ($pkga['combinefields'] == "begin") {
$input="<td class=\"vncell\"><table summary=\"advanced\"><tr>";
if (isset($pkga['advancedfield']) && isset($adv_filed_count)) {
$advanced .= $input;
@@ -682,7 +683,7 @@ if ($pkg['tabs'] <> "") {
$source_name =($pkga['source_name']? $opt[$pkga['source_name']] : $opt[$pkga['name']]);
$source_value =($pkga['source_value'] ? $opt[$pkga['source_value']] : $opt[$pkga['value']]);
$selected = (in_array($source_value, $items)? 'selected="selected"' : '');
- $input .= "\t<option value=\"{$source_value}\" $selected>{$source_name}</option>\n";
+ $input .= "\t<option value=\"{$source_value}\" $selected>{$source_name}</option>\n";
}
$input .= "</select>\n<br />\n" . fixup_string($pkga['description']) . "\n";
if (isset($pkga['advancedfield']) && isset($adv_filed_count)) {
@@ -762,7 +763,7 @@ if ($pkg['tabs'] <> "") {
if (!empty($pkga['typealiases'])) {
foreach ($a_aliases as $alias) {
if ($alias['type'] == $pkga['typealiases']) {
- if ($addrisfirst == 1) {
+ if ($addrisfirst == 1) {
$aliasesaddr .= ",";
}
$aliasesaddr .= "'" . $alias['name'] . "'";
@@ -795,39 +796,39 @@ if ($pkg['tabs'] <> "") {
break;
case "interfaces_selection":
- $ips=array();
+ $ips = array();
$interface_regex=(isset($pkga['hideinterfaceregex']) ? $pkga['hideinterfaceregex'] : "nointerfacestohide");
if (is_array($config['interfaces'])) {
foreach ($config['interfaces'] as $iface_key=>$iface_value) {
- if (isset($iface_value['enable']) && !preg_match("/$interface_regex/",$iface_key)) {
+ if (isset($iface_value['enable']) && !preg_match("/$interface_regex/", $iface_key)) {
$iface_description=($iface_value['descr'] !="" ? strtoupper($iface_value['descr']) : strtoupper($iface_key));
if (isset($pkga['showips'])) {
$iface_description .= " address";
}
- $ips[]=array('ip'=> $iface_key, 'description'=> $iface_description);
+ $ips[] = array('ip'=> $iface_key, 'description'=> $iface_description);
}
}
}
if (is_array($config['virtualip']) && isset($pkga['showvirtualips'])) {
foreach ($config['virtualip']['vip'] as $vip) {
- if (!preg_match("/$interface_regex/",$vip['interface'])) {
+ if (!preg_match("/$interface_regex/", $vip['interface'])) {
$vip_description=($vip['descr'] !="" ? " ({$vip['descr']}) " : " ");
}
switch ($vip['mode']) {
case "ipalias":
case "carp":
- $ips[]=array('ip'=> $vip['subnet'],'description' => "{$vip['subnet']} $vip_description");
+ $ips[] = array('ip' => $vip['subnet'], 'description' => "{$vip['subnet']} $vip_description");
break;
case "proxyarp":
- if ($vip['type']=="network") {
+ if ($vip['type'] == "network") {
$start = ip2long32(gen_subnet($vip['subnet'], $vip['subnet_bits']));
$end = ip2long32(gen_subnet_max($vip['subnet'], $vip['subnet_bits']));
$len = $end - $start;
for ($i = 0; $i <= $len; $i++) {
- $ips[]= array('ip'=>long2ip32($start+$i),'description'=> long2ip32($start+$i)." from {$vip['subnet']}/{$vip['subnet_bits']} {$vip_description}");
+ $ips[]= array('ip' => long2ip32($start+$i), 'description' => long2ip32($start+$i)." from {$vip['subnet']}/{$vip['subnet_bits']} {$vip_description}");
}
} else {
- $ips[]= array('ip'=>$vip['subnet'],'description'=> "{$vip['subnet']} $vip_description");
+ $ips[]= array('ip' => $vip['subnet'], 'description' => "{$vip['subnet']} $vip_description");
}
break;
}
@@ -835,11 +836,11 @@ if ($pkg['tabs'] <> "") {
}
sort($ips);
if (isset($pkga['showlistenall'])) {
- array_unshift($ips,array('ip'=> 'All', 'description'=> 'Listen on All interfaces/ip addresses '));
+ array_unshift($ips, array('ip' => 'All', 'description' => 'Listen on All interfaces/ip addresses '));
}
- if (!preg_match("/$interface_regex/","loopback")) {
+ if (!preg_match("/$interface_regex/", "loopback")) {
$iface_description=(isset($pkga['showips']) ? "127.0.0.1 (loopback)" : "loopback");
- array_push($ips,array('ip'=> 'lo0', 'description'=> $iface_description));
+ array_push($ips, array('ip' => 'lo0', 'description' => $iface_description));
}
#show interfaces array on gui
@@ -854,7 +855,7 @@ if ($pkg['tabs'] <> "") {
if (is_array($value)) {
$values = $value;
} else {
- $values = explode(',', $value);
+ $values = explode(',', $value);
}
foreach ($ips as $iface) {
$selected = (in_array($iface['ip'], $values) ? 'selected="selected"' : '');
@@ -947,7 +948,7 @@ if ($pkg['tabs'] <> "") {
if (isset($a_pkg[$id][$rowhelpername])) {
$saved_rows=$a_pkg[$id][$rowhelpername];
} else {
- $saved_rows[]=array();
+ $saved_rows[] = array();
}
foreach ($saved_rows as $row) {
@@ -1019,16 +1020,16 @@ if ($pkg['tabs'] <> "") {
// The tr tag end is used to end the whole set of combined fields,
// but also if usecolspan2 is not in effect then we also put each combined field in its own tr.
if (($pkga['combinefields'] == "end") || (!isset($pkga['usecolspan2']))) {
- $input.="</tr>";
+ $input .= "</tr>";
}
// At the end of the combined fields we finish up the table that encloses the combined fields...
if ($pkga['combinefields'] == "end") {
- $input.="</table></td></tr>";
+ $input .= "</table></td></tr>";
}
} else {
$input = "</td></tr>";
if ($pkga['usecolspan2']) {
- $input.= "</tr><br />";
+ $input .= "</tr><br />";
}
}
if (isset($pkga['advancedfield']) && isset($adv_filed_count)) {
@@ -1115,7 +1116,7 @@ function display_row($trc, $value, $fieldname, $type, $rowhelper, $size) {
case "textarea":
echo "<textarea rows='2' cols='12' id='{$fieldname}{$trc}' class='formfld unknown' name='{$fieldname}{$trc}'>{$value}</textarea>\n";
case "select":
- echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$title}>\n";
+ echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$title}>\n";
foreach ($rowhelper['options']['option'] as $rowopt) {
$text .= "<option value='{$rowopt['value']}'>{$rowopt['name']}</option>";
echo "<option value='{$rowopt['value']}'".($rowopt['value'] == $value?" selected=\"selected\"":"").">{$rowopt['name']}</option>\n";
@@ -1138,7 +1139,7 @@ function display_row($trc, $value, $fieldname, $type, $rowhelper, $size) {
if (is_array($value)) {
$values = $value;
} else {
- $values = explode(',', $value);
+ $values = explode(',', $value);
}
$ifaces["lo0"] = "loopback";
echo "<option><name></name><value></value></option>/n";
@@ -1218,7 +1219,7 @@ function parse_package_templates() {
$row_helper_data = "";
foreach ($fields['rowhelper']['rowhelperfield'] as $rowhelperfield) {
foreach ($_POST as $key => $value) {
- if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/",$key,$matches)) {
+ if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/", $key, $matches)) {
$row_helper_total_rows++;
$row_helper_data .= $value;
$sep = "";
@@ -1236,7 +1237,7 @@ function parse_package_templates() {
}
break;
default:
- $fieldname = $fields['fieldname'];
+ $fieldname = $fields['fieldname'];
$fieldvalue = $_POST[$fieldname];
$template_text = str_replace($fieldname . "_fieldvalue", $fieldvalue, $template_text);
}
@@ -1248,7 +1249,7 @@ function parse_package_templates() {
$template_text = str_replace("\\n", "\n", $template_text);
/* write out new template file */
- $fout = fopen($filename,"w");
+ $fout = fopen($filename, "w");
fwrite($fout, $template_text);
fclose($fout);
}
diff --git a/usr/local/www/pkg_mgr.php b/usr/local/www/pkg_mgr.php
index 8979a08..ed4d717 100644
--- a/usr/local/www/pkg_mgr.php
+++ b/usr/local/www/pkg_mgr.php
@@ -56,7 +56,7 @@ date_default_timezone_set($timezone);
/* if upgrade in progress, alert user */
if (is_subsystem_dirty('packagelock')) {
- $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ $pgtitle = array(gettext("System"), gettext("Package Manager"));
include("head.inc");
echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
include("fbegin.inc");
@@ -68,8 +68,8 @@ if (is_subsystem_dirty('packagelock')) {
}
function domTT_title($title_msg) {
if (!empty($title_msg)) {
- $title_msg=preg_replace("/\s+/"," ",$title_msg);
- $title_msg=preg_replace("/'/","\'",$title_msg);
+ $title_msg = preg_replace("/\s+/", " ", $title_msg);
+ $title_msg = preg_replace("/'/", "\'", $title_msg);
echo "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\"";
}
}
@@ -104,7 +104,7 @@ if (!empty($_GET)) {
}
$closehead = false;
-$pgtitle = array(gettext("System"),gettext("Package Manager"));
+$pgtitle = array(gettext("System"), gettext("Package Manager"));
include("head.inc");
?>
@@ -152,18 +152,18 @@ include("head.inc");
natcasesort($pkg_keys);
//Check categories
- $categories=array();
+ $categories = array();
if (is_array($pkg_keys)) {
foreach ($pkg_keys as $key) {
$categories[$pkg_info[$key]['category']]++;
}
}
ksort($categories);
- $cm_count=0;
+ $cm_count = 0;
$tab_array = array();
- $visible_categories=array();
- $categories_min_count=($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3);
- $categories_max_display=($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6);
+ $visible_categories = array();
+ $categories_min_count = ($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3);
+ $categories_max_display = ($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6);
/* check selected category or define default category to show */
if (isset($_REQUEST['category'])) {
@@ -177,15 +177,15 @@ include("head.inc");
$menu_category = (isset($_REQUEST['category']) ? $_REQUEST['category'] : "All");
$show_category = ($menu_category == "Other" || $menu_category == "All");
- $tab_array[] = array(gettext("All"), $menu_category=="All" ? true : false, "pkg_mgr.php?category=All");
+ $tab_array[] = array(gettext("All"), $menu_category == "All" ? true : false, "pkg_mgr.php?category=All");
foreach ($categories as $category => $c_count) {
if ($c_count >= $categories_min_count && $cm_count <= $categories_max_display) {
- $tab_array[] = array(gettext($category) , $menu_category==$category ? true : false, "pkg_mgr.php?category={$category}");
+ $tab_array[] = array(gettext($category) , $menu_category == $category ? true : false, "pkg_mgr.php?category={$category}");
$visible_categories[]=$category;
$cm_count++;
}
}
- $tab_array[] = array(gettext("Other Categories"), $menu_category=="Other" ? true : false, "pkg_mgr.php?category=Other");
+ $tab_array[] = array(gettext("Other Categories"), $menu_category == "Other" ? true : false, "pkg_mgr.php?category=Other");
if (count($categories) > 1) {
display_top_tabs($tab_array);
}
@@ -219,7 +219,7 @@ include("head.inc");
}
/* get history/changelog git dir */
- $commit_dir=explode("/",$index['config_file']);
+ $commit_dir = explode("/", $index['config_file']);
$changeloglink = "https://github.com/pfsense/pfsense-packages/commits/master/config/";
if ($commit_dir[(count($commit_dir)-2)] == "config") {
$changeloglink .= $commit_dir[(count($commit_dir)-1)];
@@ -236,7 +236,7 @@ include("head.inc");
$pkginfo=gettext("No package info, check the forum");
}
- if ($menu_category == "All" || $index['category'] == $menu_category || ($menu_category == "Other" && !in_array($index['category'],$visible_categories))):
+ if ($menu_category == "All" || $index['category'] == $menu_category || ($menu_category == "Other" && !in_array($index['category'], $visible_categories))):
?>
<tr valign="top" class="<?= $index['category'] ?>">
<td class="listlr" <?=domTT_title(gettext("Click on package name to access its website."))?>>
diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php
index ceb4f75..064c593 100644
--- a/usr/local/www/pkg_mgr_install.php
+++ b/usr/local/www/pkg_mgr_install.php
@@ -55,7 +55,7 @@ $static_output = "";
$static_status = "";
$sendto = "output";
-$pgtitle = array(gettext("System"),gettext("Package Manager"),gettext("Install Package"));
+$pgtitle = array(gettext("System"), gettext("Package Manager"), gettext("Install Package"));
include("head.inc");
if ($_POST) {
@@ -115,12 +115,14 @@ if ((empty($_GET['mode']) && $_GET['id']) || (!empty($_GET['mode']) && (!empty($
} else if ($_GET['mode'] == 'reinstallall') {
$pkgmode = 'reinstallall';
}
+ $pkg_gui_xml_text = "";
switch ($pkgmode) {
case 'reinstallall':
$pkgname = 'All packages';
$pkgtxt = 'reinstalled';
break;
case 'reinstallxml':
+ $pkg_gui_xml_text = " GUI XML components";
case 'reinstallpkg':
$pkgtxt = 'reinstalled';
break;
@@ -136,7 +138,7 @@ if ((empty($_GET['mode']) && $_GET['id']) || (!empty($_GET['mode']) && (!empty($
<td class="tabcont" align="center">
<table style="height:15;colspacing:0" width="420" border="0" cellpadding="0" cellspacing="0" summary="images">
<tr>
- <td class="tabcont" align="center">Package: <b><?=$pkgname;?></b> will be <?=$pkgtxt;?>.<br/>
+ <td class="tabcont" align="center">Package: <b><?=$pkgname;?></b><?=$pkg_gui_xml_text;?> will be <?=$pkgtxt;?>.<br/>
Please confirm the action.<br/>
</td>
<td class="tabcont" align="center">
@@ -238,6 +240,7 @@ if ($_GET) {
case 'reinstallxml':
pkg_fetch_config_file($pkgid);
pkg_fetch_additional_files($pkgid);
+ break;
case 'reinstallpkg':
delete_package_xml($pkgid);
if (install_package($pkgid) < 0) {
diff --git a/usr/local/www/pkg_mgr_installed.php b/usr/local/www/pkg_mgr_installed.php
index 119df9c..e190fec 100644
--- a/usr/local/www/pkg_mgr_installed.php
+++ b/usr/local/www/pkg_mgr_installed.php
@@ -50,7 +50,7 @@ date_default_timezone_set($timezone);
/* if upgrade in progress, alert user */
if (is_subsystem_dirty('packagelock')) {
- $pgtitle = array(gettext("System"),gettext("Package Manager"));
+ $pgtitle = array(gettext("System"), gettext("Package Manager"));
include("head.inc");
echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
include("fbegin.inc");
@@ -63,8 +63,8 @@ if (is_subsystem_dirty('packagelock')) {
function domTT_title($title_msg, $return="echo") {
if (!empty($title_msg)) {
- $title_msg=preg_replace("/\s+/"," ",$title_msg);
- $title_msg=preg_replace("/'/","\'",$title_msg);
+ $title_msg = preg_replace("/\s+/", " ", $title_msg);
+ $title_msg = preg_replace("/'/", "\'", $title_msg);
$title= "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\"";
if ($return =="echo") {
echo $title;
@@ -77,10 +77,10 @@ if (is_array($config['installedpackages']['package'])) {
foreach ($config['installedpackages']['package'] as $instpkg) {
$tocheck[] = $instpkg['name'];
}
- $currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink','descr'));
+ $currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink', 'descr'));
}
$closehead = false;
-$pgtitle = array(gettext("System"),gettext("Package Manager"));
+$pgtitle = array(gettext("System"), gettext("Package Manager"));
include("head.inc");
?>
@@ -148,8 +148,8 @@ include("head.inc");
}
// get history/changelog git dir
- $commit_dir=explode("/",$pkg['config_file']);
- $changeloglink ="https://github.com/pfsense/pfsense-packages/commits/master/config/".$commit_dir[(count($commit_dir)-2)];
+ $commit_dir = explode("/", $pkg['config_file']);
+ $changeloglink = "https://github.com/pfsense/pfsense-packages/commits/master/config/" . $commit_dir[(count($commit_dir)-2)];
#check package version
$latest_package = $currentvers[$pkg['name']]['version'];
if ($latest_package) {
@@ -157,21 +157,21 @@ include("head.inc");
if (strcmp($pkg['version'], $latest_package) > 0) {
$tdclass = "listbggrey";
if ($g['disablepackagehistory']) {
- $pkgver = "<a>".gettext("Available") .": ". $latest_package . "<br />";
+ $pkgver = "<a>" . gettext("Available") . ": " . $latest_package . "<br />";
} else {
- $pkgver = "<a target='_blank' href='$changeloglink'>".gettext("Available") .": ". $latest_package . "<br />";
+ $pkgver = "<a target='_blank' href='$changeloglink'>" . gettext("Available") . ": " . $latest_package . "<br />";
}
- $pkgver .= gettext("Installed") .": ". $pkg['version']. "</a>";
+ $pkgver .= gettext("Installed") . ": " . $pkg['version'] . "</a>";
}
// we're running an older version of the package
if (strcmp($pkg['version'], $latest_package) < 0) {
$tdclass = "listbg";
if ($g['disablepackagehistory']) {
- $pkgver = "<a><font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "</font><br />";
+ $pkgver = "<a><font color='#ffffff'>" . gettext("Available") . ": " . $latest_package . "</font><br />";
} else {
- $pkgver = "<a target='_blank' href='$changeloglink'><font color='#ffffff'>" . gettext("Available") .": ". $latest_package . "<br />";
+ $pkgver = "<a target='_blank' href='$changeloglink'><font color='#ffffff'>" . gettext("Available") . ": " . $latest_package . "<br />";
}
- $pkgver .= gettext("Installed") .": ". $pkg['version']."</font></a>";
+ $pkgver .= gettext("Installed") . ": " . $pkg['version'] . "</font></a>";
}
// we're running the current version
if (!strcmp($pkg['version'], $latest_package)) {
@@ -187,11 +187,11 @@ include("head.inc");
// unknown available package version
$tdclass = "listbg";
if ($g['disablepackagehistory']) {
- $pkgver = "<a><font color='#ffffff'>" . gettext("Latest") .": ". gettext("N/A") . "</font><br />";
+ $pkgver = "<a><font color='#ffffff'>" . gettext("Latest") . ": " . gettext("N/A") . "</font><br />";
} else {
- $pkgver = "<a target='_blank' href='$changeloglink'><font color='#ffffff'>" . gettext("Latest") .": ". gettext("N/A") . "<br />";
+ $pkgver = "<a target='_blank' href='$changeloglink'><font color='#ffffff'>" . gettext("Latest") . ": " . gettext("N/A") . "<br />";
}
- $pkgver .= gettext("Installed") .": ". $pkg['version']."</font></a>";
+ $pkgver .= gettext("Installed") . ": " . $pkg['version'] . "</font></a>";
$pkgdescr = $pkg['descr'];
}
/* Check package info link */
@@ -215,10 +215,10 @@ include("head.inc");
if (isset($g['disablepackagehistory'])) {
echo "<td class='{$tdclass}'>{$pkgver}</td>";
} else {
- echo "<td class='{$tdclass}' ".domTT_title(gettext("Click on ".ucfirst($pkg['name'])." version to check its change log."),"return").">{$pkgver}</td>";
+ echo "<td class='{$tdclass}' " . domTT_title(gettext("Click on " . ucfirst($pkg['name']) . " version to check its change log."), "return").">{$pkgver}</td>";
}
?>
- <td class="listbg" style="overflow:hidden; text-align:justify;" <?=domTT_title(gettext("Click package info for more details about ".ucfirst($pkg['name'])." package."))?>>
+ <td class="listbg" style="overflow:hidden; text-align:justify;" <?=domTT_title(gettext("Click package info for more details about " . ucfirst($pkg['name']) . " package."))?>>
<?=$pkgdescr;?>
<?php if (!$g['disablepackageinfo']): ?>
<br /><br />
@@ -227,14 +227,14 @@ include("head.inc");
</td>
<td valign="middle" class="list nowrap">
<a href="pkg_mgr_install.php?mode=delete&amp;pkg=<?= $pkg['name']; ?>">
- <img <?=domTT_title(gettext("Remove ".ucfirst($pkg['name'])." package."))?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
+ <img <?=domTT_title(gettext("Remove " . ucfirst($pkg['name']) . " package."))?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
</a>
<br />
<a href="pkg_mgr_install.php?mode=reinstallpkg&amp;pkg=<?= $pkg['name']; ?>">
- <img <?=domTT_title(gettext("Reinstall ".ucfirst($pkg['name'])." package."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0" alt="reinstall" />
+ <img <?=domTT_title(gettext("Reinstall " . ucfirst($pkg['name']) . " package."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0" alt="reinstall" />
</a>
<a href="pkg_mgr_install.php?mode=reinstallxml&amp;pkg=<?= $pkg['name']; ?>">
- <img <?=domTT_title(gettext("Reinstall ".ucfirst($pkg['name'])."'s GUI components."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0" alt="reinstall" />
+ <img <?=domTT_title(gettext("Reinstall " . ucfirst($pkg['name']) . "'s GUI components."));?> src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_xml.gif" width="17" height="17" border="0" alt="reinstall" />
</a>
</td>
</tr>
diff --git a/usr/local/www/pkg_mgr_settings.php b/usr/local/www/pkg_mgr_settings.php
index 39ef58c..c222d28 100644
--- a/usr/local/www/pkg_mgr_settings.php
+++ b/usr/local/www/pkg_mgr_settings.php
@@ -60,7 +60,7 @@ if ($_POST) {
$curcfg = $config['system']['altpkgrepo'];
$closehead = false;
-$pgtitle = array(gettext("System"),gettext("Package Settings"));
+$pgtitle = array(gettext("System"), gettext("Package Settings"));
include("head.inc");
?>
<script type="text/javascript">
@@ -133,12 +133,12 @@ function enable_altpkgrepourl(enable_over) {
<tr>
<td><?=gettext("Base URL:");?></td>
<td>
- <input name="pkgrepourl" type="text" class="formfld url" id="pkgrepourl" size="64" value="<?php if ($curcfg['xmlrpcbaseurl']) echo $curcfg['xmlrpcbaseurl']; else echo $g['']; ?>" />
+ <input name="pkgrepourl" type="text" class="formfld url" id="pkgrepourl" size="64" value="<?php if ($curcfg['xmlrpcbaseurl']) echo htmlspecialchars($curcfg['xmlrpcbaseurl']); else echo $g['']; ?>" />
</td>
</tr>
</table>
<span class="vexpl">
- <?php printf(gettext("This is where %s will check for packages when the"),$g['product_name']);?> <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed.");?>
+ <?php printf(gettext("This is where %s will check for packages when the"), $g['product_name']);?> <a href="pkg_mgr.php"><?=gettext("System: Packages");?></a> <?=gettext("page is viewed.");?>
</span>
</td>
</tr>
diff --git a/usr/local/www/reboot.php b/usr/local/www/reboot.php
index 6025648..3a986ac 100755
--- a/usr/local/www/reboot.php
+++ b/usr/local/www/reboot.php
@@ -46,7 +46,7 @@ if ($_POST['Submit'] == " " . gettext("No") . " ") {
exit;
}
-$pgtitle = array(gettext("Diagnostics"),gettext("Reboot System"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Reboot System"));
include("head.inc");
?>
@@ -56,7 +56,7 @@ include("head.inc");
<meta http-equiv=\"refresh\" content=\"70;url=/\">
<?php print_info_box(gettext("The system is rebooting now. This may take one minute.")); ?>
<pre>
-<?php system_reboot(); ?>
+<?php system_reboot(); ?>
</pre>
<?php else: ?>
<form action="reboot.php" method="post">
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index 4c3874e..4896be8 100644
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -1063,9 +1063,9 @@ function enable_change(enable_change) {
$macformats = array("singledash", "ietf", "cisco", "unformatted");
foreach ($macformats as $macformat) {
if ($pconfig['radmac_format'] == $macformat) {
- echo "<option selected=\"selected\" value=\"$macformat\">",gettext($macformat),"</option>\n";
+ echo "<option selected=\"selected\" value=\"$macformat\">", gettext($macformat), "</option>\n";
} else {
- echo "<option value=\"$macformat\">",gettext($macformat),"</option>\n";
+ echo "<option value=\"$macformat\">", gettext($macformat), "</option>\n";
}
}
?>
@@ -1136,7 +1136,7 @@ function enable_change(enable_change) {
$port = $pconfig['listenporthttps'] ? $pconfig['listenporthttps'] : ($zoneid + 8001);
$href = "https://{$host}:{$port}";
} else {
- $port = $pconfig['listenporthttp'] ? $pconfig['listenporthttp'] : ($zoneid + 8000);
+ $port = $pconfig['listenporthttp'] ? $pconfig['listenporthttp'] : ($zoneid + 8000);
$href = "http://{$host}:{$port}";
}
?>
@@ -1220,7 +1220,7 @@ function enable_change(enable_change) {
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <?php echo "<input name='zone' id='zone' type='hidden' value='" . htmlspecialchars($cpzone) . "' />"; ?>
+ <?php echo "<input name='zone' id='zone' type='hidden' value='" . htmlspecialchars($cpzone, ENT_QUOTES | ENT_HTML401) . "' />"; ?>
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
<a href="services_captiveportal_zones.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="enable_change(true)" /></a>
</td>
diff --git a/usr/local/www/services_captiveportal_hostname_edit.php b/usr/local/www/services_captiveportal_hostname_edit.php
index dc33739..674e220 100644
--- a/usr/local/www/services_captiveportal_hostname_edit.php
+++ b/usr/local/www/services_captiveportal_hostname_edit.php
@@ -57,6 +57,8 @@ require_once("filter.inc");
require("shaper.inc");
require("captiveportal.inc");
+global $cpzone, $cpzoneid;
+
$pgtitle = array(gettext("Services"), gettext("Captive portal"), gettext("Edit allowed Hostname"));
$shortcut_section = "captiveportal";
@@ -64,6 +66,7 @@ $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) {
$cpzone = $_POST['zone'];
}
+$cpzoneid = $config['captiveportal'][$cpzone]['zoneid'];
if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) {
header("Location: services_captiveportal_zones.php");
@@ -154,8 +157,7 @@ if ($_POST) {
$rules = captiveportal_allowedhostname_configure();
@file_put_contents("{$g['tmp_path']}/hostname_rules", $rules);
- $cpzoneid = $a_cp[$cpzone]['zoneid'];
- mwexec("/sbin/ipfw -x {$cpzoneid} {$g['tmp_path']}/hostname_rules");
+ mwexec("/sbin/ipfw -x {$cpzoneid} {$g['tmp_path']}/hostname_rules", true);
unset($rules);
header("Location: services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php
index d6fe66a..d6c1af3 100644
--- a/usr/local/www/services_captiveportal_mac.php
+++ b/usr/local/www/services_captiveportal_mac.php
@@ -129,7 +129,7 @@ if ($_POST) {
write_config();
echo gettext("The entry was successfully deleted") . "\n";
} else {
- echo gettext("No entry exists for this mac address:") . " " . $_POST['delmac'] . "\n";
+ echo gettext("No entry exists for this mac address:") . " " . $_POST['delmac'] . "\n";
}
}
exit;
@@ -182,7 +182,7 @@ include("head.inc");
<td class="tabcont">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main">
<tr>
- <td width="3%" class="list"></td>
+ <td width="3%" class="list"></td>
<td width="37%" class="listhdrr"><?=gettext("MAC address"); ?></td>
<td width="50%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="10%" class="list"></td>
diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php
index 82477b5..decea80 100644
--- a/usr/local/www/services_captiveportal_vouchers.php
+++ b/usr/local/www/services_captiveportal_vouchers.php
@@ -241,10 +241,10 @@ if ($_POST) {
if ($_POST['charset'] && (strlen($_POST['charset'] < 2))) {
$input_errors[] = gettext("Need at least 2 characters to create vouchers.");
}
- if ($_POST['charset'] && (strpos($_POST['charset'], "\"")>0)) {
+ if ($_POST['charset'] && (strpos($_POST['charset'], "\"") > 0)) {
$input_errors[] = gettext("Double quotes aren't allowed.");
}
- if ($_POST['charset'] && (strpos($_POST['charset'], ",")>0)) {
+ if ($_POST['charset'] && (strpos($_POST['charset'], ",") > 0)) {
$input_errors[] = "',' " . gettext("aren't allowed.");
}
if ($_POST['rollbits'] && (!is_numeric($_POST['rollbits']) || ($_POST['rollbits'] < 1) || ($_POST['rollbits'] > 31))) {
@@ -317,7 +317,7 @@ if ($_POST) {
$url = "http://{$newvoucher['vouchersyncdbip']}";
}
- $execcmd = <<<EOF
+ $execcmd = <<<EOF
\$toreturn = array();
\$toreturn['voucher'] = \$config['voucher']['$cpzone'];
unset(\$toreturn['vouchersyncport'], \$toreturn['vouchersyncpass'], \$toreturn['vouchersyncusername'], \$toreturn['vouchersyncdbip']);
@@ -351,7 +351,7 @@ EOF;
log_error("The Captive Portal voucher database has been synchronized with {$url}:{$port} (pfsense.exec_php).");
}
if (!$input_errors) {
- $toreturn = XML_RPC_Decode($resp->value());
+ $toreturn = XML_RPC_Decode($resp->value());
if (!is_array($toreturn)) {
if ($toreturn == "Authentication failed") {
$input_errors[] = "Could not synchronize the voucher database: Authentication Failed.";
@@ -428,7 +428,7 @@ function before_save() {
document.iform.privatekey.disabled = false;
document.iform.msgnoaccess.disabled = false;
document.iform.msgexpired.disabled = false;
- for (var x=0; x < <?php echo count($a_roll); ?>; x++) {
+ for (var x = 0; x < <?php echo count($a_roll); ?>; x++) {
jQuery('#addeditdelete' + x).show();
}
jQuery('#addnewroll').show();
@@ -459,12 +459,12 @@ function enable_change(enable_change) {
document.iform.privatekey.disabled = true;
document.iform.msgnoaccess.disabled = true;
document.iform.msgexpired.disabled = true;
- for (var x=0; x < <?php echo count($a_roll); ?>; x++) {
+ for (var x = 0; x < <?php echo count($a_roll); ?>; x++) {
jQuery('#addeditdelete' + x).hide();
}
jQuery('#addnewroll').hide();
} else {
- for (var x=0; x < <?php echo count($a_roll); ?>; x++) {
+ for (var x = 0; x < <?php echo count($a_roll); ?>; x++) {
jQuery('#addeditdelete' + x).show();
}
jQuery('#addnewroll').show();
diff --git a/usr/local/www/services_captiveportal_vouchers_edit.php b/usr/local/www/services_captiveportal_vouchers_edit.php
index 5b1afbe..0aa6a45 100644
--- a/usr/local/www/services_captiveportal_vouchers_edit.php
+++ b/usr/local/www/services_captiveportal_vouchers_edit.php
@@ -127,8 +127,8 @@ if ($_POST) {
$rollent = $a_roll[$id];
}
- $rollent['zone'] = $_POST['zone'];
- $rollent['number'] = $_POST['number'];
+ $rollent['zone'] = $_POST['zone'];
+ $rollent['number'] = $_POST['number'];
$rollent['minutes'] = $_POST['minutes'];
$rollent['descr'] = $_POST['descr'];
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index e6bdd8d..3061812 100644
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -195,7 +195,7 @@ if (isset($_POST['submit'])) {
$pconfig = $_POST;
$numberoptions = array();
- for ($x=0; $x<99; $x++) {
+ for ($x = 0; $x < 99; $x++) {
if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
$numbervalue = array();
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
@@ -1110,10 +1110,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
<td width="78%" class="vtable">
- <div id="showddnsbox">
+ <div id="showddnsbox" <?php if ($pconfig['ddnsupdate'] || !empty($pconfig['ddnsdomain']) || !empty($pconfig['ddnsdomainprimary']) || !empty($pconfig['ddnsdomainkeyname']) || !empty($pconfig['ddnsdomainkey'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
</div>
- <div id="showddns" style="display:none">
+ <div id="showddns" <?php if (!$pconfig['ddnsupdate'] && empty($pconfig['ddnsdomain']) && empty($pconfig['ddnsdomainprimary']) && empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey'])) echo "style='display:none'"; ?>>
<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if ($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
<br/>
@@ -1132,10 +1132,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("MAC Address Control");?></td>
<td width="78%" class="vtable">
- <div id="showmaccontrolbox">
+ <div id="showmaccontrolbox" <?php if (!empty($pconfig['mac_allow']) || !empty($pconfig['mac_deny'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_maccontrol_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show MAC Address Control");?>
</div>
- <div id="showmaccontrol" style="display:none">
+ <div id="showmaccontrol" <?php if (empty($pconfig['mac_allow']) && empty($pconfig['mac_deny'])) echo "style='display:none'"; ?>>
<input name="mac_allow" type="text" class="formfld unknown" id="mac_allow" size="20" value="<?=htmlspecialchars($pconfig['mac_allow']);?>" /><br />
<?=gettext("Enter a list of partial MAC addresses to allow, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF<br />
<input name="mac_deny" type="text" class="formfld unknown" id="mac_deny" size="20" value="<?=htmlspecialchars($pconfig['mac_deny']);?>" /><br />
@@ -1146,10 +1146,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
<td width="78%" class="vtable">
- <div id="showntpbox">
+ <div id="showntpbox" <?php if (!empty($pconfig['ntp1']) || !empty($pconfig['ntp2'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
</div>
- <div id="showntp" style="display:none">
+ <div id="showntp" <?php if (empty($pconfig['ntp1']) && empty($pconfig['ntp2'])) echo "style='display:none'"; ?>>
<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
</div>
@@ -1158,10 +1158,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
<td width="78%" class="vtable">
- <div id="showtftpbox">
+ <div id="showtftpbox" <?php if (!empty($pconfig['tftp'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
</div>
- <div id="showtftp" style="display:none">
+ <div id="showtftp" <?php if (empty($pconfig['tftp'])) echo "style='display:none'"; ?>>
<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
<?=gettext("Leave blank to disable. Enter a full hostname or IP for the TFTP server.");?>
</div>
@@ -1170,10 +1170,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
<td width="78%" class="vtable">
- <div id="showldapbox">
+ <div id="showldapbox" <?php if (!empty($pconfig['ldap'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
</div>
- <div id="showldap" style="display:none">
+ <div id="showldap" <?php if (empty($pconfig['ldap'])) echo "style='display:none'"; ?>>
<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
<?=gettext("Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
</div>
@@ -1182,10 +1182,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
<td width="78%" class="vtable">
- <div id="shownetbootbox">
+ <div id="shownetbootbox" <?php if ($pconfig['netboot'] || !empty($pconfig['nextserver']) || !empty($pconfig['filename']) || !empty($pconfig['filename32']) || !empty($pconfig['filename64']) || !empty($pconfig['rootpath'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
</div>
- <div id="shownetboot" style="display:none">
+ <div id="shownetboot" <?php if (!$pconfig['netboot'] && empty($pconfig['nextserver']) && empty($pconfig['filename']) && empty($pconfig['filename32']) && empty($pconfig['filename64']) && empty($pconfig['rootpath'])) echo "style='display:none'"; ?>>
<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if ($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
<b><?=gettext("Enables network booting.");?></b>
<br/>
@@ -1237,10 +1237,10 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
<td width="78%" class="vtable">
- <div id="shownumbervaluebox">
+ <div id="shownumbervaluebox" <?php if (!empty($pconfig['numberoptions'])) echo "style='display:none'"; ?>>
<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
</div>
- <div id="shownumbervalue" style="display:none">
+ <div id="shownumbervalue" <?php if (empty($pconfig['numberoptions'])) echo "style='display:none'"; ?>>
<table id="maintable" summary="bootp-dhcp options">
<tbody>
<tr>
diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php
index f89952e..51a6ada 100644
--- a/usr/local/www/services_dhcpv6.php
+++ b/usr/local/www/services_dhcpv6.php
@@ -157,7 +157,7 @@ if ($_POST) {
$pconfig = $_POST;
$numberoptions = array();
- for ($x=0; $x<99; $x++) {
+ for ($x = 0; $x < 99; $x++) {
if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
$numbervalue = array();
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php
index aea880d..e581f20 100644
--- a/usr/local/www/services_dhcpv6_edit.php
+++ b/usr/local/www/services_dhcpv6_edit.php
@@ -148,7 +148,7 @@ if ($_POST) {
continue;
}
- if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || ($mapent['duid'] == $_POST['duid'])) {
+ if ((($mapent['hostname'] == $_POST['hostname']) && $mapent['hostname']) || ($mapent['duid'] == $_POST['duid'])) {
$input_errors[] = gettext("This Hostname, IP or DUID already exists.");
break;
}
diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php
index 638eeff..4abf4d7 100644
--- a/usr/local/www/services_dnsmasq.php
+++ b/usr/local/www/services_dnsmasq.php
@@ -222,7 +222,7 @@ function show_advanced_dns() {
" their hostname when requesting a DHCP lease will be registered".
" in the DNS forwarder, so that their name can be resolved.".
" You should also set the domain in %sSystem:".
- " General setup%s to the proper value."),'<a href="system.php">','</a>')?>
+ " General setup%s to the proper value."), '<a href="system.php">', '</a>')?>
</p>
</td>
</tr>
@@ -237,7 +237,7 @@ function show_advanced_dns() {
<?php printf(gettext("If this option is set, then DHCP static mappings will ".
"be registered in the DNS forwarder, so that their name can be ".
"resolved. You should also set the domain in %s".
- "System: General setup%s to the proper value."),'<a href="system.php">','</a>');?>
+ "System: General setup%s to the proper value."), '<a href="system.php">', '</a>');?>
</p>
</td>
</tr>
@@ -300,7 +300,7 @@ function show_advanced_dns() {
<td width="22%" valign="top" class="vncellreq"><?=gettext("Listen Port");?></td>
<td width="78%" class="vtable">
<p>
- <input name="port" type="text" id="port" size="6" <?php if ($pconfig['port']) echo "value=\"{$pconfig['port']}\"";?> />
+ <input name="port" type="text" id="port" size="6" <?php if ($pconfig['port']) echo "value=\"" . htmlspecialchars($pconfig['port']) . "\"";?> />
<br /><br />
<?=gettext("The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.");?>
</p>
@@ -383,7 +383,7 @@ function show_advanced_dns() {
" is checked. If you don't use that option (or if you use".
" a static IP address on WAN), you must manually specify at".
" least one DNS server on the %sSystem:".
- "General setup%s page."),'<a href="system.php">','</a>','<a href="system.php">','</a>');?><br />
+ "General setup%s page."), '<a href="system.php">', '</a>', '<a href="system.php">', '</a>');?><br />
</span>
</p>
diff --git a/usr/local/www/services_dyndns_edit.php b/usr/local/www/services_dyndns_edit.php
index 4bd1d1e..a619ce9 100644
--- a/usr/local/www/services_dyndns_edit.php
+++ b/usr/local/www/services_dyndns_edit.php
@@ -467,7 +467,7 @@ function _onTypeChange(type) {
</span>
<?php printf(gettext("You must configure a DNS server in %sSystem:
General setup%s or allow the DNS server list to be overridden
- by DHCP/PPP on WAN for dynamic DNS updates to work."),'<a href="system.php">','</a>');?>
+ by DHCP/PPP on WAN for dynamic DNS updates to work."), '<a href="system.php">', '</a>');?>
</span>
</td>
</tr>
diff --git a/usr/local/www/services_igmpproxy_edit.php b/usr/local/www/services_igmpproxy_edit.php
index 935bf49..2d299c0 100644
--- a/usr/local/www/services_igmpproxy_edit.php
+++ b/usr/local/www/services_igmpproxy_edit.php
@@ -92,7 +92,7 @@ if ($_POST) {
$address = "";
$isfirst = 0;
/* item is a normal igmpentry type */
- for ($x=0; $x<4999; $x++) {
+ for ($x = 0; $x < 4999; $x++) {
if ($_POST["address{$x}"] <> "") {
if ($isfirst > 0) {
$address .= " ";
@@ -203,15 +203,15 @@ include("head.inc");
</select>
<br />
<span class="vexpl">
- <?=gettext("The <b>upstream</b> network interface is the outgoing interface which is".
- " responsible for communicating to available multicast data sources.".
+ <?=gettext("The <b>upstream</b> network interface is the outgoing interface which is" .
+ " responsible for communicating to available multicast data sources." .
" There can only be one upstream interface.");?>
</span>
<br />
<span class="vexpl">
<b><?=gettext("Downstream"); ?></b>
- <?=gettext("network interfaces are the distribution interfaces to the".
- " destination networks, where multicast clients can join groups and".
+ <?=gettext("network interfaces are the distribution interfaces to the" .
+ " destination networks, where multicast clients can join groups and" .
" receive multicast data. One or more downstream interfaces must be configured.");?>
</span>
</td>
@@ -222,8 +222,8 @@ include("head.inc");
<input name="threshold" class="formfld unknown" id="threshold" value="<?php echo htmlspecialchars($pconfig['threshold']);?>" />
<br />
<span class="vexpl">
- <?=gettext("Defines the TTL threshold for the network interface. Packets".
- " with a lower TTL than the threshold value will be ignored. This".
+ <?=gettext("Defines the TTL threshold for the network interface. Packets" .
+ " with a lower TTL than the threshold value will be ignored. This" .
" setting is optional, and by default the threshold is 1.");?>
</span>
</td>
diff --git a/usr/local/www/services_ntpd.php b/usr/local/www/services_ntpd.php
index cea8ea6..1f4dd86 100644
--- a/usr/local/www/services_ntpd.php
+++ b/usr/local/www/services_ntpd.php
@@ -329,7 +329,7 @@ include("head.inc");
}
echo ">\n";
- echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeservers[$i]}\" type=\"text\" />&emsp;";
+ echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"" . htmlspecialchars($timeservers[$i]) . "\" type=\"text\" />&emsp;";
echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
if (isset($config['ntpd']['prefer']) && isset($timeservers[$i]) && substr_count($config['ntpd']['prefer'], $timeservers[$i])) {
echo " checked=\"checked\"";
diff --git a/usr/local/www/services_rfc2136_edit.php b/usr/local/www/services_rfc2136_edit.php
index 6c3a8c2..686ca27 100644
--- a/usr/local/www/services_rfc2136_edit.php
+++ b/usr/local/www/services_rfc2136_edit.php
@@ -265,7 +265,7 @@ include("head.inc");
</span>
<?php printf(gettext("You must configure a DNS server in %sSystem: " .
"General setup %sor allow the DNS server list to be overridden " .
- "by DHCP/PPP on WAN for dynamic DNS updates to work."),'<a href="system.php">', '</a>');?>
+ "by DHCP/PPP on WAN for dynamic DNS updates to work."), '<a href="system.php">', '</a>');?>
</span>
</td>
</tr>
diff --git a/usr/local/www/services_unbound.php b/usr/local/www/services_unbound.php
index 699a3a8..a197c8c 100644
--- a/usr/local/www/services_unbound.php
+++ b/usr/local/www/services_unbound.php
@@ -268,7 +268,7 @@ function show_advanced_dns() {
<td width="22%" valign="top" class="vncellreq"><?=gettext("Listen Port");?></td>
<td width="78%" class="vtable">
<p>
- <input name="port" type="text" id="port" size="6" <?php if ($pconfig['port']) echo "value=\"{$pconfig['port']}\"";?> />
+ <input name="port" type="text" id="port" size="6" <?php if ($pconfig['port']) echo "value=\"" . htmlspecialchars($pconfig['port']) . "\"";?> />
<br /><br />
<?=gettext("The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.");?>
</p>
diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php
index b97a05f..092d641 100644
--- a/usr/local/www/services_unbound_acls.php
+++ b/usr/local/www/services_unbound_acls.php
@@ -91,7 +91,7 @@ if ($_POST) {
} else {
// input validation - only allow 50 entries in a single ACL
- for ($x=0; $x<50; $x++) {
+ for ($x = 0; $x < 50; $x++) {
if (isset($pconfig["acl_network{$x}"])) {
$networkacl[$x] = array();
$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
diff --git a/usr/local/www/services_unbound_advanced.php b/usr/local/www/services_unbound_advanced.php
index 0e50e18..5fc4aed 100644
--- a/usr/local/www/services_unbound_advanced.php
+++ b/usr/local/www/services_unbound_advanced.php
@@ -368,14 +368,14 @@ include_once("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Maximum TTL for RRsets and messages");?></td>
<td width="78%" class="vtable">
- <input type="text" id="cache_max_ttl" name="cache_max_ttl" size="5" value="<?php if (isset($pconfig['cache_max_ttl'])) echo $pconfig['cache_max_ttl']; ?>" /><br />
+ <input type="text" id="cache_max_ttl" name="cache_max_ttl" size="5" value="<?php if (isset($pconfig['cache_max_ttl'])) echo htmlspecialchars($pconfig['cache_max_ttl']); ?>" /><br />
<?=gettext("Configure a maximum Time to live for RRsets and messages in the cache. The default is 86400 seconds (1 day). When the internal TTL expires the cache item is expired. This can be configured to force the resolver to query for data more often and not trust (very large) TTL values.");?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Minimum TTL for RRsets and messages");?></td>
<td width="78%" class="vtable">
- <input type="text" id="cache_min_ttl" name="cache_min_ttl" size="5" value="<?php if (isset($pconfig['cache_min_ttl'])) echo $pconfig['cache_min_ttl']; ?>" /><br />
+ <input type="text" id="cache_min_ttl" name="cache_min_ttl" size="5" value="<?php if (isset($pconfig['cache_min_ttl'])) echo htmlspecialchars($pconfig['cache_min_ttl']); ?>" /><br />
<?=gettext("Configure a minimum Time to live for RRsets and messages in the cache. The default is 0 seconds. If the minimum value kicks in, the data is cached for longer than the domain owner intended, and thus less queries are made to look up the data. The 0 value ensures the data in the cache is as the domain owner intended. High values can lead to trouble as the data in the cache might not match up with the actual data anymore.");?>
</td>
</tr>
diff --git a/usr/local/www/services_wol_edit.php b/usr/local/www/services_wol_edit.php
index 21bf790..66481bf 100644
--- a/usr/local/www/services_wol_edit.php
+++ b/usr/local/www/services_wol_edit.php
@@ -148,7 +148,7 @@ include("head.inc");
<td width="78%" class="vtable">
<input name="mac" type="text" class="formfld unknown" id="mac" size="20" value="<?=htmlspecialchars($pconfig['mac']);?>" />
<br />
- <span class="vexpl"><?=gettext("Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx");?></span>
+ <span class="vexpl"><?=gettext("Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx");?></span>
</td>
</tr>
<tr>
diff --git a/usr/local/www/shortcuts.inc b/usr/local/www/shortcuts.inc
index d1b1d2b..c4bf48e 100644
--- a/usr/local/www/shortcuts.inc
+++ b/usr/local/www/shortcuts.inc
@@ -145,14 +145,14 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) {
// Load shortcuts
$dir_array = get_shortcut_files("/usr/local/www/shortcuts");
foreach ($dir_array as $file) {
- if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file,".inc")) {
+ if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file, ".inc")) {
include("/usr/local/www/shortcuts/{$file}");
}
}
if (is_dir("/usr/local/pkg/shortcuts")) {
$dir_array = get_shortcut_files("/usr/local/pkg/shortcuts");
foreach ($dir_array as $file) {
- if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file,".inc")) {
+ if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file, ".inc")) {
include("/usr/local/pkg/shortcuts/{$file}");
}
}
diff --git a/usr/local/www/status.php b/usr/local/www/status.php
index 5248659..b15edc3 100755
--- a/usr/local/www/status.php
+++ b/usr/local/www/status.php
@@ -67,7 +67,7 @@ function doCmdT($title, $command) {
/* Fixup output directory */
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
- echo "\n<a name=\"" . str_replace($rubbish,'',$title) . "\" id=\"" . str_replace($rubbish,'',$title) . "\"></a>\n";
+ echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"" . $title . "\">\n";
echo "\t<tr><td class=\"listtopic\">" . $title . "</td></tr>\n";
echo "\t<tr>\n\t\t<td class=\"listlr\">\n\t\t\t<pre>"; /* no newline after pre */
@@ -95,7 +95,7 @@ function doCmdT($title, $command) {
$line = preg_replace("/<crypto_password>.*?<\\/crypto_password>/", "<crypto_password>xxxxx</crypto_password>", $line);
$line = preg_replace("/<crypto_password2>.*?<\\/crypto_password2>/", "<crypto_password2>xxxxx</crypto_password2>", $line);
$line = str_replace("\t", " ", $line);
- echo htmlspecialchars($line,ENT_NOQUOTES);
+ echo htmlspecialchars($line, ENT_NOQUOTES);
fwrite($ofd, $line);
}
}
@@ -110,7 +110,7 @@ function doCmdT($title, $command) {
if ($i > 0) {
echo "\n";
}
- echo htmlspecialchars($execOutput[$i],ENT_NOQUOTES);
+ echo htmlspecialchars($execOutput[$i], ENT_NOQUOTES);
fwrite($ofd, $execOutput[$i] . "\n");
}
fclose($ofd);
@@ -122,7 +122,7 @@ function doCmdT($title, $command) {
/* Define a command, with a title, to be executed later. */
function defCmdT($title, $command) {
global $commands;
- $title = htmlspecialchars($title,ENT_NOQUOTES);
+ $title = htmlspecialchars($title, ENT_NOQUOTES);
$commands[] = array($title, $command);
}
@@ -132,8 +132,8 @@ function listCmds() {
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
echo "\n<p>" . gettext("This status page includes the following information") . ":\n";
echo "<ul>\n";
- for ($i = 0; isset($commands[$i]); $i++ ) {
- echo "\t<li><strong><a href=\"#" . str_replace($rubbish,'',$commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n";
+ for ($i = 0; isset($commands[$i]); $i++) {
+ echo "\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n";
}
echo "</ul>\n";
}
@@ -141,7 +141,7 @@ function listCmds() {
/* Execute all of the commands which were defined by a call to defCmd. */
function execCmds() {
global $commands;
- for ($i = 0; isset($commands[$i]); $i++ ) {
+ for ($i = 0; isset($commands[$i]); $i++) {
doCmdT($commands[$i][0], $commands[$i][1]);
}
}
@@ -151,35 +151,35 @@ global $g, $config;
/* Set up all of the commands we want to execute. */
/* System stats/info */
-defCmdT("System uptime","/usr/bin/uptime");
-defCmdT("Interfaces","/sbin/ifconfig -a");
+defCmdT("System uptime", "/usr/bin/uptime");
+defCmdT("Interfaces", "/sbin/ifconfig -a");
defCmdT("Top Process Info", "/usr/bin/top | /usr/bin/head -n5");
-defCmdT("Processes","/bin/ps xauww");
+defCmdT("Processes", "/bin/ps xauww");
defCmdT("Mounted Filesystems", "/sbin/mount");
-defCmdT("Free Disk Space","/bin/df -hi");
-defCmdT("Routing tables","/usr/bin/netstat -nWr");
-defCmdT("Mbuf Usage","/usr/bin/netstat -mb");
+defCmdT("Free Disk Space", "/bin/df -hi");
+defCmdT("Routing tables", "/usr/bin/netstat -nWr");
+defCmdT("Mbuf Usage", "/usr/bin/netstat -mb");
defCmdT("VMStat", "/usr/bin/vmstat -afimsz");
/* Firewall rules and info */
-defCmdT("Generated Ruleset","/bin/cat {$g['tmp_path']}/rules.debug");
-defCmdT("Generated Ruleset Limiters","/bin/cat {$g['tmp_path']}/rules.limiter");
-defCmdT("Generated Ruleset Limits","/bin/cat {$g['tmp_path']}/rules.limits");
+defCmdT("Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
+defCmdT("Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
+defCmdT("Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
defCmdT("pf NAT Rules", "/sbin/pfctl -vvsn");
defCmdT("pf Firewall Rules", "/sbin/pfctl -vvsr");
-defCmdT("pf Tables","/sbin/pfctl -vs Tables");
+defCmdT("pf Tables", "/sbin/pfctl -vs Tables");
defCmdT("pf State Table Contents", "/sbin/pfctl -ss");
defCmdT("pf Info", "/sbin/pfctl -si");
defCmdT("pf Show All", "/sbin/pfctl -sa");
-defCmdT("pf Queues","/sbin/pfctl -s queue -v");
-defCmdT("pf OSFP","/sbin/pfctl -s osfp");
-defCmdT("pfsync stats","/usr/bin/netstat -s -ppfsync");
-defCmdT("pftop Default","/usr/local/sbin/pftop -a -b");
-defCmdT("pftop Long","/usr/local/sbin/pftop -w 150 -a -b -v long");
-defCmdT("pftop Queue","/usr/local/sbin/pftop -w 150 -a -b -v queue");
-defCmdT("pftop Rules","/usr/local/sbin/pftop -w 150 -a -b -v rules");
-defCmdT("pftop Size","/usr/local/sbin/pftop -w 150 -a -b -v size");
-defCmdT("pftop Speed","/usr/local/sbin/pftop -w 150 -a -b -v speed");
+defCmdT("pf Queues", "/sbin/pfctl -s queue -v");
+defCmdT("pf OSFP", "/sbin/pfctl -s osfp");
+defCmdT("pfsync stats", "/usr/bin/netstat -s -ppfsync");
+defCmdT("pftop Default", "/usr/local/sbin/pftop -a -b");
+defCmdT("pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
+defCmdT("pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
+defCmdT("pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
+defCmdT("pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
+defCmdT("pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpZone => $cpdata) {
if (isset($cpdata['enable'])) {
@@ -191,14 +191,14 @@ if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
/* Configuration Files */
defCmdT("Contents of /var/run", "/bin/ls /var/run");
defCmdT("Contents of /conf", "/bin/ls /conf");
-defCmdT("config.xml","dumpconfigxml");
-defCmdT("resolv.conf","/bin/cat /etc/resolv.conf");
-defCmdT("DHCP Configuration","/bin/cat /var/dhcpd/etc/dhcpd.conf");
-defCmdT("DHCPv6 Configuration","/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
-defCmdT("strongSwan config","/bin/cat /var/etc/ipsec/strongswan.conf");
-defCmdT("IPsec config","/bin/cat /var/etc/ipsec/ipsec.conf");
-defCmdT("SPD","/sbin/setkey -DP");
-defCmdT("SAD","/sbin/setkey -D");
+defCmdT("config.xml", "dumpconfigxml");
+defCmdT("resolv.conf", "/bin/cat /etc/resolv.conf");
+defCmdT("DHCP Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
+defCmdT("DHCPv6 Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
+defCmdT("strongSwan config", "/bin/cat /var/etc/ipsec/strongswan.conf");
+defCmdT("IPsec config", "/bin/cat /var/etc/ipsec/ipsec.conf");
+defCmdT("SPD", "/sbin/setkey -DP");
+defCmdT("SAD", "/sbin/setkey -D");
if (file_exists("/cf/conf/upgrade_log.txt")) {
defCmdT("Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
}
@@ -217,24 +217,24 @@ if (file_exists("/var/etc/apinger.conf")) {
if (file_exists("/var/etc/filterdns.conf")) {
defCmdT("Filter DNS Daemon Config", "/bin/cat /var/etc/filterdns.conf");
}
-if(isset($config['system']['usefifolog'])) {
- defCmdT("last 200 system log entries","/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 200");
- defCmdT("last 50 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50");
+if (isset($config['system']['usefifolog'])) {
+ defCmdT("last 200 system log entries", "/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 200");
+ defCmdT("last 50 filter log entries", "/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50");
} else {
- defCmdT("last 200 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200");
- defCmdT("last 50 filter log entries","/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50");
+ defCmdT("last 200 system log entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200");
+ defCmdT("last 50 filter log entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50");
}
if (file_exists("/tmp/PHP_errors.log")) {
defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
}
-defCmdT("System Message Buffer","/sbin/dmesg -a");
-defCmdT("System Message Buffer (Boot)","/bin/cat /var/log/dmesg.boot");
-defCmdT("sysctl values","/sbin/sysctl -a");
+defCmdT("System Message Buffer", "/sbin/dmesg -a");
+defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
+defCmdT("sysctl values", "/sbin/sysctl -a");
exec("/bin/date", $dateOutput, $dateStatus);
$currentDate = $dateOutput[0];
-$pgtitle = array("{$g['product_name']}","status");
+$pgtitle = array("{$g['product_name']}", "status");
include("head.inc");
?>
@@ -267,7 +267,7 @@ pre {
<?=gettext("Saving output to archive...");?>
<?php
if (is_dir($output_path)) {
- mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
+ mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
unlink_if_exists("{$output_path}/*");
@rmdir($output_path);
}
diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php
index 769b755..d88a452 100644
--- a/usr/local/www/status_captiveportal.php
+++ b/usr/local/www/status_captiveportal.php
@@ -141,7 +141,7 @@ $mac_man = load_mac_manufacturer_table();
</td>
<td class="vncell" width="30%" align="center">
<?php
- if (count($a_cp) > 1) {
+ if (count($a_cp) > 1) {
?>
<form action="status_captiveportal.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<select name="zone" class="formselect" onchange="document.form1.submit()">
diff --git a/usr/local/www/status_captiveportal_expire.php b/usr/local/www/status_captiveportal_expire.php
index c4233d9..7d786b4 100644
--- a/usr/local/www/status_captiveportal_expire.php
+++ b/usr/local/www/status_captiveportal_expire.php
@@ -109,7 +109,7 @@ if ($_POST) {
if ($_POST['vouchers']) {
$result = voucher_expire($_POST['vouchers']);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\" summary=\"results\">\n";
- if ( $result) {
+ if ($result) {
echo "<tr><td bgcolor=\"#D9DEE8\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" alt=\"pass\" /></td>";
echo "<td bgcolor=\"#D9DEE8\">Success</td></tr>";
} else {
diff --git a/usr/local/www/status_captiveportal_test.php b/usr/local/www/status_captiveportal_test.php
index d13578d..2a3dfc3 100644
--- a/usr/local/www/status_captiveportal_test.php
+++ b/usr/local/www/status_captiveportal_test.php
@@ -45,8 +45,9 @@ require("captiveportal.inc");
require_once("voucher.inc");
$cpzone = $_GET['zone'];
-if (isset($_POST['zone']))
+if (isset($_POST['zone'])) {
$cpzone = $_POST['zone'];
+}
if (empty($cpzone)) {
header("Location: services_captiveportal_zones.php");
diff --git a/usr/local/www/status_captiveportal_voucher_rolls.php b/usr/local/www/status_captiveportal_voucher_rolls.php
index feada71..512356b 100644
--- a/usr/local/www/status_captiveportal_voucher_rolls.php
+++ b/usr/local/www/status_captiveportal_voucher_rolls.php
@@ -102,9 +102,9 @@ include("head.inc");
<?php
$voucherlck = lock("vouche{$cpzone}r");
$i = 0;
- foreach($a_roll as $rollent):
+ foreach ($a_roll as $rollent):
$used = voucher_used_count($rollent['number']);
- $active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']);
+ $active = count(voucher_read_active_db($rollent['number']), $rollent['minutes']);
$ready = $rollent['count'] - $used;
/* used also count active vouchers, remove them */
$used = $used - $active;
diff --git a/usr/local/www/status_captiveportal_vouchers.php b/usr/local/www/status_captiveportal_vouchers.php
index e8cf0a8..a7ab959 100644
--- a/usr/local/www/status_captiveportal_vouchers.php
+++ b/usr/local/www/status_captiveportal_vouchers.php
@@ -73,7 +73,7 @@ $a_roll = $config['voucher'][$cpzone]['roll'];
$db = array();
-foreach($a_roll as $rollent) {
+foreach ($a_roll as $rollent) {
$roll = $rollent['number'];
$minutes = $rollent['minutes'];
@@ -83,7 +83,7 @@ foreach($a_roll as $rollent) {
$active_vouchers = file("{$g['vardb_path']}/voucher_{$cpzone}_active_$roll.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($active_vouchers as $voucher => $line) {
- list($voucher,$timestamp, $minutes) = explode(",", $line);
+ list($voucher, $timestamp, $minutes) = explode(",", $line);
$remaining = (($timestamp + 60*$minutes) - time());
if ($remaining > 0) {
$dbent[0] = $voucher;
diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php
index 7755dc5..4c37f21 100644
--- a/usr/local/www/status_dhcp_leases.php
+++ b/usr/local/www/status_dhcp_leases.php
@@ -47,7 +47,7 @@
require("guiconfig.inc");
require_once("config.inc");
-$pgtitle = array(gettext("Status"),gettext("DHCP leases"));
+$pgtitle = array(gettext("Status"), gettext("DHCP leases"));
$shortcut_section = "dhcp";
$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases";
@@ -60,7 +60,7 @@ if (($_GET['deleteip']) && (is_ipaddr($_GET['deleteip']))) {
/* $leases_contents has the lines of the file, including the newline char at the end of each line. */
$leases_contents = file($leasesfile);
$newleases_contents = array();
- $i=0;
+ $i = 0;
while ($i < count($leases_contents)) {
/* Find the lease(s) we want to delete */
if ($leases_contents[$i] == "lease {$_GET['deleteip']} {\n") {
@@ -116,12 +116,11 @@ function adjust_gmt($dt) {
return $dt;
}
-function remove_duplicate($array, $field)
-{
+function remove_duplicate($array, $field) {
foreach ($array as $sub) {
$cmp[] = $sub[$field];
}
- $unique = array_unique(array_reverse($cmp,true));
+ $unique = array_unique(array_reverse($cmp, true));
foreach ($unique as $k => $rien) {
$new[] = $array[$k];
}
@@ -141,10 +140,10 @@ exec("/usr/sbin/arp -an", $rawdata);
$arpdata_ip = array();
$arpdata_mac = array();
foreach ($rawdata as $line) {
- $elements = explode(' ',$line);
+ $elements = explode(' ', $line);
if ($elements[3] != "(incomplete)") {
$arpent = array();
- $arpdata_ip[] = trim(str_replace(array('(',')'),'',$elements[1]));
+ $arpdata_ip[] = trim(str_replace(array('(', ')'), '', $elements[1]));
$arpdata_mac[] = strtolower(trim($elements[3]));
}
}
@@ -167,7 +166,7 @@ foreach ($leases_content as $lease) {
$i++;
continue;
}
- while($f < $fcount) {
+ while ($f < $fcount) {
switch ($data[$f]) {
case "failover":
$pools[$p]['name'] = trim($data[$f+2], '"');
@@ -251,7 +250,7 @@ foreach ($leases_content as $lease) {
break;
case "client-hostname":
if ($data[$f+1] <> "") {
- $leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]);
+ $leases[$l]['hostname'] = preg_replace('/"/', '', $data[$f+1]);
} else {
$hostname = gethostbyaddr($leases[$l]['ip']);
if ($hostname <> "") {
@@ -276,11 +275,11 @@ unset($lease_content);
/* remove duplicate items by mac address */
if (count($leases) > 0) {
- $leases = remove_duplicate($leases,"ip");
+ $leases = remove_duplicate($leases, "ip");
}
if (count($pools) > 0) {
- $pools = remove_duplicate($pools,"name");
+ $pools = remove_duplicate($pools, "name");
asort($pools);
}
@@ -405,7 +404,7 @@ foreach ($leases as $data) {
echo "<td class=\"listr\">{$fspans}{$data['mac']}{$fspane}</td>\n";
}
}
- echo "<td class=\"listr\">{$fspans}" . htmlentities($data['hostname']) . "{$fspane}</td>\n";
+ echo "<td class=\"listr\">{$fspans}" . htmlentities($data['hostname']) . "{$fspane}</td>\n";
if ($data['type'] != "static") {
echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php
index c82a93a..63f1946 100644
--- a/usr/local/www/status_dhcpv6_leases.php
+++ b/usr/local/www/status_dhcpv6_leases.php
@@ -48,7 +48,7 @@
require("guiconfig.inc");
require_once("config.inc");
-$pgtitle = array(gettext("Status"),gettext("DHCPv6 leases"));
+$pgtitle = array(gettext("Status"), gettext("DHCPv6 leases"));
$shortcut_section = "dhcp6";
$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases";
@@ -60,7 +60,7 @@ if (($_GET['deleteip']) && (is_ipaddr($_GET['deleteip']))) {
/* Read existing leases */
$leases_contents = explode("\n", file_get_contents($leasesfile));
$newleases_contents = array();
- $i=0;
+ $i = 0;
while ($i < count($leases_contents)) {
/* Find the lease(s) we want to delete */
if ($leases_contents[$i] == " iaaddr {$_GET['deleteip']} {") {
@@ -134,7 +134,7 @@ function remove_duplicate($array, $field) {
foreach ($array as $sub) {
$cmp[] = $sub[$field];
}
- $unique = array_unique(array_reverse($cmp,true));
+ $unique = array_unique(array_reverse($cmp, true));
foreach ($unique as $k => $rien) {
$new[] = $array[$k];
}
@@ -143,7 +143,7 @@ function remove_duplicate($array, $field) {
function parse_duid($duid_string) {
$parsed_duid = array();
- for ($i=0; $i < strlen($duid_string); $i++) {
+ for ($i = 0; $i < strlen($duid_string); $i++) {
$s = substr($duid_string, $i, 1);
if ($s == '\\') {
$n = substr($duid_string, $i+1, 1);
@@ -175,10 +175,10 @@ $leases_count = count($leases_content);
exec("/usr/sbin/ndp -an", $rawdata);
$ndpdata = array();
foreach ($rawdata as $line) {
- $elements = preg_split('/\s+/ ',$line);
+ $elements = preg_split('/\s+/ ', $line);
if ($elements[1] != "(incomplete)") {
$ndpent = array();
- $ip = trim(str_replace(array('(',')'),'',$elements[0]));
+ $ip = trim(str_replace(array('(', ')'), '', $elements[0]));
$ndpent['mac'] = trim($elements[1]);
$ndpent['interface'] = trim($elements[2]);
$ndpdata[$ip] = $ndpent;
@@ -194,7 +194,7 @@ $l = 0;
$p = 0;
// Put everything together again
-while($i < $leases_count) {
+while ($i < $leases_count) {
$entry = array();
/* split the line by space */
$duid_split = array();
@@ -215,7 +215,7 @@ while($i < $leases_count) {
$i++;
continue;
}
- while($f < $fcount) {
+ while ($f < $fcount) {
switch ($data[$f]) {
case "failover":
$pools[$p]['name'] = $data[$f+2];
@@ -315,7 +315,7 @@ while($i < $leases_count) {
break;
case "client-hostname":
if ($data[$f+1] <> "") {
- $entry['hostname'] = preg_replace('/"/','',$data[$f+1]);
+ $entry['hostname'] = preg_replace('/"/', '', $data[$f+1]);
} else {
$hostname = gethostbyaddr($entry['ip']);
if ($hostname <> "") {
@@ -342,15 +342,15 @@ while($i < $leases_count) {
}
if (count($leases) > 0) {
- $leases = remove_duplicate($leases,"ip");
+ $leases = remove_duplicate($leases, "ip");
}
if (count($prefixes) > 0) {
- $prefixes = remove_duplicate($prefixes,"prefix");
+ $prefixes = remove_duplicate($prefixes, "prefix");
}
if (count($pools) > 0) {
- $pools = remove_duplicate($pools,"name");
+ $pools = remove_duplicate($pools, "name");
asort($pools);
}
diff --git a/usr/local/www/status_filter_reload.php b/usr/local/www/status_filter_reload.php
index bd8a573..8844a48 100644
--- a/usr/local/www/status_filter_reload.php
+++ b/usr/local/www/status_filter_reload.php
@@ -42,7 +42,7 @@ require_once("globals.inc");
require_once("guiconfig.inc");
require_once("functions.inc");
-$pgtitle = array(gettext("Status"),gettext("Filter Reload Status"));
+$pgtitle = array(gettext("Status"), gettext("Filter Reload Status"));
$shortcut_section = "firewall";
if (file_exists("{$g['varrun_path']}/filter_reload_status")) {
@@ -100,8 +100,8 @@ function update_data(obj) {
var result_text = obj.content;
var result_text_split = result_text.split("|");
result_text = result_text_split[1];
- result_text = result_text.replace("\n","");
- result_text = result_text.replace("\r","");
+ result_text = result_text.replace("\n", "");
+ result_text = result_text.replace("\r", "");
if (result_text) {
jQuery('#status').html('<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /> ' + result_text + '...');
} else {
@@ -112,8 +112,8 @@ function update_data(obj) {
} else if (result_text == "Done") {
jQuery('#status').effect('highlight');
jQuery('#status').html('Done. The filter rules have been reloaded.');
- jQuery('#reloadinfo').css("visibility","hidden");
- jQuery('#doneurl').css("visibility","visible");
+ jQuery('#reloadinfo').css("visibility", "hidden");
+ jQuery('#doneurl').css("visibility", "visible");
jQuery('#doneurl').html("<p><a href='status_queues.php'>Queue Status<\/a><\/p>");
}
window.setTimeout('update_status_thread()', 2500);
diff --git a/usr/local/www/status_gateway_groups.php b/usr/local/www/status_gateway_groups.php
index 1d6e9b5..e9011c8 100755
--- a/usr/local/www/status_gateway_groups.php
+++ b/usr/local/www/status_gateway_groups.php
@@ -51,7 +51,7 @@ $changedesc = gettext("Gateway Groups") . ": ";
$gateways_status = return_gateways_status();
-$pgtitle = array(gettext("Status"),gettext("Gateway Groups"));
+$pgtitle = array(gettext("Status"), gettext("Gateway Groups"));
$shortcut_section = "gateway-groups";
include("head.inc");
diff --git a/usr/local/www/status_gateways.php b/usr/local/www/status_gateways.php
index 1d77689..e6fcf9d 100644
--- a/usr/local/www/status_gateways.php
+++ b/usr/local/www/status_gateways.php
@@ -49,7 +49,7 @@ $gateways_status = return_gateways_status(true);
$now = time();
$year = date("Y");
-$pgtitle = array(gettext("Status"),gettext("Gateways"));
+$pgtitle = array(gettext("Status"), gettext("Gateways"));
$shortcut_section = "gateways";
include("head.inc");
diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php
index d5d5253..056c297 100644
--- a/usr/local/www/status_graph.php
+++ b/usr/local/www/status_graph.php
@@ -78,7 +78,7 @@ foreach (array('server', 'client') as $mode) {
if ($_GET['if']) {
$curif = $_GET['if'];
$found = false;
- foreach($ifdescrs as $descr => $ifdescr) {
+ foreach ($ifdescrs as $descr => $ifdescr) {
if ($descr == $curif) {
$found = true;
break;
@@ -113,7 +113,7 @@ if ($_GET['hostipformat']) {
$curhostipformat = "";
}
-$pgtitle = array(gettext("Status"),gettext("Traffic Graph"));
+$pgtitle = array(gettext("Status"), gettext("Traffic Graph"));
include("head.inc");
@@ -158,7 +158,7 @@ function updateBandwidthHosts(data) {
var hosts_split = data.split("|");
d = document;
//parse top ten bandwidth abuser hosts
- for (var y=0; y<10; y++) {
+ for (var y = 0; y < 10; y++) {
if ((y < hosts_split.length) && (hosts_split[y] != "") && (hosts_split[y] != "no info")) {
hostinfo = hosts_split[y].split(";");
@@ -251,7 +251,7 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enabl
<div id="col2" style="float: right; width: 48%; padding: 5px; position: relative;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="status">
<tr>
- <td class="listtopic" valign="top"><?=(($curhostipformat=="") ? gettext("Host IP") : gettext("Host Name or IP")); ?></td>
+ <td class="listtopic" valign="top"><?=(($curhostipformat == "") ? gettext("Host IP") : gettext("Host Name or IP")); ?></td>
<td class="listtopic" valign="top"><?=gettext("Bandwidth In"); ?></td>
<td class="listtopic" valign="top"><?=gettext("Bandwidth Out"); ?></td>
</tr>
diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php
index 190765f..67ab96f 100644
--- a/usr/local/www/status_interfaces.php
+++ b/usr/local/www/status_interfaces.php
@@ -58,7 +58,7 @@ if ($_POST['if'] && $_POST['submit']) {
exit;
}
-$pgtitle = array(gettext("Status"),gettext("Interfaces"));
+$pgtitle = array(gettext("Status"), gettext("Interfaces"));
$shortcut_section = "interfaces";
include("head.inc");
@@ -556,7 +556,7 @@ include("head.inc");
if ($ifinfo['bridge']):
?>
<tr>
- <td width="22%" class="vncellt"><?php printf(gettext("Bridge (%s)"),$ifinfo['bridgeint']);?></td>
+ <td width="22%" class="vncellt"><?php printf(gettext("Bridge (%s)"), $ifinfo['bridgeint']);?></td>
<td width="78%" class="listr">
<?=$ifinfo['bridge'];?>
</td>
@@ -600,7 +600,7 @@ include("head.inc");
"triggers it. To substantiate this point: disconnecting manually ".
"will %snot%s prevent dial-on-demand from making connections ".
"to the outside! Don't use dial-on-demand if you want to make sure that the line ".
-"is kept disconnected."),'<strong>','</strong>')?>
+"is kept disconnected."), '<strong>', '</strong>')?>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php
index d5b277d..984ab9e 100644
--- a/usr/local/www/status_lb_pool.php
+++ b/usr/local/www/status_lb_pool.php
@@ -56,7 +56,7 @@ $lb_logfile = "{$g['varlog_path']}/relayd.log";
$now = time();
$year = date("Y");
-$pgtitle = array(gettext("Status"),gettext("Load Balancer"),gettext("Pool"));
+$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Pool"));
$shortcut_section = "relayd";
include("head.inc");
@@ -154,23 +154,23 @@ if ($_POST) {
<td class="listr" align="center">
<table border="0" cellpadding="2" cellspacing="0" summary="status">
<?php
- $pool_hosts=array();
+ $pool_hosts = array();
foreach ((array) $pool['servers'] as $server) {
- $svr['ip']['addr']=$server;
- $svr['ip']['state']=$relay_hosts[$pool['name'].":".$pool['port']][$server]['state'];
- $svr['ip']['avail']=$relay_hosts[$pool['name'].":".$pool['port']][$server]['avail'];
+ $svr['ip']['addr'] = $server;
+ $svr['ip']['state'] = $relay_hosts[$pool['name'] . ":" . $pool['port']][$server]['state'];
+ $svr['ip']['avail'] = $relay_hosts[$pool['name'] . ":" . $pool['port']][$server]['avail'];
$pool_hosts[]=$svr;
}
foreach ((array) $pool['serversdisabled'] as $server) {
- $svr['ip']['addr']="$server";
- $svr['ip']['state']='disabled';
- $svr['ip']['avail']='disabled';
+ $svr['ip']['addr'] = "$server";
+ $svr['ip']['state'] = 'disabled';
+ $svr['ip']['avail'] = 'disabled';
$pool_hosts[]=$svr;
}
asort($pool_hosts);
foreach ((array) $pool_hosts as $server) {
- if ($server['ip']['addr']!="") {
+ if ($server['ip']['addr'] != "") {
switch ($server['ip']['state']) {
case 'up':
$bgcolor = "#90EE90"; // lightgreen
diff --git a/usr/local/www/status_lb_vs.php b/usr/local/www/status_lb_vs.php
index 07c1736..0d0bd60 100644
--- a/usr/local/www/status_lb_vs.php
+++ b/usr/local/www/status_lb_vs.php
@@ -54,7 +54,7 @@ $a_vs = &$config['load_balancer']['virtual_server'];
$a_pool = &$config['load_balancer']['lbpool'];
$rdr_a = get_lb_redirects();
-$pgtitle = array(gettext("Status"),gettext("Load Balancer"),gettext("Virtual Server"));
+$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Virtual Server"));
include("head.inc");
?>
diff --git a/usr/local/www/status_ntpd.php b/usr/local/www/status_ntpd.php
index 44c9733..329764b 100644
--- a/usr/local/www/status_ntpd.php
+++ b/usr/local/www/status_ntpd.php
@@ -108,7 +108,7 @@ if (!isset($config['ntpd']['noquery'])) {
$tmp = $tmp[1];
if (substr($tmp, 0, 6) == '$GPRMC') {
$gps_vars = explode(",", $tmp);
- $gps_ok = ($gps_vars[2] == "A");
+ $gps_ok = ($gps_vars[2] == "A");
$gps_lat_deg = substr($gps_vars[3], 0, 2);
$gps_lat_min = substr($gps_vars[3], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[5], 0, 3);
@@ -119,7 +119,7 @@ if (!isset($config['ntpd']['noquery'])) {
$gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1);
} elseif (substr($tmp, 0, 6) == '$GPGGA') {
$gps_vars = explode(",", $tmp);
- $gps_ok = $gps_vars[6];
+ $gps_ok = $gps_vars[6];
$gps_lat_deg = substr($gps_vars[2], 0, 2);
$gps_lat_min = substr($gps_vars[2], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[4], 0, 3);
@@ -133,7 +133,7 @@ if (!isset($config['ntpd']['noquery'])) {
$gps_sat = $gps_vars[7];
} elseif (substr($tmp, 0, 6) == '$GPGLL') {
$gps_vars = explode(",", $tmp);
- $gps_ok = ($gps_vars[6] == "A");
+ $gps_ok = ($gps_vars[6] == "A");
$gps_lat_deg = substr($gps_vars[1], 0, 2);
$gps_lat_min = substr($gps_vars[1], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[3], 0, 3);
@@ -153,16 +153,16 @@ if (isset($config['ntpd']['gps']['type']) && ($config['ntpd']['gps']['type'] ==
$gpsport = fopen("/dev/gps0", "r+");
while ($gpsport) {
$buffer = fgets($gpsport);
- if (substr($buffer, 0, 6)=='$GPGSV') {
+ if (substr($buffer, 0, 6) == '$GPGSV') {
//echo $buffer."\n";
- $gpgsv = explode(',',$buffer);
+ $gpgsv = explode(',', $buffer);
$gps_satview = $gpgsv[3];
break;
}
}
}
-$pgtitle = array(gettext("Status"),gettext("NTP"));
+$pgtitle = array(gettext("Status"), gettext("NTP"));
$shortcut_section = "ntp";
include("head.inc");
?>
diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php
index 0b0e92d..e9d2073 100644
--- a/usr/local/www/status_openvpn.php
+++ b/usr/local/www/status_openvpn.php
@@ -115,10 +115,10 @@ include("head.inc"); ?>
<script type="text/javascript">
//<![CDATA[
function killClient(mport, remipp) {
- var busy = function(index,icon) {
- jQuery(icon).bind("onclick","");
- jQuery(icon).attr('src',jQuery(icon).attr('src').replace("\.gif", "_d.gif"));
- jQuery(icon).css("cursor","wait");
+ var busy = function(index, icon) {
+ jQuery(icon).bind("onclick", "");
+ jQuery(icon).attr('src', jQuery(icon).attr('src').replace("\.gif", "_d.gif"));
+ jQuery(icon).css("cursor", "wait");
}
jQuery('img[name="i:' + mport + ":" + remipp + '"]').each(busy);
@@ -138,7 +138,7 @@ include("head.inc"); ?>
}
jQuery('tr[name="r:' + values[1] + ":" + values[2] + '"]').each(
- function(index,row) { jQuery(row).fadeOut(1000); }
+ function(index, row) { jQuery(row).fadeOut(1000); }
);
}
//]]>
@@ -219,7 +219,7 @@ include("head.inc"); ?>
if (is_array($server['routes']) && count($server['routes'])):
?>
<div id="shroutebut-<?= $i ?>">
- <input type="button" onClick="show_routes('tabroute-<?= $i ?>','shroutebut-<?= $i ?>')" value="<?php echo gettext("Show Routing Table"); ?>" /> - <?= gettext("Display OpenVPN's internal routing table for this server.") ?>
+ <input type="button" onClick="show_routes('tabroute-<?= $i ?>', 'shroutebut-<?= $i ?>')" value="<?php echo gettext("Show Routing Table"); ?>" /> - <?= gettext("Display OpenVPN's internal routing table for this server.") ?>
<br /><br />
</div>
<table style="display: none; padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0" id="tabroute-<?= $i ?>" summary="routing table">
diff --git a/usr/local/www/status_queues.php b/usr/local/www/status_queues.php
index 1f5e45d..42789bf 100644
--- a/usr/local/www/status_queues.php
+++ b/usr/local/www/status_queues.php
@@ -68,7 +68,7 @@ if (!$fd) {
$error = "Something wrong happened during communication with stat gathering";
} else {
$stats = "";
- while(!feof($fd)) {
+ while (!feof($fd)) {
$stats .= fread($fd, 4096);
}
fclose($fd);
@@ -87,16 +87,13 @@ if ($_REQUEST['getactivity']) {
statsQueues($q);
}
/* calculate the bigger amount of packets or bandwidth being moved through all queues. */
- if ($stat_type == "0")
- {
+ if ($stat_type == "0") {
foreach ($statistics as $q) {
if ($bigger_stat < $q->pps) {
$bigger_stat = $q->pps;
}
}
- }
- else
- {
+ } else {
foreach ($statistics as $q) {
if ($bigger_stat < $q->bandwidth) {
$bigger_stat = $q->bandwidth;
@@ -115,7 +112,7 @@ if ($_REQUEST['getactivity']) {
}
$finscript .= "jQuery('#queue{$q->queuename}widthb').width('{$packet_s}');";
$finscript .= "jQuery('#queue{$q->queuename}widtha').width('" . (150 - $packet_s) . "');";
- $finscript .= "jQuery('#queue{$q->queuename}pps').val('" . number_format($q->pps,1) . "');";
+ $finscript .= "jQuery('#queue{$q->queuename}pps').val('" . number_format($q->pps, 1) . "');";
$finscript .= "jQuery('#queue{$q->queuename}bps').val('" . format_bits($q->bandwidth) . "');";
$finscript .= "jQuery('#queue{$q->queuename}borrows').val('{$q->borrows}');";
$finscript .= "jQuery('#queue{$q->queuename}suspends').val('{$q->suspends}');";
@@ -127,7 +124,7 @@ if ($_REQUEST['getactivity']) {
echo $finscript;
exit;
}
-$pgtitle = array(gettext("Status"),gettext("Traffic shaper"),gettext("Queues"));
+$pgtitle = array(gettext("Status"), gettext("Traffic shaper"), gettext("Queues"));
$shortcut_section = "trafficshaper";
include("head.inc");
?>
@@ -187,7 +184,7 @@ if (!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) <
</tr>
<?php
$if_queue_list = get_configured_interface_list_by_realif(false, true);
- processQueues($altqstats, 0, "")
+ processQueues($altqstats, 0, "");
?>
<?php endif; ?>
</table>
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php
index 94111bc..ae9c709 100644
--- a/usr/local/www/status_rrd_graph.php
+++ b/usr/local/www/status_rrd_graph.php
@@ -47,7 +47,7 @@ require_once("rrd.inc");
unset($input_errors);
/* if the rrd graphs are not enabled redirect to settings page */
-if (! isset($config['rrd']['enable'])) {
+if (!isset($config['rrd']['enable'])) {
header("Location: status_rrd_graph_settings.php");
}
@@ -59,7 +59,7 @@ $databases = glob("*.rrd");
if ($_GET['cat']) {
$curcat = htmlspecialchars($_GET['cat']);
} else {
- if (! empty($config['rrd']['category'])) {
+ if (!empty($config['rrd']['category'])) {
$curcat = $config['rrd']['category'];
} else {
$curcat = "system";
@@ -75,7 +75,7 @@ if ($_GET['zone']) {
if ($_GET['period']) {
$curperiod = $_GET['period'];
} else {
- if (! empty($config['rrd']['period'])) {
+ if (!empty($config['rrd']['period'])) {
$curperiod = $config['rrd']['period'];
} else {
$curperiod = "absolute";
@@ -193,12 +193,13 @@ $styles = array('inverse' => gettext('Inverse'),
$curstyle = "inverse";
if ($_GET['style']) {
- foreach ($styles as $style)
+ foreach ($styles as $style) {
if (strtoupper($style) == strtoupper($_GET['style'])) {
$curstyle = $_GET['style'];
}
+ }
} else {
- if (! empty($config['rrd']['style'])) {
+ if (!empty($config['rrd']['style'])) {
$curstyle = $config['rrd']['style'];
} else {
$curstyle = "inverse";
@@ -259,7 +260,7 @@ $graph_length = array(
"year" => 31622400,
"fouryear" => 126230400);
-$pgtitle = array(gettext("Status"),gettext("RRD Graphs"));
+$pgtitle = array(gettext("Status"), gettext("RRD Graphs"));
$closehead = false;
@@ -558,7 +559,7 @@ function get_dates($curperiod, $graph) {
}
}
foreach ($ui_databases as $db => $database) {
- if (! preg_match("/($curcat)/i", $database)) {
+ if (!preg_match("/($curcat)/i", $database)) {
continue;
}
@@ -669,7 +670,7 @@ function get_dates($curperiod, $graph) {
foreach ($graphs as $graph) {
/* check which databases are valid for our category */
foreach ($ui_databases as $curdatabase) {
- if (! preg_match("/($curcat)/i", $curdatabase)) {
+ if (!preg_match("/($curcat)/i", $curdatabase)) {
continue;
}
@@ -707,7 +708,7 @@ function get_dates($curperiod, $graph) {
continue 2;
}
}
- if (! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
@@ -719,7 +720,7 @@ function get_dates($curperiod, $graph) {
break;
default:
/* just use the name here */
- if (! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
@@ -752,7 +753,7 @@ function get_dates($curperiod, $graph) {
foreach ($graphs as $graph) {
/* check which databases are valid for our category */
foreach ($ui_databases as $curdatabase) {
- if (! stristr($curdatabase, $curcat)) {
+ if (!stristr($curdatabase, $curcat)) {
continue;
}
$optionc = explode("-", $curdatabase);
@@ -785,7 +786,7 @@ function get_dates($curperiod, $graph) {
continue 2;
}
}
- if (! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
@@ -797,7 +798,7 @@ function get_dates($curperiod, $graph) {
break;
default:
/* just use the name here */
- if (! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
+ if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php
index 6d7c7eb..d28472f 100644
--- a/usr/local/www/status_rrd_graph_img.php
+++ b/usr/local/www/status_rrd_graph_img.php
@@ -41,7 +41,7 @@ require_once("rrd.inc");
global $g;
-$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
+$pgtitle = array(gettext("System"), gettext("RRD Graphs"), gettext("Image viewer"));
if ($_GET['database']) {
$curdatabase = basename($_GET['database']);
@@ -218,32 +218,32 @@ $colorpacketsdown = array('990000', 'CC0000', 'FFC875', 'FF9900');
$colortraffic95 = array('660000', 'FF0000');
/* State Table pfrate, pfstates, pfnat, srcip, dstip */
-$colorstates = array('00AA00','990000','0000FF','000000','DD9B00');
+$colorstates = array('00AA00', '990000', '0000FF', '000000', 'DD9B00');
/* Processor Usage user, nice, system, int, processes */
-$colorprocessor = array('00AA00','990000','0000FF','DD9B00','000000');
+$colorprocessor = array('00AA00', '990000', '0000FF', 'DD9B00', '000000');
/* Memory Usage active, inact, free, cache, wire */
-$colormemory = array('00AA00','990000','0000FF','666666','DD9B00');
+$colormemory = array('00AA00', '990000', '0000FF', '666666', 'DD9B00');
/* MBUF Usage current, cache, total, max */
-$colormbuf = array('0080FF','00E344','FF0000','000000');
+$colormbuf = array('0080FF', '00E344', 'FF0000', '000000');
/* Traffic Shaper Queues q1, q2, q3, q4, q5, q6, q7, q8, q9 */
-$colorqueuesup = array('000000','7B0000','0080FF','00E344','FF0000','2217AA','FFC875','FF9900','CC0000');
-$colorqueuesdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC');
+$colorqueuesup = array('000000', '7B0000', '0080FF', '00E344', 'FF0000', '2217AA', 'FFC875', 'FF9900', 'CC0000');
+$colorqueuesdown = array('000000', '7B7B7B', '999999', 'BBBBBB', 'CCCCCC', 'D9D9D9', 'EEEEEE', 'FFFFFF', 'CCCCCC');
-$colorqueuesdropup = array('000000','7B0000','0080FF','00E344','FF0000','2217AA','FFC875','FF9900','CC0000');
-$colorqueuesdropdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC');
+$colorqueuesdropup = array('000000', '7B0000', '0080FF', '00E344', 'FF0000', '2217AA', 'FFC875', 'FF9900', 'CC0000');
+$colorqueuesdropdown = array('000000', '7B7B7B', '999999', 'BBBBBB', 'CCCCCC', 'D9D9D9', 'EEEEEE', 'FFFFFF', 'CCCCCC');
/* Quality Graph Delay >420, 180-420, 60-180, 20-60, <20, Delay Avg */
-$colorqualityrtt = array('990000','a83c3c','b36666','bd9090','cccccc','000000');
+$colorqualityrtt = array('990000', 'a83c3c', 'b36666', 'bd9090', 'cccccc', '000000');
/* Quality Graph Loss */
$colorqualityloss = 'ee0000';
/* Wireless Graph SNR, Rate, Channel*/
/* Cellular Graph RSSI, */
-$colorwireless = array('333333','a83c3c','999999');
+$colorwireless = array('333333', 'a83c3c', '999999');
/* SPAMD Times min area, avg area, max area, Time line */
$colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066');
@@ -254,7 +254,7 @@ $colorspamdconn = array('AA00BB', 'FFFFFF', '660088', 'FFFF88', '006600');
$colorvpnusers = array('990000');
/* NTPD stats offset, clk jit, sys jit, wander */
-$colorntpd = array('0080FF','00E344','FF0000','000000');
+$colorntpd = array('0080FF', '00E344', 'FF0000', '000000');
/* Captive Portal Total Users Total Users */
/* Captive Portal Concurrent Concurrent Users */
@@ -265,7 +265,7 @@ $rrdcolors = "{$g['www_path']}/themes/{$g['theme']}/rrdcolors.inc.php";
if (file_exists($rrdcolors)) {
include($rrdcolors);
} else {
- log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme']));
+ log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"), $g['theme']));
}
switch ($curstyle) {
@@ -1240,17 +1240,17 @@ if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
usleep(500);
}
}
-if (($graphcmdreturn <> 0) || (! $data)) {
- log_error(sprintf(gettext('Failed to create graph with error code %1$s, the error is: %2$s'),$graphcmdreturn,$graphcmdoutput));
+if (($graphcmdreturn <> 0) || (!$data)) {
+ log_error(sprintf(gettext('Failed to create graph with error code %1$s, the error is: %2$s'), $graphcmdreturn, $graphcmdoutput));
if (strstr($curdatabase, "queues")) {
- log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
+ log_error(sprintf(gettext("failed to create graph from %s%s, removing database"), $rrddbpath, $curdatabase));
unlink_if_exists($rrddbpath . $curif . $queues);
flush();
usleep(500);
enable_rrd_graphing();
}
if (strstr($curdatabase, "queuesdrop")) {
- log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
+ log_error(sprintf(gettext("failed to create graph from %s%s, removing database"), $rrddbpath, $curdatabase));
unlink_if_exists($rrddbpath . $curdatabase);
flush();
usleep(500);
diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php
index ef35951..ede9f41 100644
--- a/usr/local/www/status_rrd_graph_settings.php
+++ b/usr/local/www/status_rrd_graph_settings.php
@@ -115,7 +115,7 @@ foreach ($databases as $database) {
}
}
-$pgtitle = array(gettext("Status"),gettext("RRD Graphs"));
+$pgtitle = array(gettext("Status"), gettext("RRD Graphs"));
include("head.inc");
?>
diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php
index e4402da..ac13b32 100755
--- a/usr/local/www/status_services.php
+++ b/usr/local/www/status_services.php
@@ -67,7 +67,7 @@ if ($_GET['batch']) {
exit;
}
-$pgtitle = array(gettext("Status"),gettext("Services"));
+$pgtitle = array(gettext("Status"), gettext("Services"));
include("head.inc");
?>
diff --git a/usr/local/www/status_upnp.php b/usr/local/www/status_upnp.php
index 296e384..62349df 100644
--- a/usr/local/www/status_upnp.php
+++ b/usr/local/www/status_upnp.php
@@ -56,7 +56,7 @@ exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
$now = time();
$year = date("Y");
-$pgtitle = array(gettext("Status"),gettext("UPnP &amp; NAT-PMP Status"));
+$pgtitle = array(gettext("Status"), gettext("UPnP &amp; NAT-PMP Status"));
$shortcut_section = "upnp";
include("head.inc");
?>
diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php
index d15cfed..be51458 100644
--- a/usr/local/www/status_wireless.php
+++ b/usr/local/www/status_wireless.php
@@ -39,7 +39,7 @@
require_once("guiconfig.inc");
-$pgtitle = array(gettext("Status"),gettext("Wireless"));
+$pgtitle = array(gettext("Status"), gettext("Wireless"));
$shortcut_section = "wireless";
include("head.inc");
@@ -114,7 +114,7 @@ include("fbegin.inc");
/* Skip Header */
array_shift($states);
- $counter=0;
+ $counter = 0;
foreach ($states as $state) {
/* Split by Mac address for the SSID Field */
$split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state);
@@ -165,7 +165,7 @@ include("fbegin.inc");
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
array_shift($states);
- $counter=0;
+ $counter = 0;
foreach ($states as $state) {
$split = preg_split("/[ ]+/i", $state);
/* Split the rest by using spaces for this line using the 2nd part */
diff --git a/usr/local/www/system_advanced_admin.php b/usr/local/www/system_advanced_admin.php
index f970822..99588c2 100644
--- a/usr/local/www/system_advanced_admin.php
+++ b/usr/local/www/system_advanced_admin.php
@@ -545,7 +545,7 @@ function prot_change() {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("SSH port"); ?></td>
<td width="78%" class="vtable">
- <input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" />
+ <input name="sshport" type="text" id="sshport" value="<?php echo htmlspecialchars($pconfig['sshport']); ?>" />
<br />
<span class="vexpl"><?=gettext("Note: Leave this blank for the default of 22."); ?></span>
</td>
@@ -585,8 +585,8 @@ function prot_change() {
<td width="22%" valign="top" class="vncell"><?=gettext("Primary Console")?></td>
<td width="78%" class="vtable">
<select name="primaryconsole" id="primaryconsole" class="formselect">
- <option value="serial" <?php if ($pconfig['primaryconsole'] == "serial") echo "selected=\"selected\"";?>>Serial Console</option>
- <option value="video" <?php if ($pconfig['primaryconsole'] == "video") echo "selected=\"selected\"";?>>VGA Console</option>
+ <option value="serial" <?php if ($pconfig['primaryconsole'] == "serial") echo "selected=\"selected\"";?>>Serial Console</option>
+ <option value="video" <?php if ($pconfig['primaryconsole'] == "video") echo "selected=\"selected\"";?>>VGA Console</option>
</select>
<br /><?=gettext("Select the preferred console if multiple consoles are present. The preferred console will show pfSense boot script output. All consoles display OS boot messages, console messages, and the console menu."); ?>
</td>
@@ -601,7 +601,7 @@ function prot_change() {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Console menu"); ?></td>
<td width="78%" class="vtable">
- <input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked=\"checked\""; ?> />
+ <input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Password protect the console menu"); ?></strong>
</td>
</tr>
diff --git a/usr/local/www/system_advanced_firewall.php b/usr/local/www/system_advanced_firewall.php
index bcfe339..fc6b0ed 100644
--- a/usr/local/www/system_advanced_firewall.php
+++ b/usr/local/www/system_advanced_firewall.php
@@ -61,6 +61,7 @@ $pconfig['aliasesresolveinterval'] = $config['system']['aliasesresolveinterval']
$old_aliasesresolveinterval = $config['system']['aliasesresolveinterval'];
$pconfig['checkaliasesurlcert'] = isset($config['system']['checkaliasesurlcert']);
$pconfig['maximumtableentries'] = $config['system']['maximumtableentries'];
+$pconfig['maximumfrags'] = $config['system']['maximumfrags'];
$pconfig['disablereplyto'] = isset($config['system']['disablereplyto']);
$pconfig['disablenegate'] = isset($config['system']['disablenegate']);
$pconfig['bogonsinterval'] = $config['system']['bogons']['interval'];
@@ -110,6 +111,9 @@ if ($_POST) {
if ($_POST['maximumtableentries'] && !is_numericint($_POST['maximumtableentries'])) {
$input_errors[] = gettext("The Firewall Maximum Table Entries value must be an integer.");
}
+ if ($_POST['maximumfrags'] && !is_numericint($_POST['maximumfrags'])) {
+ $input_errors[] = gettext("The Firewall Maximum Fragment Entries value must be an integer.");
+ }
if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
$input_errors[] = gettext("The TCP idle timeout must be an integer.");
}
@@ -214,6 +218,7 @@ if ($_POST) {
$config['system']['maximumstates'] = $_POST['maximumstates'];
$config['system']['aliasesresolveinterval'] = $_POST['aliasesresolveinterval'];
$config['system']['maximumtableentries'] = $_POST['maximumtableentries'];
+ $config['system']['maximumfrags'] = $_POST['maximumfrags'];
if (!empty($_POST['tcpfirsttimeout'])) {
$config['system']['tcpfirsttimeout'] = $_POST['tcpfirsttimeout'];
@@ -506,11 +511,11 @@ function update_description(itemnum) {
<td width="78%" class="vtable">
<strong><?=gettext("Timeouts for states can be scaled adaptively as the number of state table entries grows.");?></strong>
<br />
- <input name="adaptivestart" type="text" id="adaptivestart" value="<?php echo $pconfig['adaptivestart']; ?>" />
+ <input name="adaptivestart" type="text" id="adaptivestart" value="<?php echo htmlspecialchars($pconfig['adaptivestart']); ?>" />
<br /><?=gettext("When the number of state entries exceeds this value, adaptive scaling begins. All timeout values are scaled linearly with factor (adaptive.end - number of states) / (adaptive.end - adaptive.start).");?>
<br />
- <input name="adaptiveend" type="text" id="adaptiveend" value="<?php echo $pconfig['adaptiveend']; ?>" />
+ <input name="adaptiveend" type="text" id="adaptiveend" value="<?php echo htmlspecialchars($pconfig['adaptiveend']); ?>" />
<br /><?=gettext("When reaching this number of state entries, all timeout values become zero, effectively purging all state entries immediately. This value is used to define the scale factor, it should not actually be reached (set a lower state limit, see below).");?>
<br />
<span class="vexpl"><?=gettext("Note: Leave this blank for the default, which auto-calculates these values from your maximum state table size. Adaptive start is 60% and end is 120% of the state table size by default.");?></span>
@@ -519,7 +524,7 @@ function update_description(itemnum) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Maximum States");?></td>
<td width="78%" class="vtable">
- <input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" />
+ <input name="maximumstates" type="text" id="maximumstates" value="<?php echo htmlspecialchars($pconfig['maximumstates']); ?>" />
<br />
<strong><?=gettext("Maximum number of connections to hold in the firewall state table.");?></strong>
<br />
@@ -529,7 +534,7 @@ function update_description(itemnum) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Maximum Table Entries");?></td>
<td width="78%" class="vtable">
- <input name="maximumtableentries" type="text" id="maximumtableentries" value="<?php echo $pconfig['maximumtableentries']; ?>" />
+ <input name="maximumtableentries" type="text" id="maximumtableentries" value="<?php echo htmlspecialchars($pconfig['maximumtableentries']); ?>" />
<br />
<strong><?=gettext("Maximum number of table entries for systems such as aliases, sshlockout, snort, etc, combined.");?></strong>
<br />
@@ -542,6 +547,18 @@ function update_description(itemnum) {
</td>
</tr>
<tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Firewall Maximum Fragment Entries");?></td>
+ <td width="78%" class="vtable">
+ <input name="maximumfrags" type="text" id="maximumfrags" value="<?php echo htmlspecialchars($pconfig['maximumfrags']); ?>" />
+ <br />
+ <strong><?=gettext("Maximum number of packet fragments to hold for reassembly by scrub rules.");?></strong>
+ <br />
+ <span class="vexpl">
+ <?=gettext("Note: Leave this blank for the default (5000).");?>
+ </span>
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Static route filtering");?></td>
<td width="78%" class="vtable">
<input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked=\"checked\""; ?> />
@@ -588,7 +605,7 @@ function update_description(itemnum) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Aliases Hostnames Resolve Interval");?></td>
<td width="78%" class="vtable">
- <input name="aliasesresolveinterval" type="text" id="aliasesresolveinterval" value="<?php echo $pconfig['aliasesresolveinterval']; ?>" />
+ <input name="aliasesresolveinterval" type="text" id="aliasesresolveinterval" value="<?php echo htmlspecialchars($pconfig['aliasesresolveinterval']); ?>" />
<br />
<strong><?=gettext("Interval, in seconds, that will be used to resolve hostnames configured on aliases.");?></strong>
<br />
diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php
index 9d11b86..72f4833 100644
--- a/usr/local/www/system_advanced_misc.php
+++ b/usr/local/www/system_advanced_misc.php
@@ -118,6 +118,18 @@ if ($_POST) {
$input_errors[] = gettext("/var Size must be numeric and should not be less than 60MB.");
}
+ if (!empty($_POST['proxyport']) && !is_port($_POST['proxyport'])) {
+ $input_errors[] = gettext("Proxy port must be a valid port number, 1-65535.");
+ }
+
+ if (!empty($_POST['proxyurl']) && !is_fqdn($_POST['proxyurl']) && !is_ipaddr($_POST['proxyurl'])) {
+ $input_errors[] = gettext("Proxy URL must be a valid IP address or FQDN.");
+ }
+
+ if (!empty($_POST['proxyuser']) && preg_match("/[^a-zA-Z0-9\.\-_@]/", $_POST['proxyuser'])) {
+ $input_errors[] = gettext("The proxy username contains invalid characters.");
+ }
+
if (!$input_errors) {
if ($_POST['harddiskstandby'] <> "") {
@@ -353,7 +365,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy URL"); ?></td>
<td width="78%" class="vtable">
- <input name="proxyurl" id="proxyurl" value="<?php if ($pconfig['proxyurl'] <> "") echo $pconfig['proxyurl']; ?>" class="formfld unknown" />
+ <input name="proxyurl" id="proxyurl" value="<?php if ($pconfig['proxyurl'] <> "") echo htmlspecialchars($pconfig['proxyurl']); ?>" class="formfld unknown" />
<br />
<?php printf(gettext("Hostname or IP address of proxy server this system will use for its outbound Internet access.")); ?>
</td>
@@ -361,7 +373,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy Port"); ?></td>
<td width="78%" class="vtable">
- <input name="proxyport" id="proxyport" value="<?php if ($pconfig['proxyport'] <> "") echo $pconfig['proxyport']; ?>" class="formfld unknown" />
+ <input name="proxyport" id="proxyport" value="<?php if ($pconfig['proxyport'] <> "") echo htmlspecialchars($pconfig['proxyport']); ?>" class="formfld unknown" />
<br />
<?php printf(gettext("Port where proxy server is listening.")); ?>
</td>
@@ -369,7 +381,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy Username"); ?></td>
<td width="78%" class="vtable">
- <input name="proxyuser" id="proxyuser" value="<?php if ($pconfig['proxyuser'] <> "") echo $pconfig['proxyuser']; ?>" class="formfld unknown" />
+ <input name="proxyuser" id="proxyuser" value="<?php if ($pconfig['proxyuser'] <> "") echo htmlspecialchars($pconfig['proxyuser']); ?>" class="formfld unknown" />
<br />
<?php printf(gettext("Username for authentication to proxy server. Optional, leave blank to not use authentication.")); ?>
</td>
@@ -377,7 +389,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy Password"); ?></td>
<td width="78%" class="vtable">
- <input type="password" name="proxypass" id="proxypass" value="<?php if ($pconfig['proxypass'] <> "") echo $pconfig['proxypass']; ?>" class="formfld unknown" />
+ <input type="password" name="proxypass" id="proxypass" value="<?php if ($pconfig['proxypass'] <> "") echo htmlspecialchars($pconfig['proxypass']); ?>" class="formfld unknown" />
<br />
<?php printf(gettext("Password for authentication to proxy server.")); ?>
</td>
@@ -399,7 +411,7 @@ function tmpvar_checked(obj) {
"will be redirected to the next web server in the round " .
"robin. Changing this option will restart the Load Balancing service."); ?>
<br />
- <input name="srctrack" id="srctrack" value="<?php if ($pconfig['srctrack'] <> "") echo $pconfig['srctrack']; else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['lb_use_sticky'] == false) echo "disabled=\"disabled\""; ?> />
+ <input name="srctrack" id="srctrack" value="<?php if ($pconfig['srctrack'] <> "") echo htmlspecialchars($pconfig['srctrack']); else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['lb_use_sticky'] == false) echo "disabled=\"disabled\""; ?> />
<br />
<?=gettext("Set the source tracking timeout for sticky connections. " .
"By default this is 0, so source tracking is removed as soon as the state expires. " .
@@ -605,7 +617,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("/tmp RAM Disk Size"); ?></td>
<td width="78%" class="vtable">
- <input name="use_mfs_tmp_size" id="use_mfs_tmp_size" value="<?php if ($pconfig['use_mfs_tmp_size'] <> "") echo $pconfig['use_mfs_tmp_size']; ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
+ <input name="use_mfs_tmp_size" id="use_mfs_tmp_size" value="<?php if ($pconfig['use_mfs_tmp_size'] <> "") echo htmlspecialchars($pconfig['use_mfs_tmp_size']); ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
<br />
<?=gettext("Set the size, in MB, for the /tmp RAM disk. " .
"Leave blank for 40MB. Do not set lower than 40."); ?>
@@ -614,7 +626,7 @@ function tmpvar_checked(obj) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("/var RAM Disk Size"); ?></td>
<td width="78%" class="vtable">
- <input name="use_mfs_var_size" id="use_mfs_var_size" value="<?php if ($pconfig['use_mfs_var_size'] <> "") echo $pconfig['use_mfs_var_size']; ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
+ <input name="use_mfs_var_size" id="use_mfs_var_size" value="<?php if ($pconfig['use_mfs_var_size'] <> "") echo htmlspecialchars($pconfig['use_mfs_var_size']); ?>" class="formfld unknown" <?php if (($g['platform'] == "pfSense") && ($pconfig['use_mfs_tmpvar'] == false)) echo "disabled=\"disabled\""; ?> /> MB
<br />
<?=gettext("Set the size, in MB, for the /var RAM disk. " .
"Leave blank for 60MB. Do not set lower than 60."); ?>
diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php
index 67df042..45ac501 100644
--- a/usr/local/www/system_advanced_notifications.php
+++ b/usr/local/www/system_advanced_notifications.php
@@ -234,28 +234,28 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Registration Name"); ?></td>
<td width="78%" class="vtable">
- <input name='name' value='<?php echo htmlspecialchars($pconfig['name']); ?>' /><br />
+ <input name='name' value='<?php echo htmlspecialchars($pconfig['name'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("Enter the name to register with the Growl server (default: PHP-Growl)."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Notification Name"); ?></td>
<td width="78%" class="vtable">
- <input name='notification_name' value='<?php echo htmlspecialchars($pconfig['notification_name']); ?>' /><br />
+ <input name='notification_name' value='<?php echo htmlspecialchars($pconfig['notification_name'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=sprintf(gettext("Enter a name for the Growl notifications (default: %s growl alert)."), $g['product_name']); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IP Address"); ?></td>
<td width="78%" class="vtable">
- <input name='ipaddress' value='<?php echo htmlspecialchars($pconfig['ipaddress']); ?>' /><br />
+ <input name='ipaddress' value='<?php echo htmlspecialchars($pconfig['ipaddress'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("This is the IP address that you would like to send growl notifications to."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
<td width="78%" class="vtable">
- <input name='password' type='password' value='<?php echo htmlspecialchars($pconfig['password']); ?>' /><br />
+ <input name='password' type='password' value='<?php echo htmlspecialchars($pconfig['password'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("Enter the password of the remote growl notification device."); ?>
</td>
</tr>
@@ -285,14 +285,14 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("E-Mail server"); ?></td>
<td width="78%" class="vtable">
- <input name='smtpipaddress' value='<?php echo htmlspecialchars($pconfig['smtpipaddress']); ?>' /><br />
+ <input name='smtpipaddress' value='<?php echo htmlspecialchars($pconfig['smtpipaddress'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("This is the FQDN or IP address of the SMTP E-Mail server to which notifications will be sent."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("SMTP Port of E-Mail server"); ?></td>
<td width="78%" class="vtable">
- <input name='smtpport' value='<?php echo htmlspecialchars($pconfig['smtpport']); ?>' /><br />
+ <input name='smtpport' value='<?php echo htmlspecialchars($pconfig['smtpport'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("This is the port of the SMTP E-Mail server, typically 25, 587 (submission) or 465 (smtps)"); ?>
</td>
</tr>
@@ -306,28 +306,28 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("From e-mail address"); ?></td>
<td width="78%" class="vtable">
- <input name='smtpfromaddress' type='text' value='<?php echo htmlspecialchars($pconfig['smtpfromaddress']); ?>' /><br />
+ <input name='smtpfromaddress' type='text' value='<?php echo htmlspecialchars($pconfig['smtpfromaddress'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("This is the e-mail address that will appear in the from field."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Notification E-Mail address"); ?></td>
<td width="78%" class="vtable">
- <input name='smtpnotifyemailaddress' type='text' value='<?php echo htmlspecialchars($pconfig['smtpnotifyemailaddress']); ?>' /><br />
+ <input name='smtpnotifyemailaddress' type='text' value='<?php echo htmlspecialchars($pconfig['smtpnotifyemailaddress'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("Enter the e-mail address that you would like email notifications sent to."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Notification E-Mail auth username (optional)"); ?></td>
<td width="78%" class="vtable">
- <input name='smtpusername' type='text' value='<?php echo htmlspecialchars($pconfig['smtpusername']); ?>' /><br />
+ <input name='smtpusername' type='text' value='<?php echo htmlspecialchars($pconfig['smtpusername'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("Enter the e-mail address username for SMTP authentication."); ?>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Notification E-Mail auth password"); ?></td>
<td width="78%" class="vtable">
- <input name='smtppassword' type='password' value='<?php echo htmlspecialchars($pconfig['smtppassword']); ?>' /><br />
+ <input name='smtppassword' type='password' value='<?php echo htmlspecialchars($pconfig['smtppassword'], ENT_QUOTES | ENT_HTML401); ?>' /><br />
<?=gettext("Enter the e-mail address password for SMTP authentication."); ?>
</td>
</tr>
@@ -368,7 +368,7 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Startup/Shutdown Sound"); ?></td>
<td width="78%" class="vtable">
- <input name="disablebeep" type="checkbox" id="disablebeep" value="yes" <?php if ($pconfig['disablebeep']) echo "checked=\"checked\""; ?> />
+ <input name="disablebeep" type="checkbox" id="disablebeep" value="yes" <?php if ($pconfig['disablebeep']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Disable the startup/shutdown beep"); ?></strong>
<br />
<span class="vexpl"><?=gettext("When this is checked, startup and shutdown sounds will no longer play."); ?></span>
@@ -396,7 +396,7 @@ include("head.inc");
jQuery(document).ready(function() {
if (jQuery('#smtpssl').is(':checked')) {
jQuery('#smtptls').prop('disabled', true);
- } else if (jQuery('#smtptls').is(':checked')) {
+ } else if (jQuery('#smtptls').is(':checked')) {
jQuery('#smtpssl').prop('disabled', true);
}
});
diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php
index b9abd99..be12322 100644
--- a/usr/local/www/system_advanced_sysctl.php
+++ b/usr/local/www/system_advanced_sysctl.php
@@ -194,18 +194,18 @@ include("head.inc");
<?php foreach ($tunables as $i => $tunable):
if (!isset($tunable['modified'])) {
- $i = $tunable['tunable'];
+ $i = urlencode($tunable['tunable']);
}
?>
<tr>
<td class="listlr" ondblclick="document.location='system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>';">
- <?php echo $tunable['tunable']; ?>
+ <?php echo htmlspecialchars($tunable['tunable']); ?>
</td>
<td class="listr" align="left" ondblclick="document.location='system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>';">
- <?php echo $tunable['descr']; ?>
+ <?php echo htmlspecialchars($tunable['descr']); ?>
</td>
<td class="listr" align="left" ondblclick="document.location='system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>';">
- <?php echo $tunable['value']; ?>
+ <?php echo htmlspecialchars($tunable['value']); ?>
<?php
if ($tunable['value'] == "default") {
echo "(" . get_default_sysctl_value($tunable['tunable']) . ")";
@@ -263,19 +263,19 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Tunable"); ?></td>
<td width="78%" class="vtable">
- <input size="65" name="tunable" value="<?php echo $pconfig['tunable']; ?>" />
+ <input size="65" name="tunable" value="<?php echo htmlspecialchars($pconfig['tunable']); ?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Description"); ?></td>
<td width="78%" class="vtable">
- <textarea rows="7" cols="50" name="descr"><?php echo $pconfig['descr']; ?></textarea>
+ <textarea rows="7" cols="50" name="descr"><?php echo htmlspecialchars($pconfig['descr']); ?></textarea>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Value"); ?></td>
<td width="78%" class="vtable">
- <input size="65" name="value" value="<?php echo $pconfig['value']; ?>" />
+ <input size="65" name="value" value="<?php echo htmlspecialchars($pconfig['value']); ?>" />
</td>
</tr>
<tr>
diff --git a/usr/local/www/system_certmanager.php b/usr/local/www/system_certmanager.php
index 1f21090..6dff39d 100644
--- a/usr/local/www/system_certmanager.php
+++ b/usr/local/www/system_certmanager.php
@@ -464,7 +464,7 @@ if ($_POST) {
// $subject_mismatch = true;
// }
// }
- $mod_csr = csr_get_modulus($pconfig['csr'], false);
+ $mod_csr = csr_get_modulus($pconfig['csr'], false);
$mod_cert = cert_get_modulus($pconfig['cert'], false);
if (strcmp($mod_csr, $mod_cert)) {
diff --git a/usr/local/www/system_crlmanager.php b/usr/local/www/system_crlmanager.php
index 1eb9394..2866688 100644
--- a/usr/local/www/system_crlmanager.php
+++ b/usr/local/www/system_crlmanager.php
@@ -203,15 +203,14 @@ if ($_POST) {
if (($pconfig['method'] == "existing") || ($act == "editimported")) {
$reqdfields = explode(" ", "descr crltext");
$reqdfieldsn = array(
- gettext("Descriptive name"),
- gettext("Certificate Revocation List data"));
+ gettext("Descriptive name"),
+ gettext("Certificate Revocation List data"));
}
if ($pconfig['method'] == "internal") {
- $reqdfields = explode(" ",
- "descr caref");
+ $reqdfields = explode(" ", "descr caref");
$reqdfieldsn = array(
- gettext("Descriptive name"),
- gettext("Certificate Authority"));
+ gettext("Descriptive name"),
+ gettext("Certificate Authority"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php
index b3564c0..cb3dd90 100644
--- a/usr/local/www/system_firmware.php
+++ b/usr/local/www/system_firmware.php
@@ -190,7 +190,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
} else if (stristr($_FILES['ulfile']['name'], "bdiff")) {
mwexec_bg("/etc/rc.firmware delta_update {$g['upload_path']}/firmware.tgz");
- } else {
+ } else {
if ($g['platform'] == "nanobsd") {
$whichone = "pfSenseNanoBSDupgrade";
} else {
@@ -264,7 +264,7 @@ include("head.inc");
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<tr>
- <td colspan="2" class="listtopic"><?=gettext("Invoke") ." ". $g['product_name'] ." ". gettext("Manual Upgrade"); ?></td>
+ <td colspan="2" class="listtopic"><?=gettext("Invoke") ." ". $g['product_name'] . " " . gettext("Manual Upgrade"); ?></td>
</tr>
<tr>
<td width="22%" valign="baseline" class="vncell">&nbsp;</td>
diff --git a/usr/local/www/system_firmware_check.php b/usr/local/www/system_firmware_check.php
index 458e071..d240a63 100644
--- a/usr/local/www/system_firmware_check.php
+++ b/usr/local/www/system_firmware_check.php
@@ -47,7 +47,7 @@ require("guiconfig.inc");
require_once("pfsense-utils.inc");
$curcfg = $config['system']['firmware'];
-$pgtitle=array(gettext("System"), gettext("Firmware"), gettext("Auto Update"));
+$pgtitle = array(gettext("System"), gettext("Firmware"), gettext("Auto Update"));
include("head.inc");
?>
@@ -191,13 +191,13 @@ echo "//]]>\n";
echo "</script>\n";
$txt = gettext("A new version is now available") . "\\n\\n";
-$txt .= gettext("Current version") .": ". $current_installed_version . "\\n";
+$txt .= gettext("Current version") . ": " . $current_installed_version . "\\n";
if ($g['platform'] == "nanobsd") {
$txt .= " " . gettext("NanoBSD Size") . " : " . trim(file_get_contents("/etc/nanosize.txt")) . "\\n";
}
-$txt .= " " . gettext("Built On") .": ". $current_installed_buildtime . "\\n";
-$txt .= " " . gettext("New version") .": ". htmlspecialchars($remote_version, ENT_QUOTES | ENT_HTML401). "\\n\\n";
-$txt .= " " . gettext("Update source") .": ". $updater_url . "\\n";
+$txt .= " " . gettext("Built On") . ": " . $current_installed_buildtime . "\\n";
+$txt .= " " . gettext("New version") . ": " . htmlspecialchars($remote_version, ENT_QUOTES | ENT_HTML401). "\\n\\n";
+$txt .= " " . gettext("Update source") . ": " . $updater_url . "\\n";
update_output_window($txt);
?>
</p>
diff --git a/usr/local/www/system_firmware_restorefullbackup.php b/usr/local/www/system_firmware_restorefullbackup.php
index fb571af..3cf3f83 100644
--- a/usr/local/www/system_firmware_restorefullbackup.php
+++ b/usr/local/www/system_firmware_restorefullbackup.php
@@ -159,16 +159,16 @@ include("head.inc");
$counter++;
$size = exec("gzip -l /root/$arf | grep -v compressed | awk '{ print $2 }'");
echo "<tr>";
- echo "<td class='listlr' width='50%' colspan='1'>";
+ echo "<td class='listlr' width='50%' colspan='1'>";
echo "<input type='radio' name='restorefile' value='$arf' /> $arf";
echo "</td>";
- echo "<td class='listr' width='30%' colspan='1'>";
+ echo "<td class='listr' width='30%' colspan='1'>";
echo date ("F d Y H:i:s", filemtime($arf));
echo "</td>";
- echo "<td class='listr' width='40%' colspan='1'>";
+ echo "<td class='listr' width='40%' colspan='1'>";
echo format_bytes($size);
echo "</td>";
- echo "<td class='listr nowrap' width='20%' colspan='1'>";
+ echo "<td class='listr nowrap' width='20%' colspan='1'>";
echo "<a onclick=\"return confirm('" . gettext("Do you really want to delete this backup?") . "')\" href='system_firmware_restorefullbackup.php?deletefile=" . htmlspecialchars($arf) . "'>";
echo gettext("Delete");
echo "</a> | ";
@@ -180,7 +180,7 @@ include("head.inc");
}
if ($counter == 0) {
echo "<tr>";
- echo "<td class='listlr' width='100%' colspan='4' align='center'>";
+ echo "<td class='listlr' width='100%' colspan='4' align='center'>";
echo gettext("Could not locate any previous backups.");
echo "</td>";
echo "</tr>";
diff --git a/usr/local/www/system_firmware_settings.php b/usr/local/www/system_firmware_settings.php
index f2232d6..9f6c5e0 100644
--- a/usr/local/www/system_firmware_settings.php
+++ b/usr/local/www/system_firmware_settings.php
@@ -179,7 +179,7 @@ function enable_altfirmwareurl(enable_over) {
<?=gettext("Base URL:"); ?>
</td>
<td>
- <input name="firmwareurl" type="text" class="formfld url" id="firmwareurl" size="64" value="<?php if ($curcfg['alturl']['firmwareurl']) echo $curcfg['alturl']['firmwareurl']; else echo $g['']; ?>" />
+ <input name="firmwareurl" type="text" class="formfld url" id="firmwareurl" size="64" value="<?php if ($curcfg['alturl']['firmwareurl']) echo htmlspecialchars($curcfg['alturl']['firmwareurl']); else echo $g['']; ?>" />
</td>
</tr>
</table>
@@ -241,7 +241,7 @@ function enable_altfirmwareurl(enable_over) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Repository URL"); ?></td>
<td width="78%" class="vtable">
- <input name="repositoryurl" type="text" class="formfld url" id="repositoryurl" size="64" value="<?php if ($gitcfg['repositoryurl']) echo $gitcfg['repositoryurl']; ?>" />
+ <input name="repositoryurl" type="text" class="formfld url" id="repositoryurl" size="64" value="<?php if ($gitcfg['repositoryurl']) echo htmlspecialchars($gitcfg['repositoryurl']); ?>" />
<?php
if ($lastrepositoryurl):
?>
@@ -271,7 +271,7 @@ function enable_altfirmwareurl(enable_over) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Branch name"); ?></td>
<td width="78%" class="vtable">
- <input name="branch" type="text" class="formfld unknown" id="branch" size="64" value="<?php if ($gitcfg['branch']) echo $gitcfg['branch']; ?>" />
+ <input name="branch" type="text" class="formfld unknown" id="branch" size="64" value="<?php if ($gitcfg['branch']) echo htmlspecialchars($gitcfg['branch']); ?>" />
<?php
if ($lastbranch):
?>
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 12958ec..483e102 100644
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -628,9 +628,9 @@ function calculated_change(calculated_obj, samples_obj) {
function valid_value(object, min, max) {
if (object.value) {
object.value = Math.round(object.value); // Round to integer
- if (object.value < min) object.value = min; // Min Value
- if (object.value > max) object.value = max; // Max Value
- if (isNaN(object.value)) object.value = ''; // Empty Value
+ if (object.value < min) object.value = min; // Min Value
+ if (object.value > max) object.value = max; // Max Value
+ if (isNaN(object.value)) object.value = ''; // Empty Value
}
}
diff --git a/usr/local/www/system_groupmanager_addprivs.php b/usr/local/www/system_groupmanager_addprivs.php
index 00c86f0..830d025 100644
--- a/usr/local/www/system_groupmanager_addprivs.php
+++ b/usr/local/www/system_groupmanager_addprivs.php
@@ -237,7 +237,7 @@ function update_description() {
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
<input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()" />
<?php if (isset($groupid)): ?>
<input name="groupid" type="hidden" value="<?=htmlspecialchars($groupid);?>" />
diff --git a/usr/local/www/system_hasync.php b/usr/local/www/system_hasync.php
index 6455fe2..1ce81e6 100755
--- a/usr/local/www/system_hasync.php
+++ b/usr/local/www/system_hasync.php
@@ -143,7 +143,7 @@ include("head.inc");
<tr valign="top">
<td width="22%" class="vncell">pfsync Synchronize Peer IP</td>
<td class="vtable">
- <input id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip']); ?>' />
+ <input id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip'], ENT_QUOTES | ENT_HTML401); ?>' />
<br />
Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.
</td>
@@ -157,7 +157,7 @@ include("head.inc");
<tr valign="top">
<td width="22%" class="vncell">Synchronize Config to IP</td>
<td class="vtable">
- <input id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip']); ?>' />
+ <input id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip'], ENT_QUOTES | ENT_HTML401); ?>' />
<br />
Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br />
<br />
@@ -169,7 +169,7 @@ include("head.inc");
<tr valign="top">
<td width="22%" class="vncell">Remote System Username</td>
<td class="vtable">
- <input id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username']); ?>' />
+ <input id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username'], ENT_QUOTES | ENT_HTML401); ?>' />
<br />
Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />
<br />
@@ -179,7 +179,7 @@ include("head.inc");
<tr valign="top">
<td width="22%" class="vncell">Remote System Password</td>
<td class="vtable">
- <input id='passwordfld' type='password' name='passwordfld' class='formfld pwd' value='<?= htmlentities($pconfig['passwordfld']); ?>' />
+ <input id='passwordfld' type='password' name='passwordfld' class='formfld pwd' value='<?= htmlentities($pconfig['passwordfld'], ENT_QUOTES | ENT_HTML401); ?>' />
<br />
Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />
<br />
diff --git a/usr/local/www/system_usermanager_addprivs.php b/usr/local/www/system_usermanager_addprivs.php
index 87ddb21..40b11a6 100644
--- a/usr/local/www/system_usermanager_addprivs.php
+++ b/usr/local/www/system_usermanager_addprivs.php
@@ -202,7 +202,7 @@ function update_description() {
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
- <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
<input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()" />
<?php if (isset($userid)): ?>
<input name="userid" type="hidden" value="<?=htmlspecialchars($userid);?>" />
diff --git a/usr/local/www/vpn_ipsec.php b/usr/local/www/vpn_ipsec.php
index fd400b0..6ef6040 100644
--- a/usr/local/www/vpn_ipsec.php
+++ b/usr/local/www/vpn_ipsec.php
@@ -233,7 +233,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("VPN"),gettext("IPsec"));
+$pgtitle = array(gettext("VPN"), gettext("IPsec"));
$shortcut_section = "ipsec";
include("head.inc");
@@ -385,7 +385,7 @@ include("head.inc");
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?>
<?php
if ($ph1ent['encryption-algorithm']['keylen']) {
- if ($ph1ent['encryption-algorithm']['keylen']=="auto") {
+ if ($ph1ent['encryption-algorithm']['keylen'] == "auto") {
echo " (" . gettext("auto") . ")";
} else {
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
@@ -455,7 +455,7 @@ include("head.inc");
<input type="hidden" name="tdph2-<?=$i;?>-visible" id="tdph2-<?=$i;?>-visible" value="<?=$tdph2_visible?>" />
<div id="shph2but-<?=$i?>" <?php echo ($tdph2_visible == '1' ? 'style="display:none"' : '');?>>
<?php
- $phase2count=0;
+ $phase2count = 0;
foreach ($a_phase2 as $ph2ent) {
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
continue;
@@ -465,7 +465,7 @@ include("head.inc");
$fr_prefix = "frp2{$i}";
$fr_header = $fr_prefix . "header";
?>
- <input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
+ <input type="button" onclick="show_phase2('tdph2-<?=$i?>', 'shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
</div>
<div id="tdph2-<?=$i?>" <?php echo ($tdph2_visible != '1' ? 'style="display:none"' : '');?>>
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="phase-2 entries">
@@ -544,7 +544,7 @@ include("head.inc");
}
echo $p2_ealgos[$ph2ea['name']]['name'];
if ($ph2ea['keylen']) {
- if ($ph2ea['keylen']=="auto") {
+ if ($ph2ea['keylen'] == "auto") {
echo " (" . gettext("auto") . ")";
} else {
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
diff --git a/usr/local/www/vpn_ipsec_mobile.php b/usr/local/www/vpn_ipsec_mobile.php
index 86c63f5..bb1ef75 100644
--- a/usr/local/www/vpn_ipsec_mobile.php
+++ b/usr/local/www/vpn_ipsec_mobile.php
@@ -144,7 +144,7 @@ if ($_POST['submit']) {
/* input validation */
$reqdfields = explode(" ", "user_source group_source");
- $reqdfieldsn = array(gettext("User Authentication Source"), gettext("Group Authentication Source"));
+ $reqdfieldsn = array(gettext("User Authentication Source"), gettext("Group Authentication Source"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -174,7 +174,7 @@ if ($_POST['submit']) {
if ($pconfig['dns_server_enable']) {
if (!$pconfig['dns_server1'] && !$pconfig['dns_server2'] &&
- !$pconfig['dns_server3'] && !$pconfig['dns_server4'] ) {
+ !$pconfig['dns_server3'] && !$pconfig['dns_server4']) {
$input_errors[] = gettext("At least one DNS server must be specified to enable the DNS Server option.");
}
if ($pconfig['dns_server1'] && !is_ipaddr($pconfig['dns_server1'])) {
@@ -375,7 +375,7 @@ function login_banner_change() {
}
}
if ($pconfig['enable'] && !$ph1found) {
- print_info_box_np(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."),gettext("create"),gettext("Create Phase1"));
+ print_info_box_np(gettext("Support for IPsec Mobile clients is enabled but a Phase1 definition was not found") . ".<br />" . gettext("Please click Create to define one."), gettext("create"), gettext("Create Phase1"));
}
if ($input_errors) {
print_input_errors($input_errors);
diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php
index b4c456a..f9a9805 100644
--- a/usr/local/www/vpn_ipsec_phase2.php
+++ b/usr/local/www/vpn_ipsec_phase2.php
@@ -636,7 +636,7 @@ function change_protocol() {
$iflist = get_configured_interface_with_descr();
foreach ($iflist as $ifname => $ifdescr):
?>
- <option value="<?=$ifname; ?>" <?php if ($pconfig['localid_type'] == $ifname ) echo "selected=\"selected\"";?>><?=sprintf(gettext("%s subnet"), $ifdescr); ?></option>
+ <option value="<?=$ifname; ?>" <?php if ($pconfig['localid_type'] == $ifname) echo "selected=\"selected\"";?>><?=sprintf(gettext("%s subnet"), $ifdescr); ?></option>
<?php endforeach; ?>
</select>
</td>
@@ -673,9 +673,9 @@ function change_protocol() {
$iflist = get_configured_interface_with_descr();
foreach ($iflist as $ifname => $ifdescr):
?>
- <option value="<?=$ifname; ?>" <?php if ($pconfig['natlocalid_type'] == $ifname ) echo "selected=\"selected\"";?>><?=sprintf(gettext("%s subnet"), $ifdescr); ?></option>
+ <option value="<?=$ifname; ?>" <?php if ($pconfig['natlocalid_type'] == $ifname) echo "selected=\"selected\"";?>><?=sprintf(gettext("%s subnet"), $ifdescr); ?></option>
<?php endforeach; ?>
- <option value="none" <?php if (empty($pconfig['natlocalid_type']) || $pconfig['natlocalid_type'] == "none" ) echo "selected=\"selected\"";?>><?=gettext("None"); ?></option>
+ <option value="none" <?php if (empty($pconfig['natlocalid_type']) || $pconfig['natlocalid_type'] == "none") echo "selected=\"selected\"";?>><?=gettext("None"); ?></option>
</select>
</td>
</tr>
@@ -958,7 +958,7 @@ function pconfig_to_idinfo($prefix,& $pconfig) {
case "network":
return array('type' => $type, 'address' => $address, 'netbits' => $netbits);
default:
- return array('type' => $type );
+ return array('type' => $type);
}
}
diff --git a/usr/local/www/vpn_ipsec_settings.php b/usr/local/www/vpn_ipsec_settings.php
index 5b172bc..f77135b 100644
--- a/usr/local/www/vpn_ipsec_settings.php
+++ b/usr/local/www/vpn_ipsec_settings.php
@@ -213,8 +213,16 @@ if ($_POST) {
vpn_ipsec_configure($needsrestart);
vpn_ipsec_configure_loglevels();
-// header("Location: vpn_ipsec_settings.php");
-// return;
+ header("Location: vpn_ipsec_settings.php");
+ return;
+ }
+
+ // The logic value sent by $POST is opposite to the way it is stored in the config.
+ // Reset the $pconfig value so it reflects the opposite of what was $POSTed.
+ if ($_POST['noshuntlaninterfaces'] == "yes") {
+ $pconfig['noshuntlaninterfaces'] = false;
+ } else {
+ $pconfig['noshuntlaninterfaces'] = true;
}
}
@@ -232,9 +240,9 @@ include("head.inc");
function maxmss_checked(obj) {
if (obj.checked) {
- jQuery('#maxmss').attr('disabled',false);
+ jQuery('#maxmss').attr('disabled', false);
} else {
- jQuery('#maxmss').attr('disabled','true');
+ jQuery('#maxmss').attr('disabled', 'true');
}
}
@@ -286,8 +294,9 @@ function maxmss_checked(obj) {
echo "<select name=\"ipsec_{$lkey}\" id=\"ipsec_{$lkey}\">\n";
foreach (array("Silent", "Audit", "Control", "Diag", "Raw", "Highest") as $lidx => $lvalue) {
echo "<option value=\"{$lidx}\" ";
- if ($pconfig["ipsec_{$lkey}"] == $lidx)
+ if ($pconfig["ipsec_{$lkey}"] == $lidx) {
echo "selected=\"selected\"";
+ }
echo ">{$lvalue}</option>\n";
}
?>
@@ -364,7 +373,7 @@ function maxmss_checked(obj) {
<input name="maxmss_enable" type="checkbox" id="maxmss_enable" value="yes" <?php if ($pconfig['maxmss_enable'] == true) echo "checked=\"checked\""; ?> onclick="maxmss_checked(this)" />
<strong><?=gettext("Enable MSS clamping on VPN traffic"); ?></strong>
<br />
- <input name="maxmss" id="maxmss" value="<?php if ($pconfig['maxmss'] <> "") echo $pconfig['maxmss']; else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['maxmss_enable'] == false) echo "disabled=\"disabled\""; ?> />
+ <input name="maxmss" id="maxmss" value="<?php if ($pconfig['maxmss'] <> "") echo htmlspecialchars($pconfig['maxmss']); else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['maxmss_enable'] == false) echo "disabled=\"disabled\""; ?> />
<br />
<?=gettext("Enable MSS clamping on TCP flows over VPN. " .
"This helps overcome problems with PMTUD on IPsec VPN links. If left blank, the default value is 1400 bytes. "); ?>
diff --git a/usr/local/www/vpn_l2tp.php b/usr/local/www/vpn_l2tp.php
index 7a508c5..88f4eae 100644
--- a/usr/local/www/vpn_l2tp.php
+++ b/usr/local/www/vpn_l2tp.php
@@ -72,7 +72,7 @@ if ($_POST) {
/* input validation */
if ($_POST['mode'] == "server") {
$reqdfields = explode(" ", "localip remoteip");
- $reqdfieldsn = array(gettext("Server address"),gettext("Remote start address"));
+ $reqdfieldsn = array(gettext("Server address"), gettext("Remote start address"));
if ($_POST['radiusenable']) {
$reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
@@ -144,19 +144,20 @@ if ($_POST) {
if ($_POST['l2tp_dns1'] == "") {
- if (isset($l2tpcfg['dns1']))
+ if (isset($l2tpcfg['dns1'])) {
unset($l2tpcfg['dns1']);
- } else {
- $l2tpcfg['dns1'] = $_POST['l2tp_dns1'];
}
+ } else {
+ $l2tpcfg['dns1'] = $_POST['l2tp_dns1'];
+ }
- if ($_POST['l2tp_dns2'] == "") {
- if (isset($l2tpcfg['dns2'])) {
- unset($l2tpcfg['dns2']);
- }
- } else {
- $l2tpcfg['dns2'] = $_POST['l2tp_dns2'];
+ if ($_POST['l2tp_dns2'] == "") {
+ if (isset($l2tpcfg['dns2'])) {
+ unset($l2tpcfg['dns2']);
}
+ } else {
+ $l2tpcfg['dns2'] = $_POST['l2tp_dns2'];
+ }
if ($_POST['radiusenable'] == "yes") {
$l2tpcfg['radius']['enable'] = true;
@@ -197,8 +198,7 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
-function get_radio_value(obj)
-{
+function get_radio_value(obj) {
for (i = 0; i < obj.length; i++) {
if (obj[i].checked) {
return obj[i].value;
@@ -358,7 +358,7 @@ function enable_change(enable_over) {
<td width="78%" class="vtable">
<select id="l2tp_subnet" name="l2tp_subnet">
<?php
- for ($x=0; $x<33; $x++) {
+ for ($x = 0; $x < 33; $x++) {
if ($x == $pconfig['l2tp_subnet']) {
$SELECTED = " selected=\"selected\"";
} else {
@@ -376,7 +376,7 @@ function enable_change(enable_over) {
<td width="78%" class="vtable">
<select id="n_l2tp_units" name="n_l2tp_units">
<?php
- for ($x=0; $x<255; $x++) {
+ for ($x = 0; $x < 255; $x++) {
if ($x == $pconfig['n_l2tp_units']) {
$SELECTED = " selected=\"selected\"";
} else {
diff --git a/usr/local/www/vpn_l2tp_users.php b/usr/local/www/vpn_l2tp_users.php
index d45bb21..7ffc969 100644
--- a/usr/local/www/vpn_l2tp_users.php
+++ b/usr/local/www/vpn_l2tp_users.php
@@ -36,7 +36,7 @@
##|*MATCH=vpn_l2tp_users.php*
##|-PRIV
-$pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("Users"));
+$pgtitle = array(gettext("VPN"), gettext("L2TP"), gettext("Users"));
$shortcut_section = "l2tps";
require("guiconfig.inc");
diff --git a/usr/local/www/vpn_l2tp_users_edit.php b/usr/local/www/vpn_l2tp_users_edit.php
index 4fa0f52..e132606 100644
--- a/usr/local/www/vpn_l2tp_users_edit.php
+++ b/usr/local/www/vpn_l2tp_users_edit.php
@@ -36,21 +36,21 @@
##|*MATCH=vpn_l2tp_users_edit.php*
##|-PRIV
-$pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("User"),gettext("Edit"));
+$pgtitle = array(gettext("VPN"), gettext("L2TP"), gettext("User"), gettext("Edit"));
$shortcut_section = "l2tps";
-function l2tpusercmp($a, $b) {
- return strcasecmp($a['name'], $b['name']);
+function l2tpusercmp($a, $b) {
+ return strcasecmp($a['name'], $b['name']);
}
-function l2tp_users_sort() {
+function l2tp_users_sort() {
global $config;
if (!is_array($config['l2tp']['user'])) {
return;
}
- usort($config['l2tp']['user'], "l2tpusercmp");
+ usort($config['l2tp']['user'], "l2tpusercmp");
}
require("guiconfig.inc");
@@ -86,7 +86,7 @@ if ($_POST) {
$reqdfieldsn = array(gettext("Username"));
} else {
$reqdfields = explode(" ", "usernamefld passwordfld");
- $reqdfieldsn = array(gettext("Username"),gettext("Password"));
+ $reqdfieldsn = array(gettext("Username"), gettext("Password"));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php
index 969ba29..759aeae 100644
--- a/usr/local/www/vpn_openvpn_client.php
+++ b/usr/local/www/vpn_openvpn_client.php
@@ -499,7 +499,7 @@ if ($savemsg) {
<tr>
<td class="tabcont">
- <?php if ($act=="new" || $act=="edit"): ?>
+ <?php if ($act == "new" || $act == "edit"): ?>
<form action="vpn_openvpn_client.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
diff --git a/usr/local/www/vpn_openvpn_csc.php b/usr/local/www/vpn_openvpn_csc.php
index 0211c2c..356db7f 100644
--- a/usr/local/www/vpn_openvpn_csc.php
+++ b/usr/local/www/vpn_openvpn_csc.php
@@ -363,7 +363,7 @@ function netbios_change() {
<tr>
<td class="tabcont">
- <?php if ($act=="new" || $act=="edit"): ?>
+ <?php if ($act == "new" || $act == "edit"): ?>
<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
@@ -640,7 +640,7 @@ function netbios_change() {
<span class="vexpl">
<?=gettext("Server"); ?> #1:&nbsp;
</span>
- <input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>" />
+ <input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=htmlspecialchars($pconfig['ntp_server1']);?>" />
</td>
</tr>
<tr>
@@ -648,7 +648,7 @@ function netbios_change() {
<span class="vexpl">
<?=gettext("Server"); ?> #2:&nbsp;
</span>
- <input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>" />
+ <input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=htmlspecialchars($pconfig['ntp_server2']);?>" />
</td>
</tr>
</table>
@@ -737,7 +737,7 @@ function netbios_change() {
<span class="vexpl">
<?=gettext("Server"); ?> #1:&nbsp;
</span>
- <input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>" />
+ <input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=htmlspecialchars($pconfig['wins_server1']);?>" />
</td>
</tr>
<tr>
@@ -745,7 +745,7 @@ function netbios_change() {
<span class="vexpl">
<?=gettext("Server"); ?> #2:&nbsp;
</span>
- <input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>" />
+ <input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=htmlspecialchars($pconfig['wins_server2']);?>" />
</td>
</tr>
</table>
diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php
index 9b70468..7688fa8 100644
--- a/usr/local/www/vpn_openvpn_server.php
+++ b/usr/local/www/vpn_openvpn_server.php
@@ -751,7 +751,7 @@ function tuntap_change() {
mindex = document.iform.mode.selectedIndex;
mvalue = document.iform.mode.options[mindex].value;
- switch( mvalue) {
+ switch (mvalue) {
case "p2p_tls":
case "p2p_shared_key":
p2p = true;
@@ -833,7 +833,7 @@ if ($savemsg) {
<tr>
<td class="tabcont">
- <?php if ($act=="new" || $act=="edit"): ?>
+ <?php if ($act == "new" || $act == "edit"): ?>
<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
@@ -922,7 +922,7 @@ if ($savemsg) {
<?php
foreach ($openvpn_dev_mode as $device):
$selected = "";
- if (! empty($pconfig['dev_mode'])) {
+ if (!empty($pconfig['dev_mode'])) {
if ($pconfig['dev_mode'] == $device) {
$selected = "selected=\"selected\"";
}
diff --git a/usr/local/www/vpn_pppoe.php b/usr/local/www/vpn_pppoe.php
index 082978a..4ad8d72 100644
--- a/usr/local/www/vpn_pppoe.php
+++ b/usr/local/www/vpn_pppoe.php
@@ -90,7 +90,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("VPN"),gettext("PPPoE"));
+$pgtitle = array(gettext("VPN"), gettext("PPPoE"));
$shortcut_section = "pppoes";
include("head.inc");
diff --git a/usr/local/www/vpn_pppoe_edit.php b/usr/local/www/vpn_pppoe_edit.php
index e0cc036..343c1f9 100644
--- a/usr/local/www/vpn_pppoe_edit.php
+++ b/usr/local/www/vpn_pppoe_edit.php
@@ -114,12 +114,12 @@ if ($_POST) {
/* input validation */
if ($_POST['mode'] == "server") {
$reqdfields = explode(" ", "localip remoteip");
- $reqdfieldsn = array(gettext("Server address"),gettext("Remote start address"));
+ $reqdfieldsn = array(gettext("Server address"), gettext("Remote start address"));
if ($_POST['radiusenable']) {
$reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
$reqdfieldsn = array_merge($reqdfieldsn,
- array(gettext("RADIUS server address"),gettext("RADIUS shared secret")));
+ array(gettext("RADIUS server address"), gettext("RADIUS shared secret")));
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -151,7 +151,7 @@ if ($_POST) {
$input_errors[] = sprintf(gettext("No password specified for username %s"), $_POST["username{$x}"]);
}
if ($_POST["ip{$x}"] <> "" && !is_ipaddr($_POST["ip{$x}"])) {
- $input_errors[] = sprintf(gettext("Incorrect ip address specified for username %s"), $_POST["username{$x}"]);
+ $input_errors[] = sprintf(gettext("Incorrect ip address specified for username %s"), $_POST["username{$x}"]);
}
}
}
@@ -290,8 +290,7 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
-function get_radio_value(obj)
-{
+function get_radio_value(obj) {
for (i = 0; i < obj.length; i++) {
if (obj[i].checked) {
return obj[i].value;
@@ -533,7 +532,7 @@ if ($savemsg) {
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("RADIUS issued IPs"); ?></td>
<td width="78%" valign="top" class="vtable">
- <input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips" <?php if($pconfig['radiusissueips']) echo "checked=\"checked\""; ?> />
+ <input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips" <?php if ($pconfig['radiusissueips']) echo "checked=\"checked\""; ?> />
<br /><?=gettext("Issue IP Addresses via RADIUS server"); ?>.
</td>
</tr>
@@ -638,7 +637,7 @@ if ($savemsg) {
echo "<input type=\"hidden\" name=\"pppoeid\" id=\"pppoeid\" value=\"{$pppoeid}\" />";
}
?>
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
<a href="vpn_pppoe.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" /></a>
</td>
</tr>
diff --git a/usr/local/www/widgets/javascript/traffic_graph.js b/usr/local/www/widgets/javascript/traffic_graph.js
index 83fc481..66a70f5 100644
--- a/usr/local/www/widgets/javascript/traffic_graph.js
+++ b/usr/local/www/widgets/javascript/traffic_graph.js
@@ -12,7 +12,7 @@ function trafficshowDiv(incDiv,swapButtons) {
textlink = d.getElementById(selectIntLink);
textlink.style.display = "none";
}
- document.iform["shown[" + incDiv + "]"].value = "show";
+ document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "show";
}
function trafficminimizeDiv(incDiv,swapButtons) {
@@ -29,6 +29,6 @@ function trafficminimizeDiv(incDiv,swapButtons) {
textlink = d.getElementById(selectIntLink);
textlink.style.display = "none";
}
- document.iform["shown[" + incDiv + "]"].value = "hide";
+ document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "hide";
}
diff --git a/usr/local/www/widgets/widgets/gateways.widget.php b/usr/local/www/widgets/widgets/gateways.widget.php
index acbb533..26a6f4d 100644
--- a/usr/local/www/widgets/widgets/gateways.widget.php
+++ b/usr/local/www/widgets/widgets/gateways.widget.php
@@ -37,6 +37,24 @@ require_once("pfsense-utils.inc");
require_once("functions.inc");
require_once("/usr/local/www/widgets/include/gateways.inc");
+if ($_POST) {
+ if (!is_array($config["widgets"]["gateways_widget"])) {
+ $config["widgets"]["gateways_widget"] = array();
+ }
+ if (isset($_POST["display_type"])) {
+ $config["widgets"]["gateways_widget"]["display_type"] = $_POST["display_type"];
+ }
+ write_config("Updated gateways widget settings via dashboard.");
+ header("Location: /");
+ exit(0);
+}
+
+if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
+ $display_type = $config["widgets"]["gateways_widget"]["display_type"];
+} else {
+ $display_type = "gw_ip";
+}
+
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
@@ -45,6 +63,49 @@ $counter = 1;
?>
+<input type="hidden" id="gateways-config" name="gateways-config" value="" />
+
+<div id="gateways-settings" class="widgetconfigdiv" style="display:none;">
+<form action="/widgets/widgets/gateways.widget.php" method="post" name="gateways_widget_iform" id="gateways_widget_iform">
+ Display:
+ <?php
+ $display_type_gw_ip="checked=\"checked\"";
+ $display_type_monitor_ip="";
+ $display_type_both_ip="";
+ if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
+ $selected_radio = $config["widgets"]["gateways_widget"]["display_type"];
+ if ($selected_radio == "gw_ip") {
+ $display_type_gw_ip = "checked=\"checked\"";
+ $display_type_monitor_ip="";
+ $display_type_both_ip="";
+ } else if ($selected_radio == "monitor_ip") {
+ $display_type_gw_ip = "";
+ $display_type_monitor_ip="checked=\"checked\"";
+ $display_type_both_ip="";
+ } else if ($selected_radio == "both_ip") {
+ $display_type_gw_ip = "";
+ $display_type_monitor_ip="";
+ $display_type_both_ip="checked=\"checked\"";
+ }
+ }
+ ?>
+ <input name="display_type" class="radio" type="radio" id="display_type_gw_ip" value="gw_ip" <?php echo $display_type_gw_ip; ?> onchange="updateGatewayDisplays();" /> <span>Gateway IP</span>
+ <input name="display_type" class="radio" type="radio" id="display_type_monitor_ip" value="monitor_ip" <?php echo $display_type_monitor_ip; ?> onchange="updateGatewayDisplays();" /> <span>Monitor IP</span>
+ <input name="display_type" class="radio" type="radio" id="display_type_both_ip" value="both_ip" <?php echo $display_type_both_ip; ?> onchange="updateGatewayDisplays();" /> <span>Both</span>
+ <br /><br />
+ <input id="submit_settings" name="submit_settings" type="submit" onclick="return updatePref();" class="formbtn" value="Save Settings" />
+</form>
+</div>
+
+<script type="text/javascript">
+//<![CDATA[
+ d = document;
+ selectIntLink = "gateways-configure";
+ textlink = d.getElementById(selectIntLink);
+ textlink.style.display = "inline";
+//]]>
+</script>
+
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="gateway status">
<tr>
<td class="listhdrr" id="gatewayname" align="center">Name</td>
@@ -63,19 +124,41 @@ $counter = 1;
<td colspan="3" class="listr ellipsis" align="center">
<div id="gateway<?php echo $counter; ?>" style="display:inline"><b>
<?php
+ $monitor_address = "";
+ $monitor_address_disp = "";
+ if ($display_type == "monitor_ip" || $display_type == "both_ip") {
+ $monitor_address = $gateway['monitor'];
+ if ($monitor_address != "" && $display_type == "both_ip") {
+ $monitor_address_disp = " (" . $monitor_address . ")";
+ } else {
+ $monitor_address_disp = $monitor_address;
+ }
+ }
$if_gw = '';
- if (is_ipaddr($gateway['gateway'])) {
- $if_gw = htmlspecialchars($gateway['gateway']);
- } else {
- if ($gateway['ipprotocol'] == "inet") {
- $if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
+ // If the user asked to display Gateway IP or both IPs, or asked for just monitor IP but the monitor IP is blank
+ // then find the gateway IP (which is also the monitor IP if the monitor IP was not explicitly set).
+ if ($display_type == "gw_ip" || $display_type == "both_ip" || ($display_type == "monitor_ip" && $monitor_address == "")) {
+ if (is_ipaddr($gateway['gateway'])) {
+ $if_gw = htmlspecialchars($gateway['gateway']);
+ } else {
+ if ($gateway['ipprotocol'] == "inet") {
+ $if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
+ }
+ if ($gateway['ipprotocol'] == "inet6") {
+ $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
+ }
}
- if ($gateway['ipprotocol'] == "inet6") {
- $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
+ if ($if_gw == "") {
+ $if_gw = "~";
}
}
- echo ($if_gw == '' ? '~' : $if_gw);
+ if ($monitor_address == $if_gw) {
+ $monitor_address_disp = "";
+ }
+ echo $if_gw . $monitor_address_disp;
unset ($if_gw);
+ unset ($monitor_address);
+ unset ($monitor_address_disp);
$counter++;
?>
</b></div>
@@ -142,5 +225,3 @@ $counter = 1;
</tr>
<?php } // foreach ?>
</table>
-
-
diff --git a/usr/local/www/widgets/widgets/log.widget.php b/usr/local/www/widgets/widgets/log.widget.php
index 47a522c..45205a4 100644
--- a/usr/local/www/widgets/widgets/log.widget.php
+++ b/usr/local/www/widgets/widgets/log.widget.php
@@ -162,7 +162,7 @@ function format_log_line(row) {
<input type="hidden" id="log-config" name="log-config" value="" />
<div id="log-settings" class="widgetconfigdiv" style="display:none;">
- <form action="/widgets/widgets/log.widget.php" method="post" name="iforma">
+ <form action="/widgets/widgets/log.widget.php" method="post" name="log_widget_iform">
Number of lines to display:
<select name="filterlogentries" class="formfld unknown" id="filterlogentries">
<?php for ($i = 1; $i <= 20; $i++) { ?>
@@ -197,7 +197,7 @@ function format_log_line(row) {
?>
</select>
- <input id="submita" name="submita" type="submit" class="formbtn" value="Save" />
+ <input id="log_widget_submit" name="log_widget_submit" type="submit" class="formbtn" value="Save" />
</form>
</div>
diff --git a/usr/local/www/widgets/widgets/picture.widget.php b/usr/local/www/widgets/widgets/picture.widget.php
index 681634a..02a002a 100644
--- a/usr/local/www/widgets/widgets/picture.widget.php
+++ b/usr/local/www/widgets/widgets/picture.widget.php
@@ -74,9 +74,9 @@ if ($_POST) {
<input type="hidden" id="picture-config" name="picture-config" value="" />
<div id="picture-settings" class="widgetconfigdiv" style="display:none;">
- <form action="/widgets/widgets/picture.widget.php" method="post" name="iforma" enctype="multipart/form-data">
+ <form action="/widgets/widgets/picture.widget.php" method="post" name="picture_widget_iform" enctype="multipart/form-data">
<input name="pictfile" type="file" class="formbtn" id="pictfile" size="20" />
- <input id="submita" name="submita" type="submit" class="formbtn" value="Upload" />
+ <input id="picture_widget_submit" name="picture_widget_submit" type="submit" class="formbtn" value="Upload" />
</form>
</div>
diff --git a/usr/local/www/widgets/widgets/rss.widget.php b/usr/local/www/widgets/widgets/rss.widget.php
index cfe77a3..0850039 100644
--- a/usr/local/www/widgets/widgets/rss.widget.php
+++ b/usr/local/www/widgets/widgets/rss.widget.php
@@ -89,7 +89,7 @@ if ($config['widgets']['rssfeed']) {
<input type="hidden" id="rss-config" name="rss-config" value="" />
<div id="rss-settings" class="widgetconfigdiv" style="display:none;">
- <form action="/widgets/widgets/rss.widget.php" method="post" name="iformc">
+ <form action="/widgets/widgets/rss.widget.php" method="post" name="rss_widget_iform">
<textarea name="rssfeed" class="formfld unknown textarea_widget" id="rssfeed" cols="40" rows="3"><?=$textarea_txt;?></textarea>
<br />
<table summary="rss widget">
@@ -143,7 +143,7 @@ if ($config['widgets']['rssfeed']) {
&nbsp;
</td>
<td>
- <input id="submitc" name="submitc" type="submit" class="formbtn" value="Save" />
+ <input id="rss_widget_submit" name="rss_widget_submit" type="submit" class="formbtn" value="Save" />
</td>
</tr>
</table>
diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php
index f9f9166..f4c3542 100644
--- a/usr/local/www/widgets/widgets/services_status.widget.php
+++ b/usr/local/www/widgets/widgets/services_status.widget.php
@@ -50,10 +50,10 @@ if (isset($_POST['servicestatusfilter'])) {
?>
<input type="hidden" id="services_status-config" name="services_status-config" value="" />
<div id="services_status-settings" class="widgetconfigdiv" style="display:none;">
- <form action="/widgets/widgets/services_status.widget.php" method="post" name="iformd">
+ <form action="/widgets/widgets/services_status.widget.php" method="post" name="services_status_widget_iform">
Comma separated list of services to NOT display in the widget<br />
<input type="text" size="30" name="servicestatusfilter" class="formfld unknown" id="servicestatusfilter" value="<?= $config['widgets']['servicestatusfilter'] ?>" />
- <input id="submitd" name="submitd" type="submit" class="formbtn" value="Save" />
+ <input id="services_status_widget_submit" name="services_status_widget_submit" type="submit" class="formbtn" value="Save" />
</form>
</div>
diff --git a/usr/local/www/widgets/widgets/thermal_sensors.widget.php b/usr/local/www/widgets/widgets/thermal_sensors.widget.php
index 00a1bf1..0dac0cb 100644
--- a/usr/local/www/widgets/widgets/thermal_sensors.widget.php
+++ b/usr/local/www/widgets/widgets/thermal_sensors.widget.php
@@ -167,7 +167,7 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
<input type="hidden" id="thermal_sensors-config" name="thermal_sensors-config" value="" />
<div id="thermal_sensors-settings" class="widgetconfigdiv" style="display:none;">
- <form action="/widgets/widgets/thermal_sensors.widget.php" method="post" id="iform_thermal_sensors_settings" name="iform_thermal_sensors_settings">
+ <form action="/widgets/widgets/thermal_sensors.widget.php" method="post" id="thermal_sensors_widget_iform" name="thermal_sensors_widget_iform">
<table width="100%" border="0" summary="thermal sensors widget">
<tr>
<td align="left" colspan="2">
diff --git a/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/usr/local/www/widgets/widgets/traffic_graphs.widget.php
index b125740..c9f92b6 100644
--- a/usr/local/www/widgets/widgets/traffic_graphs.widget.php
+++ b/usr/local/www/widgets/widgets/traffic_graphs.widget.php
@@ -102,7 +102,7 @@ if (isset($a_config["scale_type"])) {
<input type="hidden" id="traffic_graphs-config" name="traffic_graphs-config" value="" />
<div id="traffic_graphs-settings" class="widgetconfigdiv" style="display:none;">
-<form action="/widgets/widgets/traffic_graphs.widget.php" method="post" name="iform" id="iform">
+<form action="/widgets/widgets/traffic_graphs.widget.php" method="post" name="traffic_graphs_widget_iform" id="traffic_graphs_widget_iform">
<?php foreach ($ifdescrs as $ifname => $ifdescr) { ?>
<input type="hidden" name="shown[<?= $ifname ?>]" value="<?= $shown[$ifname] ? "show" : "hide" ?>" />
<?php } ?>
@@ -129,7 +129,7 @@ if (isset($a_config["scale_type"])) {
<option value="<?= $i ?>" <?php if ($refreshinterval == $i) echo "selected=\"selected\"";?>><?= $i ?></option>
<?php } ?>
</select>&nbsp; Seconds<br />&nbsp; &nbsp; &nbsp; <b>Note:</b> changing this setting will increase CPU utilization<br /><br />
- <input id="submit_settings" name="submit_settings" type="submit" onclick="return updatePref();" class="formbtn" value="Save Settings" />
+ <input id="traffic_graphs_widget_submit" name="traffic_graphs_widget_submit" type="submit" onclick="return updatePref();" class="formbtn" value="Save Settings" />
</form>
</div>
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php
index e8f9e1f..adab493 100644
--- a/usr/local/www/wizard.php
+++ b/usr/local/www/wizard.php
@@ -78,7 +78,7 @@ if (empty($xml)) {
}
if (!is_array($pkg)) {
- print_info_box_np(sprintf(gettext("ERROR: Could not parse %s/wizards/%s file."),$g['www_path'],$xml));
+ print_info_box_np(sprintf(gettext("ERROR: Could not parse %s/wizards/%s file."), $g['www_path'], $xml));
die;
}
@@ -135,7 +135,7 @@ if ($_POST && !$input_errors) {
function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) {
global $config;
- $field_split = explode("->",$field);
+ $field_split = explode("->", $field);
foreach ($field_split as $f) {
$field_conv .= "['" . $f . "']";
}
@@ -200,8 +200,7 @@ if (file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) {
<script type="text/javascript">
//<![CDATA[
-function FieldValidate(userinput, regexp, message)
-{
+function FieldValidate(userinput, regexp, message) {
if (!userinput.match(regexp)) {
alert(message);
}
@@ -768,7 +767,7 @@ function showchange() {
sort($timezonelist);
/* kill carriage returns */
- for ($x=0; $x<count($timezonelist); $x++) {
+ for ($x = 0; $x < count($timezonelist); $x++) {
$timezonelist[$x] = str_replace("\n", "", $timezonelist[$x]);
}
@@ -876,7 +875,7 @@ function showchange() {
$aliases = "";
$addrisfirst = 0;
$aliasesaddr = "";
- if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
+ if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) {
foreach ($config['aliases']['alias'] as $alias_name) {
if ($isfirst == 1) {
$aliases .= ",";
@@ -884,6 +883,7 @@ function showchange() {
$aliases .= "'" . $alias_name['name'] . "'";
$isfirst = 1;
}
+ }
?>
var customarray=new Array(<?php echo $aliases; ?>);
@@ -891,7 +891,7 @@ function showchange() {
window.onload = function () {
<?php
- $counter=0;
+ $counter = 0;
foreach ($inputaliases as $alias) {
echo "var oTextbox$counter = new AutoSuggestControl(document.getElementById(\"$alias\"), new StateSuggestions(customarray));\n";
$counter++;
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php
index a0fb72a..5fd022a 100755
--- a/usr/local/www/xmlrpc.php
+++ b/usr/local/www/xmlrpc.php
@@ -246,7 +246,7 @@ function restore_config_section_xmlrpc($raw_params) {
/* Log what happened */
$mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done));
- write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
+ write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
/*
* The real work on handling the vips specially
@@ -341,7 +341,7 @@ function merge_installedpackages_section_xmlrpc($raw_params) {
}
$config['installedpackages'] = array_merge($config['installedpackages'], $params[0]);
$mergedkeys = implode(",", array_keys($params[0]));
- write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys));
+ write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
return $xmlrpc_g['return']['true'];
}
@@ -575,13 +575,13 @@ $server = new XML_RPC_Server(
unlock($xmlrpclockkey);
-function array_overlay($a1,$a2) {
+function array_overlay($a1, $a2) {
foreach ($a1 as $k => $v) {
- if (!array_key_exists($k,$a2)) {
+ if (!array_key_exists($k, $a2)) {
continue;
}
if (is_array($v) && is_array($a2[$k])) {
- $a1[$k] = array_overlay($v,$a2[$k]);
+ $a1[$k] = array_overlay($v, $a2[$k]);
} else {
$a1[$k] = $a2[$k];
}
diff --git a/usr/sbin/pc-sysinstall/Makefile b/usr/sbin/pc-sysinstall/Makefile
deleted file mode 100644
index 4705fc1..0000000
--- a/usr/sbin/pc-sysinstall/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/Makefile,v 1.1 2010/06/24 22:21:47 imp Exp $
-SUBDIR=backend backend-partmanager backend-query conf doc examples
-SUBDIR+=pc-sysinstall
-
-.include <bsd.subdir.mk>
diff --git a/usr/sbin/pc-sysinstall/Makefile.inc b/usr/sbin/pc-sysinstall/Makefile.inc
deleted file mode 100644
index a6d5881..0000000
--- a/usr/sbin/pc-sysinstall/Makefile.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/Makefile.inc,v 1.1 2010/06/27 17:14:04 imp Exp $
-
-.include "../Makefile.inc"
diff --git a/usr/sbin/pc-sysinstall/backend-partmanager/Makefile b/usr/sbin/pc-sysinstall/backend-partmanager/Makefile
deleted file mode 100644
index 256b380..0000000
--- a/usr/sbin/pc-sysinstall/backend-partmanager/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-partmanager/Makefile,v 1.2 2010/06/25 22:35:19 imp Exp $
-
-FILES= create-part.sh delete-part.sh
-FILESMODE= ${BINMODE}
-FILESDIR=${SHAREDIR}/pc-sysinstall/backend-partmanager
-NO_OBJ=
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/backend-partmanager/create-part.sh b/usr/sbin/pc-sysinstall/backend-partmanager/create-part.sh
deleted file mode 100755
index a68d2fb..0000000
--- a/usr/sbin/pc-sysinstall/backend-partmanager/create-part.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Query a disk for partitions and display them
-#############################
-
-. ${PROGDIR}/backend/functions.sh
-
-if [ -z "${1}" ] ; then
- echo "Error: No disk specified!"
- exit 1
-fi
-
-if [ -z "${2}" ] ; then
- echo "Error: No size specified!"
- exit 1
-fi
-
-if [ ! -e "/dev/${1}" ] ; then
- echo "Error: Disk /dev/${1} does not exist!"
- exit 1
-fi
-
-DISK="${1}"
-MB="${2}"
-
-TOTALBLOCKS="`expr $MB \* 2048`"
-
-
-# Lets figure out what number this slice will be
-LASTSLICE="`fdisk -s /dev/${DISK} 2>/dev/null | grep -v ${DISK} | grep ':' | tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
-if [ -z "${LASTSLICE}" ] ; then
- LASTSLICE="1"
-else
- LASTSLICE="`expr $LASTSLICE + 1`"
-fi
-
-if [ ${LASTSLICE} -gt "4" ] ; then
- echo "Error: FreeBSD MBR setups can only have a max of 4 slices"
- exit 1
-fi
-
-
-SLICENUM="${LASTSLICE}"
-
-# Lets get the starting block
-if [ "${SLICENUM}" = "1" ] ; then
- STARTBLOCK="63"
-else
- # Lets figure out where the prior slice ends
- checkslice="`expr ${SLICENUM} - 1`"
-
- # Get starting block of this slice
- fdisk -s /dev/${DISK} | grep -v "${DISK}:" | grep "${checkslice}:" | tr -s " " >${TMPDIR}/pfdisk
- pstartblock="`cat ${TMPDIR}/pfdisk | cut -d ' ' -f 3`"
- psize="`cat ${TMPDIR}/pfdisk | cut -d ' ' -f 4`"
- STARTBLOCK="`expr ${pstartblock} + ${psize}`"
-fi
-
-
-# If this is an empty disk, see if we need to create a new MBR scheme for it
-gpart show ${DISK} >/dev/null 2>/dev/null
-if [ "$?" != "0" -a "${SLICENUM}" = "1" ] ; then
- gpart create -s mbr ${DISK}
-fi
-
-gpart add -b ${STARTBLOCK} -s ${TOTALBLOCKS} -t freebsd -i ${SLICENUM} ${DISK}
-exit "$?"
diff --git a/usr/sbin/pc-sysinstall/backend-partmanager/delete-part.sh b/usr/sbin/pc-sysinstall/backend-partmanager/delete-part.sh
deleted file mode 100755
index db08205..0000000
--- a/usr/sbin/pc-sysinstall/backend-partmanager/delete-part.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Delete a specified partition, takes effect immediately
-########################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-disk.sh
-
-if [ -z "${1}" ]
-then
- echo "Error: No partition specified!"
- exit 1
-fi
-
-if [ ! -e "/dev/${1}" ]
-then
- echo "Error: Partition /dev/${1} does not exist!"
- exit 1
-fi
-
-PARTITION="${1}"
-
-# First lets figure out the partition number for the given device
-##################################################################
-
-# Get the number of characters in this dev
-CHARS="`echo $PARTITION | wc -c`"
-
-PARTINDEX=""
-
-# Lets read through backwards until we get the part number
-while
-z=1
-do
- CHARS=`expr $CHARS - 1`
- LAST_CHAR=`echo "${PARTITION}" | cut -c $CHARS`
- echo "${LAST_CHAR}" | grep "^[0-9]$" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- PARTINDEX="${LAST_CHAR}${PARTINDEX}"
- else
- break
- fi
-done
-
-# Now get current disk we are working on
-CHARS=`expr $CHARS - 1`
-DISK="`echo $PARTITION | cut -c 1-${CHARS}`"
-
-# Make sure we have a valid disk name still
-if [ ! -e "/dev/${DISK}" ] ; then
- echo "Error: Disk: ${DISK} doesnt exist!"
- exit 1
-fi
-
-echo "Running: gpart delete -i ${PARTINDEX} ${DISK}"
-gpart delete -i ${PARTINDEX} ${DISK} >/dev/null 2>/dev/null
-
-# Check if this was the last partition and destroy the disk geom if so
-get_disk_partitions "${DISK}"
-if [ -z "${VAL}" ] ; then
- gpart destroy ${DISK}
-fi
-
-exit "$?"
diff --git a/usr/sbin/pc-sysinstall/backend-query/Makefile b/usr/sbin/pc-sysinstall/backend-query/Makefile
deleted file mode 100644
index 3b65d4e..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/Makefile,v 1.6 2010/08/19 05:59:27 imp Exp $
-
-FILES= detect-laptop.sh detect-nics.sh detect-emulation.sh disk-info.sh \
- disk-list.sh disk-part.sh enable-net.sh get-packages.sh list-config.sh \
- list-components.sh list-mirrors.sh list-packages.sh list-rsync-backups.sh \
- list-tzones.sh query-langs.sh send-logs.sh set-mirror.sh setup-ssh-keys.sh \
- sys-mem.sh test-live.sh test-netup.sh update-part-list.sh xkeyboard-layouts.sh \
- xkeyboard-models.sh xkeyboard-variants.sh
-FILESMODE= ${BINMODE}
-FILESDIR=${SHAREDIR}/pc-sysinstall/backend-query
-NO_OBJ=
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/backend-query/detect-emulation.sh b/usr/sbin/pc-sysinstall/backend-query/detect-emulation.sh
deleted file mode 100755
index 81f8f26..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/detect-emulation.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh,v 1.1 2010/07/06 23:31:52 imp Exp $
-
-case "$(kenv smbios.system.product)" in
-VirtualBox)
- echo "emulation: VIRTUALBOX"
- exit 0
- ;;
-VMware*)
- echo "emulation: VMWARE"
- exit 0
- ;;
-*)
- echo "emulation: NO"
- exit 1
- ;;
-esac
diff --git a/usr/sbin/pc-sysinstall/backend-query/detect-laptop.sh b/usr/sbin/pc-sysinstall/backend-query/detect-laptop.sh
deleted file mode 100755
index 5fdadf3..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/detect-laptop.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh,v 1.4 2010/07/07 00:03:06 imp Exp $
-
-if devinfo | grep -q acpi_acad0; then
- echo "laptop: YES"
-else
- echo "laptop: NO"
-fi
diff --git a/usr/sbin/pc-sysinstall/backend-query/detect-nics.sh b/usr/sbin/pc-sysinstall/backend-query/detect-nics.sh
deleted file mode 100755
index b16d162..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/detect-nics.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh,v 1.3 2010/07/06 23:29:55 imp Exp $
-
-for i in $(ifconfig -l); do
- case "${i%%[0-9]*}" in
- lo|fwe|fwip|plip|pfsync|pflog|tun)
- continue
- ;;
- esac
- IDENT=$(dmesg | sed -n "s/^$i: <\(.*\)>.*$/\1/p" | head -1)
- echo "${i}: <$IDENT>"
-done
diff --git a/usr/sbin/pc-sysinstall/backend-query/disk-info.sh b/usr/sbin/pc-sysinstall/backend-query/disk-info.sh
deleted file mode 100755
index f64bdb8..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/disk-info.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/disk-info.sh,v 1.6 2010/10/28 06:45:20 imp Exp $
-
-# Query a disk for partitions and display them
-#############################################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-disk.sh
-
-DISK="${1}"
-
-[ -z "${DISK}" ] && { echo 'Error: No disk specified!'; exit 1; }
-[ ! -e "/dev/${DISK}" ] && \
- { echo "Error: Disk /dev/${DISK} does not exist!"; exit 1; }
-
-get_disk_cyl "${DISK}"
-CYLS="${VAL}"
-
-get_disk_heads "${DISK}"
-HEADS="${VAL}"
-
-get_disk_sectors "${DISK}"
-SECS="${VAL}"
-
-# Now get the disks size in MB
-KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
-MB=$(convert_byte_to_megabyte ${KB})
-
-# Now get the Controller Type
-CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`"
-
-echo "cylinders=${CYLS}"
-echo "heads=${HEADS}"
-echo "sectors=${SECS}"
-echo "size=${MB}"
-echo "type=${CTYPE}"
diff --git a/usr/sbin/pc-sysinstall/backend-query/disk-list.sh b/usr/sbin/pc-sysinstall/backend-query/disk-list.sh
deleted file mode 100755
index d836a82..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/disk-list.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/disk-list.sh,v 1.5 2010/09/08 20:10:24 imp Exp $
-
-ARGS=$1
-FLAGS_MD=""
-FLAGS_CD=""
-FLAGS_VERBOSE=""
-
-shift
-while [ -n "$1" ]
-do
- case "$1" in
- -m)
- FLAGS_MD=1
- ;;
- -v)
- FLAGS_VERBOSE=1
- ;;
- -c)
- FLAGS_CD=1
- ;;
- esac
- shift
-done
-
-# Create our device listing
-SYSDISK=$(sysctl -n kern.disks)
-if [ -n "${FLAGS_MD}" ]
-then
- MDS=`mdconfig -l`
- if [ -n "${MDS}" ]
- then
- SYSDISK="${SYSDISK} ${MDS}"
- fi
-fi
-
-# Now loop through these devices, and list the disk drives
-for i in ${SYSDISK}
-do
-
- # Get the current device
- DEV="${i}"
-
- # Make sure we don't find any cd devices
- if [ -z "${FLAGS_CD}" ]
- then
- case "${DEV}" in
- acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;;
- esac
- fi
-
- # Check the dmesg output for some more info about this device
- NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1)
- if [ -z "$NEWLINE" ]; then
- NEWLINE=" <Unknown Device>"
- fi
-
- if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null
- then
- NEWLINE=" <Memory Disk>"
- fi
-
- if [ -n "${FLAGS_VERBOSE}" ]
- then
- :
- fi
-
- # Save the disk list
- if [ ! -z "$DLIST" ]
- then
- DLIST="\n${DLIST}"
- fi
-
- DLIST="${DEV}:${NEWLINE}${DLIST}"
-
-done
-
-# Echo out the found line
-echo -e "$DLIST" | sort
diff --git a/usr/sbin/pc-sysinstall/backend-query/disk-part.sh b/usr/sbin/pc-sysinstall/backend-query/disk-part.sh
deleted file mode 100755
index 6e921ee..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/disk-part.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/disk-part.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Query a disk for partitions and display them
-#############################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-disk.sh
-
-if [ -z "${1}" ]
-then
- echo "Error: No disk specified!"
- exit 1
-fi
-
-if [ ! -e "/dev/${1}" ]
-then
- echo "Error: Disk /dev/${1} does not exist!"
- exit 1
-fi
-
-DISK="${1}"
-
-# Now get the disks size in MB
-KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`"
-MB=$(convert_byte_to_megabyte ${KB})
-TOTALSIZE="$MB"
-TOTALB="`diskinfo -v ${1} | grep 'in sectors' | tr -s '\t' ' ' | cut -d ' ' -f 2`"
-
-gpart show ${1} >/dev/null 2>/dev/null
-if [ "$?" != "0" ] ; then
- # No partitions on this disk, display entire disk size and exit
- echo "${1}-freemb: ${TOTALSIZE}"
- echo "${1}-freeblocks: ${TOTALB}"
- exit
-fi
-
-# Display if this is GPT or MBR formatted
-gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null
-if [ "$?" = "0" ] ; then
- echo "${1}-format: GPT"
- TYPE="GPT"
-else
- echo "${1}-format: MBR"
- TYPE="MBR"
-fi
-
-# Set some search flags
-PART="0"
-EXTENDED="0"
-START="0"
-SIZEB="0"
-
-# Get a listing of partitions on this disk
-get_disk_partitions "${DISK}"
-PARTS="${VAL}"
-for curpart in $PARTS
-do
-
- # First get the sysid / label for this partition
- if [ "$TYPE" = "MBR" ] ; then
- get_partition_sysid_mbr "${DISK}" "${curpart}"
- echo "${curpart}-sysid: ${VAL}"
- get_partition_label_mbr "${DISK}" "${curpart}"
- echo "${curpart}-label: ${VAL}"
- else
- get_partition_label_gpt "${DISK}" "${curpart}"
- echo "${curpart}-sysid: ${VAL}"
- echo "${curpart}-label: ${VAL}"
- fi
-
- # Now get the startblock, blocksize and MB size of this partition
-
- get_partition_startblock "${DISK}" "${curpart}"
- START="${VAL}"
- echo "${curpart}-blockstart: ${START}"
-
- get_partition_blocksize "${DISK}" "${curpart}"
- SIZEB="${VAL}"
- echo "${curpart}-blocksize: ${SIZEB}"
-
- SIZEMB=$(convert_blocks_to_megabyte ${SIZEB})
- echo "${curpart}-sizemb: ${SIZEMB}"
-
-done
-
-
-# Now calculate any free space
-LASTB="`expr $SIZEB + $START`"
-FREEB="`expr $TOTALB - $LASTB`"
-FREEMB="`expr ${FREEB} / 2048`"
-echo "${1}-freemb: $FREEMB"
-echo "${1}-freeblocks: $FREEB"
diff --git a/usr/sbin/pc-sysinstall/backend-query/enable-net.sh b/usr/sbin/pc-sysinstall/backend-query/enable-net.sh
deleted file mode 100755
index 339a562..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/enable-net.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/enable-net.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Script which enables networking with specified options
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/conf/pc-sysinstall.conf
-. ${BACKEND}/functions-networking.sh
-. ${BACKEND}/functions-parse.sh
-
-
-NIC="$1"
-IP="$2"
-NETMASK="$3"
-DNS="$4"
-GATEWAY="$5"
-MIRRORFETCH="$6"
-
-if [ -z "${NIC}" ]
-then
- echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>"
- exit 150
-fi
-
-if [ "$NIC" = "AUTO-DHCP" ]
-then
- enable_auto_dhcp
-else
- echo "Enabling NIC: $NIC"
- ifconfig ${NIC} ${IP} ${NETMASK}
-
- echo "nameserver ${DNS}" >/etc/resolv.conf
-
- route add default ${GATE}
-fi
-
-case ${MIRRORFETCH} in
- ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;;
- *) ;;
-esac
diff --git a/usr/sbin/pc-sysinstall/backend-query/get-packages.sh b/usr/sbin/pc-sysinstall/backend-query/get-packages.sh
deleted file mode 100755
index 7427326..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/get-packages.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/get-packages.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Script which lists the available packages for this release
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-packages.sh
-
-ID=`id -u`
-if [ "${ID}" -ne "0" ]
-then
- echo "Error: must be root!"
- exit 1
-fi
-
-if [ ! -f "${PKGDIR}/INDEX" ]
-then
- get_package_index
-fi
-
-if [ -f "${PKGDIR}/INDEX" ]
-then
- echo "${PKGDIR}/INDEX"
- exit 0
-fi
-
-exit 1
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-components.sh b/usr/sbin/pc-sysinstall/backend-query/list-components.sh
deleted file mode 100755
index e55233e..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-components.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-components.sh,v 1.3 2010/10/21 17:23:48 imp Exp $
-
-# Script which lists the available components for this release
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-
-echo "Available Components:"
-
-if [ -d "${COMPDIR}" ]
-then
- cd ${COMPDIR}
- for i in `ls -d *`
- do
- if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ]
- then
- NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`"
- DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`"
- TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`"
- echo " "
- echo "name: ${i}"
- echo "desc:${DESC}"
- echo "type:${TYPE}"
- if [ -e "${i}/component.png" ]
- then
- echo "icon: ${COMPDIR}/${i}/component.png"
- fi
- fi
- done
-fi
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-config.sh b/usr/sbin/pc-sysinstall/backend-query/list-config.sh
deleted file mode 100755
index 6532031..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-config.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-config.sh,v 1.2 2010/07/13 23:47:12 imp Exp $
-
-echo "branch=${FBSD_BRANCH}"
-echo "arch=${FBSD_ARCH}"
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-mirrors.sh b/usr/sbin/pc-sysinstall/backend-query/list-mirrors.sh
deleted file mode 100755
index a4b143f..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-mirrors.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh,v 1.2 2010/07/13 23:47:12 imp Exp $
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-ftp.sh
-
-# Backend script which lists all the available ftp mirrors for front-ends to display
-COUNTRY="${1}"
-
-get_ftp_mirrors "${COUNTRY}"
-show_mirrors "${VAL}"
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-packages.sh b/usr/sbin/pc-sysinstall/backend-query/list-packages.sh
deleted file mode 100755
index 97bec8c..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-packages.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-packages.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Script which lists the available packages for this release
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-packages.sh
-
-PACKAGE_CATEGORY="${1}"
-PACKAGE_NAME="${2}"
-NARGS=0
-
-if [ ! -f "${PKGDIR}/INDEX" ]
-then
- echo "Error: please fetch package index with get-packages!"
- exit 1
-fi
-
-if [ ! -f "${PKGDIR}/INDEX.parsed" ]
-then
- parse_package_index
-fi
-
-if [ -n "${PACKAGE_CATEGORY}" ]
-then
- NARGS=$((NARGS+1))
-fi
-
-if [ -n "${PACKAGE_NAME}" ]
-then
- NARGS=$((NARGS+1))
-fi
-
-if [ "${NARGS}" -eq "0" ]
-then
- show_packages
-
-elif [ "${NARGS}" -eq "1" ]
-then
-
- if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ]
- then
- if [ -f "${PKGDIR}/INDEX" ]
- then
- echo "${PKGDIR}/INDEX"
- exit 0
- else
- exit 1
- fi
-
- else
- show_packages_by_category "${PACKAGE_CATEGORY}"
- fi
-
-elif [ "${NARGS}" -eq "2" ]
-then
- show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}"
-
-else
- show_packages
-fi
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-rsync-backups.sh b/usr/sbin/pc-sysinstall/backend-query/list-rsync-backups.sh
deleted file mode 100755
index 3459528..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-rsync-backups.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Script which lists the backups present on a server
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-
-SSHUSER=$1
-SSHHOST=$2
-SSHPORT=$3
-
-if [ -z "${SSHHOST}" -o -z "${SSHPORT}" ]
-then
- echo "ERROR: Usage list-rsync-backups.sh <user> <host> <port>"
- exit 150
-fi
-
-# Look for full-system backups, needs at minimum a kernel to be bootable
-FINDCMD="find . -type d -maxdepth 6 -name 'kernel' | grep '/boot/kernel'"
-
-# Get a listing of the number of full backups saved
-OLDBACKUPS=`ssh -o 'BatchMode=yes' -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "${FINDCMD}"`
-if [ "$?" = "0" ]
-then
- for i in ${OLDBACKUPS}
- do
- BACKPATH="`echo ${i} | sed 's|/boot/.*||g' | sed 's|^./||g'`"
- if [ -z "${BACKLIST}" ]
- then
- BACKLIST="${BACKPATH}"
- else
- BACKLIST="${BACKLIST}:${BACKPATH}"
- fi
- done
-
- if [ -z "${BACKLIST}" ]
- then
- echo "NONE"
- else
- echo "$BACKLIST"
- fi
-
-else
- echo "FAILED"
-fi
diff --git a/usr/sbin/pc-sysinstall/backend-query/list-tzones.sh b/usr/sbin/pc-sysinstall/backend-query/list-tzones.sh
deleted file mode 100755
index 7e4bac4..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/list-tzones.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh,v 1.3 2010/10/19 15:18:40 emaste Exp $
-
-# Backend script which lists all the available timezones for front-ends to display
-egrep -v '^#' /usr/share/zoneinfo/zone.tab |\
- tr -s "\t" ":" |\
- cut -d ":" -f 3-4 |\
- sort
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/query-langs.sh b/usr/sbin/pc-sysinstall/backend-query/query-langs.sh
deleted file mode 100755
index 336e8dd..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/query-langs.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/query-langs.sh,v 1.3 2010/10/22 00:10:48 imp Exp $
-
-cat ${PROGDIR}/conf/avail-langs
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/send-logs.sh b/usr/sbin/pc-sysinstall/backend-query/send-logs.sh
deleted file mode 100755
index 155169c..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/send-logs.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/send-logs.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Script which creates a gzipped log and optionally mails it to the specified address
-############################################################################
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/conf/pc-sysinstall.conf
-. ${BACKEND}/functions-networking.sh
-. ${BACKEND}/functions-parse.sh
-
-# Bring up all NICS under DHCP
-enable_auto_dhcp
-
-MAILTO="$1"
-MAILRESULT="0"
-
-# Set the location of our compressed log
-TMPLOG="/tmp/pc-sysinstall.log"
-
-echo "# PC-SYSINSTALL LOG" >${TMPLOG}
-cat ${LOGOUT} >> ${TMPLOG}
-
-# Check if we have a GUI generated install cfg
-if [ -e "/tmp/sys-install.cfg" ]
-then
- echo "" >>${TMPLOG}
- echo "# PC-SYSINSTALL CFG " >>${TMPLOG}
- cat /tmp/sys-install.cfg >> ${TMPLOG}
-fi
-
-# Save dmesg output
-echo "" >>${TMPLOG}
-echo "# DMESG OUTPUT " >>${TMPLOG}
-dmesg >> ${TMPLOG}
-
-# Get gpart info on all disks
-for i in `${PROGDIR}/pc-sysinstall disk-list | cut -d ':' -f 1`
-do
- echo "" >>${TMPLOG}
- echo "# DISK INFO $i " >>${TMPLOG}
- ls /dev/${i}* >>${TMPLOG}
- gpart show ${i} >> ${TMPLOG}
-done
-
-# Show Mounted volumes
-echo "" >>${TMPLOG}
-echo "# MOUNT OUTPUT " >>${TMPLOG}
-mount >> ${TMPLOG}
-
-echo "Log file saved to ${TMPLOG}"
-echo "Warning: This file will be lost once the system is rebooted."
-
-echo "Do you wish to view this logfile now? (Y/N)"
-read tmp
-if [ "$tmp" = "Y" -o "$tmp" = "y" ]
-then
- more ${TMPLOG}
-fi
diff --git a/usr/sbin/pc-sysinstall/backend-query/set-mirror.sh b/usr/sbin/pc-sysinstall/backend-query/set-mirror.sh
deleted file mode 100644
index fe4daf8..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/set-mirror.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXSystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh,v 1.2 2010/08/24 06:11:46 imp Exp $
-
-. ${PROGDIR}/backend/functions.sh
-. ${PROGDIR}/backend/functions-ftp.sh
-
-MIRROR="${1}"
-
-if [ -z "${MIRROR}" ]
-then
- echo "Error: No mirror specified!"
- exit 1
-fi
-
-set_ftp_mirror "${MIRROR}"
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh b/usr/sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh
deleted file mode 100755
index 9fe6b97..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Script which sets up password-less logins for ssh host
-###########################################################################
-
-. ${PROGDIR}/backend/functions.sh
-
-SSHUSER=$1
-SSHHOST=$2
-SSHPORT=$3
-
-if [ -z "${SSHUSER}" -o -z "${SSHHOST}" -o -z "${SSHPORT}" ]
-then
- echo "ERROR: Usage setup-ssh-keys <user> <host> <port>"
- exit 150
-fi
-
-cd ~
-
-echo "Preparing to setup SSH key authorization..."
-echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}"
-
-if [ ! -e ".ssh/id_rsa.pub" ]
-then
- mkdir .ssh >/dev/null 2>/dev/null
- ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa
- sleep 1
-fi
-
-if [ ! -e ".ssh/id_rsa.pub" ]
-then
- echo "ERROR: Failed creating .ssh/id_rsa.pub"
- exit 150
-fi
-
-# Get the .pub key
-PUBKEY="`cat .ssh/id_rsa.pub`"
-
-ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "mkdir .ssh ; echo $PUBKEY >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys ; echo $PUBKEY >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2"
diff --git a/usr/sbin/pc-sysinstall/backend-query/sys-mem.sh b/usr/sbin/pc-sysinstall/backend-query/sys-mem.sh
deleted file mode 100755
index 8577c29..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/sys-mem.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh,v 1.3 2010/10/19 15:12:16 emaste Exp $
-
-expr $(sysctl -n hw.realmem) / 1048576
diff --git a/usr/sbin/pc-sysinstall/backend-query/test-live.sh b/usr/sbin/pc-sysinstall/backend-query/test-live.sh
deleted file mode 100755
index 43f4298..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/test-live.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/test-live.sh,v 1.3 2010/10/22 00:11:55 imp Exp $
-
-# Script which checks if we are running from install media, or real system
-#############################################################################
-
-dmesg | grep -q 'md0: Preloaded image' || { echo 'REAL-DISK'; exit 1; }
-
-echo 'INSTALL-MEDIA'
diff --git a/usr/sbin/pc-sysinstall/backend-query/test-netup.sh b/usr/sbin/pc-sysinstall/backend-query/test-netup.sh
deleted file mode 100755
index aa3e277..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/test-netup.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/test-netup.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-
-# Script which tests "fetch" when using a network connection, and saves
-# if we are using direct connect, or need FTP passive mode
-#############################################################################
-
-rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null
-
-ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
- echo "ftp: Up"
- exit 0
-fi
-
-ping -c 2 www.freebsd.org >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
- echo "ftp: Up"
- exit 0
-fi
-
-echo "ftp: Down"
-exit 1
diff --git a/usr/sbin/pc-sysinstall/backend-query/update-part-list.sh b/usr/sbin/pc-sysinstall/backend-query/update-part-list.sh
deleted file mode 100755
index 7fb87ec..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/update-part-list.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Need access to a some unmount functions
-. ${PROGDIR}/backend/functions-unmount.sh
-
-echo "Running: find-update-parts" >> ${LOGOUT}
-
-rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null
-
-FSMNT="/mnt"
-
-# Get the freebsd version on this partition
-get_fbsd_ver()
-{
-
- VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`"
- if [ "$?" = "0" ] ; then
- file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null
- if [ "${?}" = "0" ] ; then
- echo "${1}: FreeBSD ${VER} (32bit)"
- else
- echo "${1}: FreeBSD ${VER} (64bit)"
- fi
- fi
-
-}
-
-# Create our device listing
-SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`"
-DEVS=""
-
-# Now loop through these devices, and list the disk drives
-for i in ${SYSDISK}
-do
-
- # Get the current device
- DEV="${i}"
- # Make sure we don't find any cd devices
- echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then
- DEVS="${DEVS} `ls /dev/${i}*`"
- fi
-
-done
-
-# Search for regular UFS / Geom Partitions to upgrade
-for i in $DEVS
-do
- if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then
- continue
- fi
-
- if [ -e "${i}a.journal" ] ; then
- _dsk="${i}a.journal"
- elif [ -e "${i}a" ] ; then
- _dsk="${i}a"
- elif [ -e "${i}p2" ] ; then
- _dsk="${i}p2"
- elif [ -e "${i}p2.journal" ] ; then
- _dsk="${i}p2.journal"
- fi
-
- mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
- if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
- get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`"
- umount -f ${FSMNT} >/dev/null 2>/dev/null
- fi
-done
-
-# Now search for any ZFS root partitions
-zpool import -o altroot=${FSMNT} -a
-
-# Unmount any auto-mounted stuff
-umount_all_dir "${FSMNT}"
-
-# Get pools
-_zps="`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`"
-for _zpools in ${_zps}
-do
- mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
- if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
- get_fbsd_ver "${_zpools}"
- umount -f ${FSMNT} >/dev/null 2>/dev/null
- fi
-done
diff --git a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh b/usr/sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
deleted file mode 100755
index 372696f..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-FOUND="0"
-
-# Lets parse the xorg.list file, and see what layouts are supported
-while read line
-do
-
- if [ "$FOUND" = "1" -a ! -z "$line" ]
- then
- echo $line | grep '! ' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- exit 0
- else
- echo "$line"
- fi
- fi
-
- if [ "${FOUND}" = "0" ]
- then
- echo $line | grep '! layout' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FOUND="1"
- fi
- fi
-
-done < /usr/local/share/X11/xkb/rules/xorg.lst
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-models.sh b/usr/sbin/pc-sysinstall/backend-query/xkeyboard-models.sh
deleted file mode 100755
index f8e72c2..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-models.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-FOUND="0"
-
-# Lets parse the xorg.list file, and see what models are supported
-while read line
-do
-
- if [ "$FOUND" = "1" -a ! -z "$line" ]
- then
- echo $line | grep '! ' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- exit 0
- else
- model="`echo $line | sed 's|(|[|g'`"
- model="`echo $model | sed 's|)|]|g'`"
- echo "$model"
- fi
- fi
-
- if [ "${FOUND}" = "0" ]
- then
- echo $line | grep '! model' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FOUND="1"
- fi
- fi
-
-done < /usr/local/share/X11/xkb/rules/xorg.lst
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh b/usr/sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh
deleted file mode 100755
index cff6b0e..0000000
--- a/usr/sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-FOUND="0"
-
-# Lets parse the xorg.list file, and see what varients are supported
-while read line
-do
-
- if [ "$FOUND" = "1" -a ! -z "$line" ]
- then
- echo $line | grep '! ' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- exit 0
- else
- echo "$line"
- fi
- fi
-
- if [ "${FOUND}" = "0" ]
- then
- echo $line | grep '! variant' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FOUND="1"
- fi
- fi
-
-done < /usr/local/share/X11/xkb/rules/xorg.lst
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend/Makefile b/usr/sbin/pc-sysinstall/backend/Makefile
deleted file mode 100755
index 2b4693d..0000000
--- a/usr/sbin/pc-sysinstall/backend/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/Makefile,v 1.6 2010/09/08 20:10:24 imp Exp $
-
-FILES= functions-bsdlabel.sh functions-cleanup.sh functions-disk.sh \
- functions-extractimage.sh functions-ftp.sh functions-installcomponents.sh \
- functions-installpackages.sh functions-localize.sh functions-mountdisk.sh \
- functions-mountoptical.sh functions-networking.sh \
- functions-newfs.sh functions-packages.sh functions-parse.sh \
- functions-runcommands.sh functions-unmount.sh \
- functions-upgrade.sh functions-users.sh \
- functions.sh parseconfig.sh startautoinstall.sh installimage.sh
-FILESMODE= ${BINMODE}
-FILESDIR=${SHAREDIR}/pc-sysinstall/backend
-NO_OBJ=
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/backend/functions-bsdlabel.sh b/usr/sbin/pc-sysinstall/backend/functions-bsdlabel.sh
deleted file mode 100755
index 25dfcc5..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-bsdlabel.sh
+++ /dev/null
@@ -1,819 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh,v 1.9 2010/10/21 22:46:10 imp Exp $
-
-# Functions related to disk operations using bsdlabel
-
-# Check if we are are provided a geli password on the nextline of the config
-check_for_enc_pass()
-{
- CURLINE="${1}"
-
- get_next_cfg_line "${CFGF}" "${CURLINE}"
- echo ${VAL} | grep "^encpass=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- # Found a password, return it
- get_value_from_string "${VAL}"
- return
- fi
-
- VAL="" ; export VAL
- return
-};
-
-# On check on the disk-label line if we have any extra vars for this device
-# Only enabled for ZFS devices now, may add other xtra options in future for other FS's
-get_fs_line_xvars()
-{
- ACTIVEDEV="${1}"
- LINE="${2}"
-
- echo $LINE | grep ' (' >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
-
- # See if we are looking for ZFS specific options
- echo $LINE | grep '^ZFS' >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- ZTYPE="NONE"
- ZFSVARS="`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`"
-
- echo $ZFSVARS | grep -E "^(disk|file|mirror|raidz(1|2)?|spare|log|cache):" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
- ZFSVARS=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"`
- fi
-
- # Return the ZFS options
- if [ "${ZTYPE}" = "NONE" ] ; then
- VAR="${ACTIVEDEV} ${ZFSVARS}"
- else
- VAR="${ZTYPE} ${ACTIVEDEV} ${ZFSVARS}"
- fi
- export VAR
- return
- fi # End of ZFS block
-
- fi # End of xtra-options block
-
- # If we got here, set VAR to empty and export
- VAR=""
- export VAR
- return
-};
-
-# Init each zfs mirror disk with a boot sector so we can failover
-setup_zfs_mirror_parts()
-{
- _nZFS=""
-
- # Using mirroring, setup boot partitions on each disk
- _mirrline="`echo ${1} | sed 's|mirror ||g'`"
- for _zvars in $_mirrline
- do
- echo "Looping through _zvars: $_zvars" >>${LOGOUT}
- echo "$_zvars" | grep "${2}" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then continue ; fi
- if [ -z "$_zvars" ] ; then continue ; fi
-
- is_disk "$_zvars" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- echo "Setting up ZFS mirror disk $_zvars" >>${LOGOUT}
- init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null
- rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null
- rc_halt "gpart add -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null
- _nZFS="$_nZFS ${_zvars}p2"
- else
- _nZFS="$_nZFS ${_zvars}"
- fi
- done
- echo "mirror $2 `echo $_nZFS | tr -s ' '`"
-} ;
-
-# Function which creates a unique label name for the specified mount
-gen_glabel_name()
-{
- MOUNT="$1"
- TYPE="$2"
- NUM="0"
- MAXNUM="20"
-
- # Check if we are doing /, and rename it
- if [ "$MOUNT" = "/" ]
- then
- NAME=`cat /etc/inc/globals.inc | grep product_name | awk '{ print $3 }' | cut -d'"' -f2`
- else
- # If doing a swap partition, also rename it
- if [ "${TYPE}" = "SWAP" ]
- then
- NAME="swap"
- else
- NAME="`echo $MOUNT | sed 's|/||g' | sed 's| ||g'`"
- fi
- fi
-
- # Loop through and break when we find our first available label
- while
- Z=1
- do
- glabel status | grep "${NAME}${NUM}" >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- break
- else
- NUM="`expr ${NUM} + 1`"
- fi
-
- if [ $NUM -gt $MAXNUM ]
- then
- exit_err "Cannot allocate additional glabel name for $NAME"
- break
- fi
- done
-
-
- VAL="${NAME}${NUM}"
- export VAL
-};
-
-# Function to setup / stamp a legacy MBR bsdlabel
-setup_mbr_partitions()
-{
- DISKTAG="$1"
- WRKSLICE="$2"
- FOUNDPARTS="1"
-
- # Lets setup the BSDLABEL
- BSDLABEL="${TMPDIR}/bsdLabel-${WRKSLICE}"
- export BSDLABEL
- rm $BSDLABEL >/dev/null 2>/dev/null
- echo "# /dev/${WRKSLICE}" >>$BSDLABEL
- echo "8 partitions:" >>$BSDLABEL
- echo "# size offset fstype bsize bps/cpg" >>$BSDLABEL
-
- PARTLETTER="a"
-
- # Lets read in the config file now and populate this
- while read line
- do
- # Check for data on this slice
- echo $line | grep "^${DISKTAG}-part=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found a slice- entry, lets get the slice info
- get_value_from_string "${line}"
- STRING="$VAL"
- FOUNDPARTS="0"
-
- # We need to split up the string now, and pick out the variables
- FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1`
- SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
- MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3`
-
- if echo $STRING | grep -E '^/.+' >/dev/null 2>&1
- then
- IMAGE=`echo ${STRING} | cut -f1 -d' '`
- fi
-
- # Check if we have a .eli extension on this FS
- echo ${FS} | grep ".eli" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FS="`echo ${FS} | cut -d '.' -f 1`"
- ENC="ON"
- check_for_enc_pass "${line}"
- if [ "${VAL}" != "" ] ; then
- # We have a user supplied password, save it for later
- ENCPASS="${VAL}"
- fi
- else
- ENC="OFF"
- fi
-
- # Check if the user tried to setup / as an encrypted partition
- check_for_mount "${MNT}" "/"
- if [ "${?}" = "0" -a "${ENC}" = "ON" ]
- then
- USINGENCROOT="0" ; export USINGENCROOT
- fi
-
- if [ -n "${IMAGE}" ]
- then
- FS="IMAGE"
- SIZE=`ls -l "${IMAGE}" | awk '{ print $5 }'`
- MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
- SIZE=`convert_byte_to_megabyte $SIZE`
- fi
-
- # Now check that these values are sane
- case $FS in
- UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP|IMAGE) ;;
- *) exit_err "ERROR: Invalid file system specified on $line" ;;
- esac
-
- # Check that we have a valid size number
- expr $SIZE + 1 >/dev/null 2>/dev/null
- if [ "$?" != "0" ]; then
- exit_err "ERROR: The size specified on $line is invalid"
- fi
-
- # Check that the mount-point starts with /
- echo "$MNT" | grep -e "^/" -e "^none" >/dev/null 2>/dev/null
- if [ "$?" != "0" ]; then
- exit_err "ERROR: The mount-point specified on $line is invalid"
- fi
-
- if [ "$SIZE" = "0" ]
- then
- SOUT="*"
- else
- SOUT="${SIZE}M"
- fi
-
- # OK, we passed all tests, now lets put these values into a config
- # If the part
- if [ "${PARTLETTER}" = "a" ]
- then
- if [ "$FS" = "SWAP" ]
- then
- echo "a: ${SOUT} * swap 0 0" >>${BSDLABEL}
- else
- echo "a: ${SOUT} 0 4.2BSD 0 0" >>${BSDLABEL}
- fi
-
- # Check if we found a valid root partition
- check_for_mount "${MNT}" "/"
- if [ "$?" = "0" ] ; then
- FOUNDROOT="0" ; export FOUNDROOT
- fi
-
- # Check if we have a "/boot" instead
- check_for_mount "${MNT}" "/boot"
- if [ "${?}" = "0" ] ; then
- USINGBOOTPART="0" ; export USINGBOOTPART
- if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ]
- then
- exit_err "/boot partition must be formatted with UFS"
- fi
- fi
-
- else
- # Done with the a: partitions
-
- # Check if we found a valid root partition not on a:
- check_for_mount "${MNT}" "/"
- if [ "${?}" = "0" ] ; then
- FOUNDROOT="1" ; export FOUNDROOT
- fi
-
- # Check if we have a /boot partition, and fail since its not first
- check_for_mount "${MNT}" "/boot"
- if [ "${?}" = "0" ] ; then
- exit_err "/boot partition must be first partition"
- fi
-
-
- if [ "$FS" = "SWAP" ]
- then
- echo "${PARTLETTER}: ${SOUT} * swap" >>${BSDLABEL}
- else
- echo "${PARTLETTER}: ${SOUT} * 4.2BSD" >>${BSDLABEL}
- fi
- fi
-
- # Generate a unique label name for this mount
- gen_glabel_name "${MNT}" "${FS}"
- PLABEL="${VAL}"
-
- # Get any extra options for this fs / line
- get_fs_line_xvars "${WRKSLICE}${PARTLETTER}" "${STRING}"
- XTRAOPTS="${VAR}"
-
- # Check if using zfs mirror
- echo ${XTRAOPTS} | grep "mirror" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${WRKSLICE}${PARTLETTER}")
- fi
-
- # Save this data to our partition config dir
- echo "${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE}" >${PARTDIR}/${WRKSLICE}${PARTLETTER}
-
- # If we have a enc password, save it as well
- if [ ! -z "${ENCPASS}" ] ; then
- echo "${ENCPASS}" >${PARTDIR}-enc/${WRKSLICE}${PARTLETTER}-encpass
- fi
-
- # This partition letter is used, get the next one
- case ${PARTLETTER} in
- a) PARTLETTER="b" ;;
- b) # When we hit b, add the special c: setup for bsdlabel
- echo "c: * * unused" >>${BSDLABEL}
- PARTLETTER="d" ;;
- d) PARTLETTER="e" ;;
- e) PARTLETTER="f" ;;
- f) PARTLETTER="g" ;;
- g) PARTLETTER="h" ;;
- h) PARTLETTER="ERR" ;;
- *) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;;
- esac
-
- unset IMAGE
-
- fi # End of subsection locating a slice in config
-
- echo $line | grep "^commitDiskLabel" >/dev/null 2>/dev/null
- if [ "$?" = "0" -a "${FOUNDPARTS}" = "0" ]
- then
- # Found our flag to commit this label setup, check that we found at least 1 partition and do it
- if [ "${PARTLETTER}" != "a" ]
- then
- # Check if we only had 1 partition, and make sure we add "c:" section to label
- if [ "${PARTLETTER}" = "b" ]
- then
- echo "c: * * unused" >>${BSDLABEL}
- fi
-
- echo "bsdlabel -R -B /dev/${WRKSLICE} ${BSDLABEL}"
- bsdlabel -R -B ${WRKSLICE} ${BSDLABEL}
-
- break
- else
- exit_err "ERROR: commitDiskLabel was called without any partition entries for it!"
- fi
- fi
- done <${CFGF}
-};
-
-# Function to setup partitions using gpt
-setup_gpt_partitions()
-{
- DISKTAG="$1"
- DISK="$2"
- FOUNDPARTS="1"
-
- # Lets read in the config file now and setup our GPT partitions
- CURPART="2"
- while read line
- do
- # Check for data on this slice
- echo $line | grep "^${DISKTAG}-part=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FOUNDPARTS="0"
- # Found a slice- entry, lets get the slice info
- get_value_from_string "${line}"
- STRING="$VAL"
-
- # We need to split up the string now, and pick out the variables
- FS=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 1`
- SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2`
- MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3`
-
- # Check if we have a .eli extension on this FS
- echo ${FS} | grep ".eli" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- FS="`echo ${FS} | cut -d '.' -f 1`"
- ENC="ON"
- check_for_enc_pass "${line}"
- if [ "${VAL}" != "" ] ; then
- # We have a user supplied password, save it for later
- ENCPASS="${VAL}"
- fi
- else
- ENC="OFF"
- fi
-
- # Check if the user tried to setup / as an encrypted partition
- check_for_mount "${MNT}" "/"
- if [ "${?}" = "0" -a "${ENC}" = "ON" ]
- then
- USINGENCROOT="0" ; export USINGENCROOT
- fi
-
- # Now check that these values are sane
- case $FS in
- UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP) ;;
- *) exit_err "ERROR: Invalid file system specified on $line" ;;
- esac
-
- # Check that we have a valid size number
- expr $SIZE + 1 >/dev/null 2>/dev/null
- if [ "$?" != "0" ]; then
- exit_err "ERROR: The size specified on $line is invalid"
- fi
-
- # Check that the mount-point starts with /
- echo "$MNT" | grep -e "^/" -e "^none" >/dev/null 2>/dev/null
- if [ "$?" != "0" ]; then
- exit_err "ERROR: The mount-point specified on $line is invalid"
- fi
-
- if [ "$SIZE" = "0" ]
- then
- SOUT=""
- else
- SOUT="-s ${SIZE}M"
- fi
-
- # Check if we found a valid root partition
- check_for_mount "${MNT}" "/"
- if [ "${?}" = "0" ] ; then
- if [ "${CURPART}" = "2" ] ; then
- FOUNDROOT="0" ; export FOUNDROOT
- else
- FOUNDROOT="1" ; export FOUNDROOT
- fi
- fi
-
- check_for_mount "${MNT}" "/boot"
- if [ "${?}" = "0" ] ; then
- if [ "${CURPART}" = "2" ] ; then
- USINGBOOTPART="0" ; export USINGBOOTPART
- if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ]
- then
- exit_err "/boot partition must be formatted with UFS"
- fi
- else
- exit_err "/boot partition must be first partition"
- fi
- fi
-
- # Generate a unique label name for this mount
- gen_glabel_name "${MNT}" "${FS}"
- PLABEL="${VAL}"
-
- # Get any extra options for this fs / line
- get_fs_line_xvars "${DISK}p${CURPART}" "${STRING}"
- XTRAOPTS="${VAR}"
-
- # Check if using zfs mirror
- echo ${XTRAOPTS} | grep "mirror" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- XTRAOPTS=$(setup_zfs_mirror_parts "$XTRAOPTS" "${DISK}p${CURPART}")
- fi
-
- # Figure out the gpart type to use
- case ${FS} in
- ZFS) PARTYPE="freebsd-zfs" ;;
- SWAP) PARTYPE="freebsd-swap" ;;
- *) PARTYPE="freebsd-ufs" ;;
- esac
-
- # Create the partition
- rc_halt "gpart add ${SOUT} -t ${PARTYPE} ${DISK}"
-
- # Check if this is a root / boot partition, and stamp the right loader
- for TESTMNT in `echo ${MNT} | sed 's|,| |g'`
- do
- if [ "${TESTMNT}" = "/" -a -z "${BOOTTYPE}" ] ; then
- BOOTTYPE="${PARTYPE}"
- fi
- if [ "${TESTMNT}" = "/boot" ] ; then
- BOOTTYPE="${PARTYPE}"
- fi
- done
-
- # Save this data to our partition config dir
- echo "${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS}" >${PARTDIR}/${DISK}p${CURPART}
-
- # Clear out any headers
- sleep 2
- dd if=/dev/zero of=${DISK}p${CURPART} count=2048 >/dev/null 2>/dev/null
-
- # If we have a enc password, save it as well
- if [ ! -z "${ENCPASS}" ] ; then
- echo "${ENCPASS}" >${PARTDIR}-enc/${DISK}p${CURPART}-encpass
- fi
-
- # Increment our parts counter
- CURPART="`expr ${CURPART} + 1`"
-
- fi # End of subsection locating a slice in config
-
- echo $line | grep "^commitDiskLabel" >/dev/null 2>/dev/null
- if [ "$?" = "0" -a "${FOUNDPARTS}" = "0" ]
- then
-
- # If this is the boot disk, stamp the right gptboot
- if [ ! -z "${BOOTTYPE}" ] ; then
- case ${BOOTTYPE} in
- freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;;
- freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;;
- esac
- fi
-
-
- # Found our flag to commit this label setup, check that we found at least 1 partition
- if [ "${CURPART}" = "2" ] ; then
- exit_err "ERROR: commitDiskLabel was called without any partition entries for it!"
- fi
-
- break
- fi
- done <${CFGF}
-};
-
-# Reads through the config and sets up a BSDLabel for the given slice
-populate_disk_label()
-{
- if [ -z "${1}" ]
- then
- exit_err "ERROR: populate_disk_label() called without argument!"
- fi
-
- # Set some vars from the given working slice
- disk="`echo $1 | cut -d '-' -f 1`"
- slicenum="`echo $1 | cut -d '-' -f 2`"
- type="`echo $1 | cut -d '-' -f 3`"
-
- # Set WRKSLICE based upon format we are using
- if [ "$type" = "mbr" ] ; then
- wrkslice="${disk}s${slicenum}"
- fi
- if [ "$type" = "gpt" ] ; then
- wrkslice="${disk}p${slicenum}"
- fi
-
- if [ -e "${SLICECFGDIR}/${wrkslice}" ]
- then
- disktag="`cat ${SLICECFGDIR}/${wrkslice}`"
- else
- exit_err "ERROR: Missing SLICETAG data. This shouldn't happen - please let the developers know"
- fi
-
- # Using Traditional MBR for dual-booting
- if [ "$type" = "mbr" ] ; then
- setup_mbr_partitions "${disktag}" "${wrkslice}"
- fi
-
- # Using entire disk mode, use GPT for this
- if [ "$type" = "gpt" ] ; then
- setup_gpt_partitions "${disktag}" "${disk}"
- fi
-
-};
-
-# Function which reads in the disk slice config, and performs it
-setup_disk_label()
-{
- # We are ready to start setting up the label, lets read the config and do the actions
- # First confirm that we have a valid WORKINGSLICES
- if [ -z "${WORKINGSLICES}" ]; then
- exit_err "ERROR: No slices were setup! Please report this to the maintainers"
- fi
-
- # Check that the slices we have did indeed get setup and gpart worked
- for i in $WORKINGSLICES
- do
- disk="`echo $i | cut -d '-' -f 1`"
- pnum="`echo $i | cut -d '-' -f 2`"
- type="`echo $i | cut -d '-' -f 3`"
- if [ "$type" = "mbr" -a ! -e "/dev/${disk}s${pnum}" ] ; then
- exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!"
- fi
- if [ "$type" = "gpt" -a ! -e "/dev/${disk}p${pnum}" ] ; then
- exit_err "ERROR: The partition ${i} doesn't exist! gpart failure!"
- fi
- done
-
- # Setup some files which we'll be referring to
- LABELLIST="${TMPDIR}/workingLabels"
- export LABELLIST
- rm $LABELLIST >/dev/null 2>/dev/null
-
- # Set our flag to determine if we've got a valid root partition in this setup
- FOUNDROOT="-1"
- export FOUNDROOT
-
- # Check if we are using a /boot partition
- USINGBOOTPART="1"
- export USINGBOOTPART
-
- # Set encryption on root check
- USINGENCROOT="1" ; export USINGENCROOT
-
- # Make the tmp directory where we'll store FS info & mount-points
- rm -rf ${PARTDIR} >/dev/null 2>/dev/null
- mkdir -p ${PARTDIR} >/dev/null 2>/dev/null
- rm -rf ${PARTDIR}-enc >/dev/null 2>/dev/null
- mkdir -p ${PARTDIR}-enc >/dev/null 2>/dev/null
-
- for i in $WORKINGSLICES
- do
- populate_disk_label "${i}"
- done
-
- # Check if we made a root partition
- if [ "$FOUNDROOT" = "-1" ]
- then
- exit_err "ERROR: No root (/) partition specified!!"
- fi
-
- # Check if we made a root partition
- if [ "$FOUNDROOT" = "1" -a "${USINGBOOTPART}" != "0" ]
- then
- exit_err "ERROR: (/) partition isn't first partition on disk!"
- fi
-
- if [ "${USINGENCROOT}" = "0" -a "${USINGBOOTPART}" != "0" ]
- then
- exit_err "ERROR: Can't encrypt (/) with no (/boot) partition!"
- fi
-};
-
-check_fstab_mbr()
-{
- local SLICE
- local FSTAB
-
- if [ -z "$2" ]
- then
- return 1
- fi
-
- SLICE="$1"
- FSTAB="$2/etc/fstab"
-
- if [ -f "${FSTAB}" ]
- then
- PARTLETTER=`echo "$SLICE" | sed -E 's|^.+([a-h])$|\1|'`
-
- cat "${FSTAB}" | awk '{ print $2 }' | grep -E '^/$' >/dev/null 2>&1
- if [ "$?" = "0" ]
- then
- if [ "${PARTLETTER}" = "a" ]
- then
- FOUNDROOT="0"
- else
- FOUNDROOT="1"
- fi
-
- ROOTIMAGE="1"
-
- export FOUNDROOT
- export ROOTIMAGE
- fi
-
- cat "${FSTAB}" | awk '{ print $2 }' | grep -E '^/boot$' >/dev/null 2>&1
- if [ "$?" = "0" ]
- then
- if [ "${PARTLETTER}" = "a" ]
- then
- USINGBOOTPART="0"
- else
- exit_err "/boot partition must be first partition"
- fi
- export USINGBOOTPART
- fi
-
- return 0
- fi
-
- return 1
-};
-
-check_fstab_gpt()
-{
- local SLICE
- local FSTAB
-
- if [ -z "$2" ]
- then
- return 1
- fi
-
- SLICE="$1"
- FSTAB="$2/etc/fstab"
-
- if [ -f "${FSTAB}" ]
- then
- PARTNUMBER=`echo "${SLICE}" | sed -E 's|^.+p([0-9]*)$|\1|'`
-
- cat "${FSTAB}" | awk '{ print $2 }' | grep -E '^/$' >/dev/null 2>&1
- if [ "$?" = "0" ]
- then
- if [ "${PARTNUMBER}" = "2" ]
- then
- FOUNDROOT="0"
- else
- FOUNDROOT="1"
- fi
-
- ROOTIMAGE="1"
-
- export FOUNDROOT
- export ROOTIMAGE
- fi
-
- cat "${FSTAB}" | awk '{ print $2 }' | grep -E '^/boot$' >/dev/null 2>&1
- if [ "$?" = "0" ]
- then
- if [ "${PARTNUMBER}" = "2" ]
- then
- USINGBOOTPART="0"
- else
- exit_err "/boot partition must be first partition"
- fi
- export USINGBOOTPART
- fi
-
- return 0
- fi
-
-
- return 1
-};
-
-check_disk_layout()
-{
- local SLICES
- local TYPE
- local DISK
- local RES
- local F
-
- DISK="$1"
- TYPE="MBR"
-
- if [ -z "${DISK}" ]
- then
- return 1
- fi
-
- SLICES_MBR=`ls /dev/${DISK}s[1-4]*[a-h]* 2>/dev/null`
- SLICES_GPT=`ls /dev/${DISK}p[0-9]* 2>/dev/null`
- SLICES_SLICE=`ls /dev/${DISK}[a-h]* 2>/dev/null`
-
- if [ -n "${SLICES_MBR}" ]
- then
- SLICES="${SLICES_MBR}"
- TYPE="MBR"
- RES=0
- fi
- if [ -n "${SLICES_GPT}" ]
- then
- SLICES="${SLICES_GPT}"
- TYPE="GPT"
- RES=0
- fi
- if [ -n "${SLICES_SLICE}" ]
- then
- SLICES="${SLICES_SLICE}"
- TYPE="MBR"
- RES=0
- fi
-
- for slice in ${SLICES}
- do
- F=1
- mount ${slice} /mnt 2>/dev/null
- if [ "$?" != "0" ]
- then
- continue
- fi
-
- if [ "${TYPE}" = "MBR" ]
- then
- check_fstab_mbr "${slice}" "/mnt"
- F="$?"
-
- elif [ "${TYPE}" = "GPT" ]
- then
- check_fstab_gpt "${slice}" "/mnt"
- F="$?"
- fi
-
- if [ "${F}" = "0" ]
- then
- #umount /mnt
- break
- fi
-
- #umount /mnt
- done
-
- return ${RES}
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-cleanup.sh b/usr/sbin/pc-sysinstall/backend/functions-cleanup.sh
deleted file mode 100755
index be316c4..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-cleanup.sh
+++ /dev/null
@@ -1,418 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh,v 1.5 2010/10/21 17:14:44 imp Exp $
-
-# Functions which perform the final cleanup after an install
-
-# Finishes up with ZFS setup before unmounting
-zfs_cleanup_unmount()
-{
- # Loop through our FS and see if we have any ZFS partitions to cleanup
- for PART in `ls ${PARTDIR}`
- do
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- ZPOOLNAME=$(get_zpool_name "${PART}")
-
- if [ "$PARTFS" = "ZFS" ]
- then
- # Check if we have multiple zfs mounts specified
- for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'`
- do
- if [ "${ZMNT}" = "/" ]
- then
- # Make sure we haven't already added the zfs boot line when
- # Creating a dedicated "/boot" partition
- cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep "vfs.root.mountfrom=" >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then
- echo "vfs.root.mountfrom=\"zfs:${ZPOOLNAME}\"" >> ${FSMNT}/boot/loader.conf
- fi
- FOUNDZFSROOT="${ZPOOLNAME}" ; export FOUNDZFSROOT
- fi
- done
- FOUNDZFS="1"
- fi
- done
-
- if [ ! -z "${FOUNDZFS}" ]
- then
- # Check if we need to add our ZFS flags to rc.conf, src.conf and loader.conf
- cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'zfs_load="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'zfs_load="YES"' >>${FSMNT}/boot/loader.conf
- fi
- cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep 'zfs_enable="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'zfs_enable="YES"' >>${FSMNT}/etc/rc.conf
- fi
-
- sleep 2
- # Copy over any ZFS cache data
- cp /boot/zfs/* ${FSMNT}/boot/zfs/
-
- # Copy the hostid so that our zfs cache works
- cp /etc/hostid ${FSMNT}/etc/hostid
- fi
-
- # Loop through our FS and see if we have any ZFS partitions to cleanup
- for PART in `ls ${PARTDIR}`
- do
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
- ZPOOLNAME=$(get_zpool_name "${PART}")
-
- if [ "$PARTFS" = "ZFS" ]
- then
- # Check if we have multiple zfs mounts specified
- for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'`
- do
- PARTMNTREV="${ZMNT} ${PARTMNTREV}"
- done
-
- for ZMNT in ${PARTMNTREV}
- do
- if [ "${ZMNT}" != "/" ]
- then
- rc_halt "zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}"
- rc_halt "zfs unmount ${ZPOOLNAME}${ZMNT}"
- sleep 2
- fi
- done
- fi
- done
-
-};
-
-# Function which performs the specific setup for using a /boot partition
-setup_dedicated_boot_part()
-{
- ROOTFS="${1}"
- ROOTFSTYPE="${2}"
- BOOTFS="${3}"
- BOOTMNT="${4}"
-
- # Set the root mount in loader.conf
- echo "vfs.root.mountfrom=\"${ROOTFSTYPE}:${ROOTFS}\"" >> ${FSMNT}/boot/loader.conf
- rc_halt "mkdir -p ${FSMNT}/${BOOTMNT}/boot"
- rc_halt "mv ${FSMNT}/boot/* ${FSMNT}${BOOTMNT}/boot/"
- rc_halt "mv ${FSMNT}${BOOTMNT}/boot ${FSMNT}/boot/"
- rc_halt "umount /dev/${BOOTFS}"
- rc_halt "mount /dev/${BOOTFS} ${FSMNT}${BOOTMNT}"
- rc_halt "rmdir ${FSMNT}/boot"
-
- # Strip the '/' from BOOTMNT before making symlink
- BOOTMNTNS="`echo ${BOOTMNT} | sed 's|/||g'`"
- rc_halt "chroot ${FSMNT} ln -s ${BOOTMNTNS}/boot /boot"
-
-};
-
-# Function which creates the /etc/fstab for the installed system
-setup_fstab()
-{
- FSTAB="${FSMNT}/etc/fstab"
- rm ${FSTAB} >/dev/null 2>/dev/null
-
- # Create the header
- echo "# Device Mountpoint FStype Options Dump Pass" >> ${FSTAB}
-
- # Loop through the partitions, and start creating /etc/fstab
- for PART in `ls ${PARTDIR}`
- do
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
- PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
-
- DRIVE="`echo ${PART} | rev | cut -b 4- | rev`"
- # Check if this device is being mirrored
- if [ -e "${MIRRORCFGDIR}/${DRIVE}" ]
- then
- # This device is apart of a gmirror, lets reset PART to correct value
- MDRIVE="mirror/`cat ${MIRRORCFGDIR}/${DRIVE} | cut -d ':' -f 3`"
- TMP="`echo ${PART} | rev | cut -b -3 | rev`"
- PART="${MDRIVE}${TMP}"
- PARTLABEL=""
- fi
-
- # Unset EXT
- EXT=""
-
- # Set mount options for file-systems
- case $PARTFS in
- UFS+J) MNTOPTS="rw,noatime,async" ;;
- SWAP) MNTOPTS="sw" ;;
- *) MNTOPTS="rw,noatime" ;;
- esac
-
-
- # Figure out if we are using a glabel, or the raw name for this entry
- if [ ! -z "${PARTLABEL}" ]
- then
- DEVICE="label/${PARTLABEL}"
- else
- # Check if using encryption
- if [ "${PARTENC}" = "ON" ] ; then
- EXT=".eli"
- fi
-
- if [ "${PARTFS}" = "UFS+J" ] ; then
- EXT="${EXT}.journal"
- fi
- DEVICE="${PART}${EXT}"
- fi
-
-
- # Set our ROOTFSTYPE for loader.conf if necessary
- check_for_mount "${PARTMNT}" "/"
- if [ "$?" = "0" ] ; then
- if [ "${PARTFS}" = "ZFS" ] ; then
- ROOTFSTYPE="zfs"
- XPOOLNAME=$(get_zpool_name "${PART}")
- ROOTFS="${ZPOOLNAME}"
- else
- ROOTFS="${DEVICE}"
- ROOTFSTYPE="ufs"
- fi
- fi
-
- # Only create non-zfs partitions
- if [ "${PARTFS}" != "ZFS" ]
- then
-
- # Make sure geom_journal is loaded
- if [ "${PARTFS}" = "UFS+J" ] ; then
- setup_gjournal
- fi
-
- # Save the BOOTFS for call at the end
- if [ "${PARTMNT}" = "/boot" ] ; then
- BOOTFS="${PART}${EXT}"
- BOOTMNT="${BOOT_PART_MOUNT}"
- PARTMNT="${BOOTMNT}"
- fi
-
- # Echo out the fstab entry now
- if [ "${PARTFS}" = "SWAP" ]
- then
- echo "/dev/${DEVICE} none swap ${MNTOPTS} 0 0" >> ${FSTAB}
- else
- echo "/dev/${DEVICE} ${PARTMNT} ufs ${MNTOPTS} 1 1" >> ${FSTAB}
- fi
-
- fi # End of ZFS Check
- done
-
- # Setup some specific PC-BSD fstab options
- if [ "$INSTALLTYPE" != "FreeBSD" ]
- then
- echo "procfs /proc procfs rw 0 0" >> ${FSTAB}
- echo "linprocfs /compat/linux/proc linprocfs rw 0 0" >> ${FSTAB}
- echo "tmpfs /tmp tmpfs rw,mode=1777 0 0" >> ${FSTAB}
- fi
-
- # If we have a dedicated /boot, run the post-install setup of it now
- if [ ! -z "${BOOTMNT}" ] ; then
- setup_dedicated_boot_part "${ROOTFS}" "${ROOTFSTYPE}" "${BOOTFS}" "${BOOTMNT}"
- fi
-
-};
-
-# Setup our disk mirroring with gmirror
-setup_gmirror()
-{
- NUM="0"
-
- cd ${MIRRORCFGDIR}
- for DISK in `ls *`
- do
- MIRRORDISK="`cat ${DISK} | cut -d ':' -f 1`"
- MIRRORBAL="`cat ${DISK} | cut -d ':' -f 2`"
-
- # Create this mirror device
- gmirror label -vb $MIRRORBAL gm${NUM} /dev/${DISK}
-
- sleep 3
-
- # Save the gm<num> device in our config
- echo "${MIRRORDISK}:${MIRRORBAL}:gm${NUM}" > ${DISK}
-
- sleep 3
-
- NUM="`expr ${NUM} + 1`"
- done
-
-
- cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_mirror_load="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'geom_mirror_load="YES"' >>${FSMNT}/boot/loader.conf
- fi
-
-};
-
-# Function which saves geli keys and sets up loading of them at boot
-setup_geli_loading()
-{
-
- # Make our keys dir
- mkdir -p ${FSMNT}/boot/keys >/dev/null 2>/dev/null
-
- cd ${GELIKEYDIR}
- for KEYFILE in `ls *`
- do
- # Figure out the partition name based on keyfile name removing .key
- PART="`echo ${KEYFILE} | cut -d '.' -f 1`"
-
- # Add the entries to loader.conf to start this geli provider at boot
- echo "geli_${PART}_keyfile0_load=\"YES\"" >> ${FSMNT}/boot/loader.conf
- echo "geli_${PART}_keyfile0_type=\"${PART}:geli_keyfile0\"" >> ${FSMNT}/boot/loader.conf
- echo "geli_${PART}_keyfile0_name=\"/boot/keys/${KEYFILE}\"" >> ${FSMNT}/boot/loader.conf
-
- # If we have a passphrase, set it up now
- if [ -e "${PARTDIR}-enc/${PART}-encpass" ] ; then
- geli setkey -J ${PARTDIR}-enc/${PART}-encpass -n 0 -p -k ${KEYFILE} -K ${KEYFILE} ${PART}
- geli configure -b ${PART}
- fi
-
- # Copy the key to the disk
- cp ${KEYFILE} ${FSMNT}/boot/keys/${KEYFILE}
- done
-
- # Make sure we have geom_eli set to load at boot
- cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_eli_load="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'geom_eli_load="YES"' >>${FSMNT}/boot/loader.conf
- fi
-
-};
-
-
-# Function to generate a random hostname if none was specified
-gen_hostname()
-{
- RAND="`jot -r 1 1 9000`"
-
- if [ "$INSTALLTYPE" = "FreeBSD" ]
- then
- VAL="freebsd-${RAND}"
- else
- VAL="pcbsd-${RAND}"
- fi
-
- export VAL
-
-};
-
-# Function which sets up the hostname for the system
-setup_hostname()
-{
-
- get_value_from_cfg hostname
- HOSTNAME="${VAL}"
-
- # If we don't have a hostname, make one up
- if [ -z "${HOSTNAME}" ]
- then
- gen_hostname
- HOSTNAME="${VAL}"
- fi
-
- # Clean up any saved hostname
- cat ${FSMNT}/etc/rc.conf | grep -v "hostname=" >${FSMNT}/etc/rc.conf.new
- mv ${FSMNT}/etc/rc.conf.new ${FSMNT}/etc/rc.conf
-
- # Set the hostname now
- echo_log "Setting hostname: ${HOSTNAME}"
- echo "hostname=\"${HOSTNAME}\"" >> ${FSMNT}/etc/rc.conf
- sed -i -e "s|my.domain|${HOSTNAME} ${HOSTNAME}|g" ${FSMNT}/etc/hosts
-
-};
-
-
-# Check and make sure geom_journal is enabled on the system
-setup_gjournal()
-{
-
- # Make sure we have geom_journal set to load at boot
- cat ${FSMNT}/boot/loader.conf 2>/dev/null | grep 'geom_journal_load="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'geom_journal_load="YES"' >>${FSMNT}/boot/loader.conf
- fi
-
-};
-
-# Function which sets the root password from the install config
-set_root_pw()
-{
- get_value_from_cfg_with_spaces rootPass
- PW="${VAL}"
-
- # If we don't have a root pass, return
- if [ -z "${PW}" ]
- then
- return 0
- fi
-
- echo_log "Setting root password"
- echo "${PW}" > ${FSMNT}/.rootpw
- run_chroot_cmd "cat /.rootpw | pw usermod root -h 0"
- rc_halt "rm ${FSMNT}/.rootpw"
-
-};
-
-
-run_final_cleanup()
-{
- # Check if we need to run any gmirror setup
- ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Lets setup gmirror now
- setup_gmirror
- fi
-
- # Check if we need to save any geli keys
- ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Lets setup geli loading
- setup_geli_loading
- fi
-
- # Set a hostname on the install system
- setup_hostname
-
- # Set the root_pw if it is specified
- set_root_pw
-
- # Generate the fstab for the installed system
- setup_fstab
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-disk.sh b/usr/sbin/pc-sysinstall/backend/functions-disk.sh
deleted file mode 100755
index 2bb3ecc..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-disk.sh
+++ /dev/null
@@ -1,827 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-disk.sh,v 1.8 2010/11/10 05:32:36 imp Exp $
-
-# Functions related to disk operations using gpart
-
-# See if device is a full disk or partition/slice
-is_disk()
-{
- for _dsk in `sysctl -n kern.disks`
- do
- if [ "$_dsk" = "${1}" ] ; then return 0 ; fi
- done
-
- return 1
-}
-
-# Get a MBR partitions sysid
-get_partition_sysid_mbr()
-{
- INPART="0"
- DISK="$1"
- PARTNUM=`echo ${2} | sed "s|${DISK}s||g"`
- fdisk ${DISK} >${TMPDIR}/disk-${DISK} 2>/dev/null
- while read i
- do
- echo "$i" | grep "The data for partition" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- INPART="0"
- PART="`echo ${i} | cut -d ' ' -f 5`"
- if [ "$PART" = "$PARTNUM" ] ; then
- INPART="1"
- fi
- fi
-
- # In the partition section
- if [ "$INPART" = "1" ] ; then
- echo "$i" | grep "^sysid" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- SYSID="`echo ${i} | tr -s '\t' ' ' | cut -d ' ' -f 2`"
- break
- fi
-
- fi
-
- done < ${TMPDIR}/disk-${DISK}
- rm ${TMPDIR}/disk-${DISK}
-
- VAL="${SYSID}"
- export VAL
-};
-
-# Get the partitions MBR label
-get_partition_label_mbr()
-{
- INPART="0"
- DISK="$1"
- PARTNUM=`echo ${2} | sed "s|${DISK}s||g"`
- fdisk ${DISK} >${TMPDIR}/disk-${DISK} 2>/dev/null
- while read i
- do
- echo "$i" | grep "The data for partition" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- INPART="0"
- PART="`echo ${i} | cut -d ' ' -f 5`"
- if [ "$PART" = "$PARTNUM" ] ; then
- INPART="1"
- fi
- fi
-
- # In the partition section
- if [ "$INPART" = "1" ] ; then
- echo "$i" | grep "^sysid" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- LABEL="`echo ${i} | tr -s '\t' ' ' | cut -d ',' -f 2-10`"
- break
- fi
-
- fi
-
- done < ${TMPDIR}/disk-${DISK}
- rm ${TMPDIR}/disk-${DISK}
-
- VAL="${LABEL}"
- export VAL
-};
-
-# Get a GPT partitions label
-get_partition_label_gpt()
-{
- DISK="${1}"
- PARTNUM=`echo ${2} | sed "s|${DISK}p||g"`
-
- gpart show ${DISK} >${TMPDIR}/disk-${DISK}
- while read i
- do
- SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`"
- if [ "${SLICE}" = "${PARTNUM}" ] ; then
- LABEL="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 4`"
- break
- fi
- done <${TMPDIR}/disk-${DISK}
- rm ${TMPDIR}/disk-${DISK}
-
- VAL="${LABEL}"
- export VAL
-};
-
-# Get a partitions startblock
-get_partition_startblock()
-{
- DISK="${1}"
- PARTNUM=`echo ${2} | sed "s|${DISK}p||g" | sed "s|${DISK}s||g"`
-
- gpart show ${DISK} >${TMPDIR}/disk-${DISK}
- while read i
- do
- SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`"
- if [ "$SLICE" = "${PARTNUM}" ] ; then
- SB="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 1`"
- break
- fi
- done <${TMPDIR}/disk-${DISK}
- rm ${TMPDIR}/disk-${DISK}
-
- VAL="${SB}"
- export VAL
-};
-
-# Get a partitions blocksize
-get_partition_blocksize()
-{
- DISK="${1}"
- PARTNUM=`echo ${2} | sed "s|${DISK}p||g" | sed "s|${DISK}s||g"`
-
- gpart show ${DISK} >${TMPDIR}/disk-${DISK}
- while read i
- do
- SLICE="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 3`"
- if [ "$SLICE" = "${PARTNUM}" ] ; then
- BS="`echo ${i} | grep -v ${DISK} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 2`"
- break
- fi
- done <${TMPDIR}/disk-${DISK}
- rm ${TMPDIR}/disk-${DISK}
-
- VAL="${BS}"
- export VAL
-};
-
-# Function which returns the partitions on a target disk
-get_disk_partitions()
-{
- gpart show ${1} >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then
- VAL="" ; export VAL
- return
- fi
-
- gpart show ${1} | grep "MBR" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- type="MBR"
- else
- type="GPT"
- fi
-
- SLICES="`gpart show ${1} | grep -v ${1} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 4 | sed '/^$/d'`"
- for i in ${SLICES}
- do
- case $type in
- MBR) name="${1}s${i}" ;;
- GPT) name="${1}p${i}";;
- *) name="${1}s${i}";;
- esac
- if [ -z "${RSLICES}" ]
- then
- RSLICES="${name}"
- else
- RSLICES="${RSLICES} ${name}"
- fi
- done
-
- VAL="${RSLICES}" ; export VAL
-};
-
-# Function which returns a target disks cylinders
-get_disk_cyl()
-{
- cyl=`diskinfo -v ${1} | grep "# Cylinders" | tr -s ' ' | cut -f 2`
- VAL="${cyl}" ; export VAL
-};
-
-# Function which returns a target disks sectors
-get_disk_sectors()
-{
- sec=`diskinfo -v ${1} | grep "# Sectors" | tr -s ' ' | cut -f 2`
- VAL="${sec}" ; export VAL
-};
-
-# Function which returns a target disks heads
-get_disk_heads()
-{
- head=`diskinfo -v ${1} | grep "# Heads" | tr -s ' ' | cut -f 2`
- VAL="${head}" ; export VAL
-};
-
-# Function which returns a target disks mediasize in sectors
-get_disk_mediasize()
-{
- mediasize=`diskinfo -v ${1} | grep "# mediasize in sectors" | tr -s ' ' | cut -f 2`
- VAL="${mediasize}" ; export VAL
-};
-
-# Function which exports all zpools, making them safe to overwrite potentially
-export_all_zpools()
-{
- # Export any zpools
- for i in `zpool list -H -o name`
- do
- zpool export -f ${i}
- done
-};
-
-# Function to delete all gparts before starting an install
-delete_all_gpart()
-{
- echo_log "Deleting all gparts"
- DISK="$1"
-
- # Check for any swaps to stop
- for i in `gpart show ${DISK} 2>/dev/null | grep 'freebsd-swap' | tr -s ' ' | cut -d ' ' -f 4`
- do
- swapoff /dev/${DISK}s${i}b >/dev/null 2>/dev/null
- swapoff /dev/${DISK}p${i} >/dev/null 2>/dev/null
- done
-
- # Delete the gparts now
- for i in `gpart show ${DISK} 2>/dev/null | tr -s ' ' | cut -d ' ' -f 4`
- do
- if [ "${i}" != "${DISK}" -a "${i}" != "-" ] ; then
- rc_nohalt "gpart delete -i ${i} ${DISK}"
- fi
- done
-
- rc_nohalt "dd if=/dev/zero of=/dev/${DISK} count=3000"
-
-};
-
-# Function to export all zpools before starting an install
-stop_all_zfs()
-{
- # Export all zpools again, so that we can overwrite these partitions potentially
- for i in `zpool list -H -o name`
- do
- zpool export -f ${i}
- done
-};
-
-# Function which stops all gmirrors before doing any disk manipulation
-stop_all_gmirror()
-{
- DISK="${1}"
- GPROV="`gmirror list | grep ". Name: mirror/" | cut -d '/' -f 2`"
- for gprov in $GPROV
- do
- gmirror list | grep "Name: ${DISK}" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- echo_log "Stopping mirror $gprov $DISK"
- rc_nohalt "gmirror remove $gprov $DISK"
- rc_nohalt "dd if=/dev/zero of=/dev/${DISK} count=4096"
- fi
- done
-};
-
-# Make sure we don't have any geli providers active on this disk
-stop_all_geli()
-{
- _geld="${1}"
- cd /dev
-
- for i in `ls ${_geld}*`
- do
- echo $i | grep '.eli' >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- echo_log "Detaching GELI on ${i}"
- rc_halt "geli detach ${i}"
- fi
- done
-
-};
-
-# Function which reads in the disk slice config, and performs it
-setup_disk_slice()
-{
-
- # Cleanup any slice / mirror dirs
- rm -rf ${SLICECFGDIR} >/dev/null 2>/dev/null
- mkdir ${SLICECFGDIR}
- rm -rf ${MIRRORCFGDIR} >/dev/null 2>/dev/null
- mkdir ${MIRRORCFGDIR}
-
- # Start with disk0
- disknum="0"
-
- # Make sure all zpools are exported
- export_all_zpools
-
- # We are ready to start setting up the disks, lets read the config and do the actions
- while read line
- do
- echo $line | grep "^disk${disknum}=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
-
- # Found a disk= entry, lets get the disk we are working on
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- DISK="$VAL"
-
- # Before we go further, lets confirm this disk really exists
- if [ ! -e "/dev/${DISK}" ]
- then
- exit_err "ERROR: The disk ${DISK} does not exist!"
- fi
-
- # Make sure we stop any gmirrors on this disk
- stop_all_gmirror ${DISK}
-
- # Make sure we stop any geli stuff on this disk
- stop_all_geli ${DISK}
-
- # Make sure we don't have any zpools loaded
- stop_all_zfs
-
- fi
-
- # Lets look if this device will be mirrored on another disk
- echo $line | grep "^mirror=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
-
- # Found a disk= entry, lets get the disk we are working on
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- MIRRORDISK="$VAL"
-
- # Before we go further, lets confirm this disk really exists
- if [ ! -e "/dev/${MIRRORDISK}" ]
- then
- exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!"
- fi
- fi
-
- # Lets see if we have been given a mirror balance choice
- echo $line | grep "^mirrorbal=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
-
- # Found a disk= entry, lets get the disk we are working on
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- MIRRORBAL="$VAL"
- fi
-
- echo $line | grep "^partition=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found a partition= entry, lets read / set it
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- PTYPE=`echo $VAL|tr A-Z a-z`
-
- # We are using free space, figure out the slice number
- if [ "${PTYPE}" = "free" ]
- then
- # Lets figure out what number this slice will be
- LASTSLICE="`gpart show ${DISK} \
- | grep -v ${DISK} \
- | grep -v ' free' \
- | tr -s '\t' ' ' \
- | cut -d ' ' -f 4 \
- | sed '/^$/d' \
- | tail -n 1`"
-
- if [ -z "${LASTSLICE}" ]
- then
- LASTSLICE="1"
- else
- LASTSLICE="`expr $LASTSLICE + 1`"
- fi
-
- if [ $LASTSLICE -gt 4 ]
- then
- exit_err "ERROR: BSD only supports primary partitions, and there are none availble on $DISK"
- fi
-
- fi
- fi
-
- # Check if we have an image file defined
- echo $line | grep "^image=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- # Found an image= entry, lets read / set it
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- IMAGE="$VAL"
- if [ ! -f "$IMAGE" ] ; then
- exit_err "$IMAGE file does not exist"
- fi
- fi
-
- # Check if we have a partscheme specified
- echo $line | grep "^partscheme=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- # Found a partscheme= entry, lets read / set it
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- PSCHEME="$VAL"
- if [ "$PSCHEME" != "GPT" -a "$PSCHEME" != "MBR" ] ; then
- exit_err "Unknown partition scheme: $PSCHEME"
- fi
- fi
-
- echo $line | grep "^bootManager=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found a bootManager= entry, lets read /set it
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- BMANAGER="$VAL"
- fi
-
- echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found our flag to commit this disk setup / lets do sanity check and do it
- if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ]
- then
- case ${PTYPE} in
- all)
- if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then
- PSCHEME="MBR"
- tmpSLICE="${DISK}s1"
- else
- tmpSLICE="${DISK}p1"
- fi
-
- run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}"
- ;;
-
- s1|s2|s3|s4)
- tmpSLICE="${DISK}${PTYPE}"
- # Get the number of the slice we are working on
- s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`"
- run_gpart_slice "${DISK}" "${BMANAGER}" "${s}"
- ;;
-
- free)
- tmpSLICE="${DISK}s${LASTSLICE}"
- run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}"
- ;;
-
- image)
- if [ -z "${IMAGE}" ]
- then
- exit_err "ERROR: partition type image specified with no image!"
- fi
- ;;
-
- *) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;;
- esac
-
-
- if [ -n "${IMAGE}" ]
- then
- local DEST
-
- if [ -n "${tmpSLICE}" ]
- then
- DEST="${tmpSLICE}"
- else
- DEST="${DISK}"
- fi
-
- write_image "${IMAGE}" "${DEST}"
- check_disk_layout "${DEST}"
- fi
-
- # Now save which disk<num> this is, so we can parse it later during slice partition setup
- if [ -z "${IMAGE}" ]
- then
- echo "disk${disknum}" >${SLICECFGDIR}/$tmpSLICE
- fi
-
- # Save any mirror config
- if [ ! -z "$MIRRORDISK" ]
- then
- # Default to round-robin if the user didn't specify
- if [ -z "$MIRRORBAL" ]
- then
- MIRRORBAL="round-robin"
- fi
- echo "$MIRRORDISK:$MIRRORBAL" >${MIRRORCFGDIR}/$DISK
- fi
-
- # Increment our disk counter to look for next disk and unset
- unset BMANAGER PTYPE DISK MIRRORDISK MIRRORBAL PSCHEME IMAGE
- disknum="`expr $disknum + 1`"
- else
- exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!"
- fi
- fi
-
- done <${CFGF}
-
-};
-
-# Stop all gjournals on disk / slice
-stop_gjournal()
-{
- _gdsk="$1"
- # Check if we need to shutdown any journals on this drive
- ls /dev/${_gdsk}*.journal >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- cd /dev
- for i in `ls ${_gdsk}*.journal`
- do
- rawjournal="`echo ${i} | cut -d '.' -f 1`"
- gjournal stop -f ${rawjournal} >>${LOGOUT} 2>>${LOGOUT}
- gjournal clear ${rawjournal} >>${LOGOUT} 2>>${LOGOUT}
- done
- fi
-} ;
-
-# Function which runs gpart and creates a single large GPT partition scheme
-init_gpt_full_disk()
-{
- _intDISK=$1
-
- # Set our sysctl so we can overwrite any geom using drives
- sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
-
- # Stop any journaling
- stop_gjournal "${_intDISK}"
-
- # Remove any existing partitions
- delete_all_gpart "${_intDISK}"
-
- #Erase any existing bootloader
- echo_log "Cleaning up ${_intDISK}"
- rc_halt "dd if=/dev/zero of=/dev/${_intDISK} count=2048"
-
- sleep 2
-
- echo_log "Running gpart on ${_intDISK}"
- rc_halt "gpart create -s GPT ${_intDISK}"
- rc_halt "gpart add -b 34 -s 128 -t freebsd-boot ${_intDISK}"
-
- echo_log "Stamping boot sector on ${_intDISK}"
- rc_halt "gpart bootcode -b /boot/pmbr ${_intDISK}"
-
-}
-
-# Function which runs gpart and creates a single large MBR partition scheme
-init_mbr_full_disk()
-{
- _intDISK=$1
- _intBOOT=$2
-
- startblock="63"
-
- # Set our sysctl so we can overwrite any geom using drives
- sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
-
- # Stop any journaling
- stop_gjournal "${_intDISK}"
-
- # Remove any existing partitions
- delete_all_gpart "${_intDISK}"
-
- #Erase any existing bootloader
- echo_log "Cleaning up ${_intDISK}"
- rc_halt "dd if=/dev/zero of=/dev/${_intDISK} count=2048"
-
- sleep 2
-
- echo_log "Running gpart on ${_intDISK}"
- rc_halt "gpart create -s mbr ${_intDISK}"
-
- # Lets figure out disk size in blocks
- # Get the cyl of this disk
- get_disk_cyl "${_intDISK}"
- cyl="${VAL}"
-
- # Get the heads of this disk
- get_disk_heads "${_intDISK}"
- head="${VAL}"
-
- # Get the tracks/sectors of this disk
- get_disk_sectors "${_intDISK}"
- sec="${VAL}"
-
- # Multiply them all together to get our total blocks
- totalblocks="`expr ${cyl} \* ${head}`"
- totalblocks="`expr ${totalblocks} \* ${sec}`"
- if [ -z "${totalblocks}" ]
- then
- totalblocks=`gpart show "${_intDISK}"|tail -2|head -1|awk '{ print $2 }'`
- fi
-
- # Now set the ending block to the total disk block size
- sizeblock="`expr ${totalblocks} - ${startblock}`"
-
- # Install new partition setup
- echo_log "Running gpart add on ${_intDISK}"
- rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i 1 ${_intDISK}"
- sleep 2
-
- echo_log "Cleaning up ${_intDISK}s1"
- rc_halt "dd if=/dev/zero of=/dev/${_intDISK}s1 count=1024"
-
- if [ "$_intBOOT" = "bsd" ] ; then
- echo_log "Stamping boot0 on ${_intDISK}"
- rc_halt "gpart bootcode -b /boot/boot0 ${_intDISK}"
- else
- echo_log "Stamping boot1 on ${_intDISK}"
- rc_halt "gpart bootcode -b /boot/boot1 ${_intDISK}"
- fi
-
-}
-
-# Function which runs gpart and creates a single large slice
-run_gpart_full()
-{
- DISK=$1
- BOOT=$2
- SCHEME=$3
-
- if [ "$SCHEME" = "MBR" ] ; then
- init_mbr_full_disk "$DISK" "$BOOT"
- slice="${DISK}-1-mbr"
- else
- init_gpt_full_disk "$DISK"
- slice="${DISK}-1-gpt"
- fi
-
- # Lets save our slice, so we know what to look for in the config file later on
- if [ -z "$WORKINGSLICES" ]
- then
- WORKINGSLICES="${slice}"
- export WORKINGSLICES
- else
- WORKINGSLICES="${WORKINGSLICES} ${slice}"
- export WORKINGSLICES
- fi
-};
-
-# Function which runs gpart on a specified s1-4 slice
-run_gpart_slice()
-{
- DISK=$1
- if [ ! -z "$2" ]
- then
- BMANAGER="$2"
- fi
-
- # Set the slice we will use later
- slice="${1}s${3}"
-
- # Set our sysctl so we can overwrite any geom using drives
- sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
-
- # Get the number of the slice we are working on
- slicenum="$3"
-
- # Stop any journaling
- stop_gjournal "${slice}"
-
- # Make sure we have disabled swap on this drive
- if [ -e "${slice}b" ]
- then
- swapoff ${slice}b >/dev/null 2>/dev/null
- swapoff ${slice}b.eli >/dev/null 2>/dev/null
- fi
-
- # Modify partition type
- echo_log "Running gpart modify on ${DISK}"
- rc_halt "gpart modify -t freebsd -i ${slicenum} ${DISK}"
- sleep 2
-
- # Clean up old partition
- echo_log "Cleaning up $slice"
- rc_halt "dd if=/dev/zero of=/dev/${DISK}s${slicenum} count=1024"
-
- sleep 1
-
- if [ "${BMANAGER}" = "bsd" ]
- then
- echo_log "Stamping boot sector on ${DISK}"
- rc_halt "gpart bootcode -b /boot/boot0 ${DISK}"
- fi
-
- # Set the slice to the format we'll be using for gpart later
- slice="${1}-${3}-mbr"
-
- # Lets save our slice, so we know what to look for in the config file later on
- if [ -z "$WORKINGSLICES" ]
- then
- WORKINGSLICES="${slice}"
- export WORKINGSLICES
- else
- WORKINGSLICES="${WORKINGSLICES} ${slice}"
- export WORKINGSLICES
- fi
-};
-
-# Function which runs gpart and creates a new slice from free disk space
-run_gpart_free()
-{
- DISK=$1
- SLICENUM=$2
- if [ ! -z "$3" ]
- then
- BMANAGER="$3"
- fi
-
- # Set our sysctl so we can overwrite any geom using drives
- sysctl kern.geom.debugflags=16 >>${LOGOUT} 2>>${LOGOUT}
-
- slice="${DISK}s${SLICENUM}"
- slicenum="${SLICENUM}"
-
- # Working on the first slice, make sure we have MBR setup
- gpart show ${DISK} >/dev/null 2>/dev/null
- if [ "$?" != "0" -a "$SLICENUM" = "1" ] ; then
- echo_log "Initializing disk, no existing MBR setup"
- rc_halt "gpart create -s mbr ${DISK}"
- fi
-
- # Lets get the starting block first
- if [ "${slicenum}" = "1" ]
- then
- startblock="63"
- else
- # Lets figure out where the prior slice ends
- checkslice="`expr ${slicenum} - 1`"
-
- # Get starting block of this slice
- sblk=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 2`
- blksize=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' | grep " ${checkslice} " | cut -d ' ' -f 3`
- startblock="`expr ${sblk} + ${blksize}`"
- fi
-
- # No slice after the new slice, lets figure out the free space remaining and use it
- # Get the cyl of this disk
- get_disk_cyl "${DISK}"
- cyl="${VAL}"
-
- # Get the heads of this disk
- get_disk_heads "${DISK}"
- head="${VAL}"
-
- # Get the tracks/sectors of this disk
- get_disk_sectors "${DISK}"
- sec="${VAL}"
-
- # Multiply them all together to get our total blocks
- totalblocks="`expr ${cyl} \* ${head}`"
- totalblocks="`expr ${totalblocks} \* ${sec}`"
-
-
- # Now set the ending block to the total disk block size
- sizeblock="`expr ${totalblocks} - ${startblock}`"
-
- # Install new partition setup
- echo_log "Running gpart on ${DISK}"
- rc_halt "gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i ${slicenum} ${DISK}"
- sleep 2
-
- echo_log "Cleaning up $slice"
- rc_halt "dd if=/dev/zero of=/dev/${slice} count=1024"
-
- sleep 1
-
- if [ "${BMANAGER}" = "bsd" ]
- then
- echo_log "Stamping boot sector on ${DISK}"
- rc_halt "gpart bootcode -b /boot/boot0 ${DISK}"
- fi
-
- slice="${DISK}-${SLICENUM}-mbr"
- # Lets save our slice, so we know what to look for in the config file later on
- if [ -z "$WORKINGSLICES" ]
- then
- WORKINGSLICES="${slice}"
- export WORKINGSLICES
- else
- WORKINGSLICES="${WORKINGSLICES} ${slice}"
- export WORKINGSLICES
- fi
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-extractimage.sh b/usr/sbin/pc-sysinstall/backend/functions-extractimage.sh
deleted file mode 100755
index 76cb247..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-extractimage.sh
+++ /dev/null
@@ -1,457 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh,v 1.8 2010/10/21 23:08:42 imp Exp $
-
-# Functions which perform the extraction / installation of system to disk
-
-. ${BACKEND}/functions-mountoptical.sh
-
-# Performs the extraction of data to disk from a uzip or tar archive
-start_extract_uzip_tar()
-{
- if [ -z "$INSFILE" ]
- then
- exit_err "ERROR: Called extraction with no install file set!"
- fi
-
- # Check if we have a .count file, and echo it out for a front-end to use in progress bars
- if [ -e "${INSFILE}.count" ]
- then
- echo "INSTALLCOUNT: `cat ${INSFILE}.count`"
- fi
-
- # Check if we are doing an upgrade, and if so use our exclude list
- if [ "${INSTALLMODE}" = "upgrade" ]
- then
- TAROPTS="-X ${PROGDIR}/conf/exclude-from-upgrade"
- else
- TAROPTS=""
- fi
-
- echo_log "pc-sysinstall: Starting Extraction"
-
- case ${PACKAGETYPE} in
- uzip)
- # Start by mounting the uzip image
- MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}`
- mkdir -p ${FSMNT}.uzip
- mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip
- if [ "$?" != "0" ]
- then
- exit_err "ERROR: Failed mounting the ${INSFILE}"
- fi
- cd ${FSMNT}.uzip
-
- # Copy over all the files now!
- tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log
- if [ "$?" != "0" ]
- then
- cd /
- echo "TAR failure occurred:" >>${LOGOUT}
- cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT}
- umount ${FSMNT}.uzip
- mdconfig -d -u ${MDDEVICE}
- exit_err "ERROR: Failed extracting the tar image"
- fi
-
- # All finished, now lets umount and cleanup
- cd /
- umount ${FSMNT}.uzip
- mdconfig -d -u ${MDDEVICE}
- ;;
- tar)
- tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1
- if [ "$?" != "0" ]
- then
- exit_err "ERROR: Failed extracting the tar image"
- fi
- ;;
- esac
-
- # Check if this was a FTP download and clean it up now
- if [ "${INSTALLMEDIUM}" = "ftp" ]
- then
- echo_log "Cleaning up downloaded archive"
- rm ${INSFILE}
- rm ${INSFILE}.count >/dev/null 2>/dev/null
- rm ${INSFILE}.md5 >/dev/null 2>/dev/null
- fi
-
- echo_log "pc-sysinstall: Extraction Finished"
-
-};
-
-# Performs the extraction of data to disk from a directory with split files
-start_extract_split()
-{
- if [ -z "${INSDIR}" ]
- then
- exit_err "ERROR: Called extraction with no install directory set!"
- fi
-
- echo_log "pc-sysinstall: Starting Extraction"
-
- # Used by install.sh
- DESTDIR="${FSMNT}"
- export DESTDIR
-
- HERE=`pwd`
- DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'`
- for dir in ${DIRS}
- do
- cd "${dir}"
- if [ -f "install.sh" ]
- then
- echo_log "Extracting" `basename ${dir}`
- echo "y" | sh install.sh >/dev/null
- if [ "$?" != "0" ]
- then
- exit_err "ERROR: Failed extracting ${dir}"
- fi
- else
- exit_err "ERROR: ${dir}/install.sh does not exist"
- fi
- done
- cd "${HERE}"
-
- KERNELS=`ls -d ${INSDIR}/*|grep kernels`
- cd "${KERNELS}"
- if [ -f "install.sh" ]
- then
- echo_log "Extracting" `basename ${KERNELS}`
- echo "y" | sh install.sh generic >/dev/null
- if [ "$?" != "0" ]
- then
- exit_err "ERROR: Failed extracting ${KERNELS}"
- fi
- rm -rf "${FSMNT}/boot/kernel"
- mv "${FSMNT}/boot/GENERIC" "${FSMNT}/boot/kernel"
- else
- exit_err "ERROR: ${KERNELS}/install.sh does not exist"
- fi
- cd "${HERE}"
-
- SOURCE=`ls -d ${INSDIR}/*|grep src`
- cd "${SOURCE}"
- if [ -f "install.sh" ]
- then
- echo_log "Extracting" `basename ${SOURCE}`
- echo "y" | sh install.sh all >/dev/null
- if [ "$?" != "0" ]
- then
- exit_err "ERROR: Failed extracting ${SOURCE}"
- fi
- else
- exit_err "ERROR: ${SOURCE}/install.sh does not exist"
- fi
- cd "${HERE}"
-
- echo_log "pc-sysinstall: Extraction Finished"
-};
-
-# Function which will attempt to fetch the install file before we start
-# the install
-fetch_install_file()
-{
- get_value_from_cfg ftpPath
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!"
- fi
-
- FTPPATH="${VAL}"
-
- # Check if we have a /usr partition to save the download
- if [ -d "${FSMNT}/usr" ]
- then
- OUTFILE="${FSMNT}/usr/.fetch-${INSFILE}"
- else
- OUTFILE="${FSMNT}/.fetch-${INSFILE}"
- fi
-
- # Do the fetch of the archive now
- fetch_file "${FTPPATH}/${INSFILE}" "${OUTFILE}" "1"
-
- # Check to see if there is a .count file for this install
- fetch_file "${FTPPATH}/${INSFILE}.count" "${OUTFILE}.count" "0"
-
- # Check to see if there is a .md5 file for this install
- fetch_file "${FTPPATH}/${INSFILE}.md5" "${OUTFILE}.md5" "0"
-
- # Done fetching, now reset the INSFILE to our downloaded archived
- INSFILE="${OUTFILE}" ; export INSFILE
-
-};
-
-# Function which will download freebsd install files
-fetch_split_files()
-{
- get_ftpHost
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
- fi
- FTPHOST="${VAL}"
-
- get_ftpDir
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
- fi
- FTPDIR="${VAL}"
-
- # Check if we have a /usr partition to save the download
- if [ -d "${FSMNT}/usr" ]
- then
- OUTFILE="${FSMNT}/usr/.fetch-${INSFILE}"
- else
- OUTFILE="${FSMNT}/.fetch-${INSFILE}"
- fi
-
- DIRS="base catpages dict doc games info manpages proflibs kernels src"
- if [ "${FBSD_ARCH}" = "amd64" ]
- then
- DIRS="${DIRS} lib32"
- fi
-
- for d in ${DIRS}
- do
- mkdir -p "${OUTFILE}/${d}"
- done
-
-
- NETRC="${OUTFILE}/.netrc"
- cat<<EOF>"${NETRC}"
-machine ${FTPHOST}
-login anonymous
-password anonymous
-macdef INSTALL
-bin
-prompt
-EOF
-
- for d in ${DIRS}
- do
- cat<<EOF>>"${NETRC}"
-cd ${FTPDIR}/${d}
-lcd ${OUTFILE}/${d}
-mreget *
-EOF
- done
-
- cat<<EOF>>"${NETRC}"
-bye
-
-
-EOF
-
- # Fetch the files via ftp
- echo "$ INSTALL" | ftp -N "${NETRC}" "${FTPHOST}"
-
- # Done fetching, now reset the INSFILE to our downloaded archived
- INSFILE="${OUTFILE}" ; export INSFILE
-}
-
-# Function which does the rsync download from the server specified in cfg
-start_rsync_copy()
-{
- # Load our rsync config values
- get_value_from_cfg rsyncPath
- if [ -z "${VAL}" ]; then
- exit_err "ERROR: rsyncPath is unset! Please check your config and try again."
- fi
- RSYNCPATH="${VAL}" ; export RSYNCPATH
-
- get_value_from_cfg rsyncHost
- if [ -z "${VAL}" ]; then
- exit_err "ERROR: rsyncHost is unset! Please check your config and try again."
- fi
- RSYNCHOST="${VAL}" ; export RSYNCHOST
-
- get_value_from_cfg rsyncUser
- if [ -z "${VAL}" ]; then
- exit_err "ERROR: rsyncUser is unset! Please check your config and try again."
- fi
- RSYNCUSER="${VAL}" ; export RSYNCUSER
-
- get_value_from_cfg rsyncPort
- if [ -z "${VAL}" ]; then
- exit_err "ERROR: rsyncPort is unset! Please check your config and try again."
- fi
- RSYNCPORT="${VAL}" ; export RSYNCPORT
-
- COUNT="1"
- while
- z=1
- do
- if [ ${COUNT} -gt ${RSYNCTRIES} ]
- then
- exit_err "ERROR: Failed rsync command!"
- break
- fi
-
- rsync -avvzHsR \
- --rsync-path="rsync --fake-super" \
- -e "ssh -p ${RSYNCPORT}" \
- ${RSYNCUSER}@${RSYNCHOST}:${RSYNCPATH}/./ ${FSMNT}
- if [ "$?" != "0" ]
- then
- echo "Rsync failed! Tries: ${COUNT}"
- else
- break
- fi
-
- COUNT="`expr ${COUNT} + 1`"
- done
-
-};
-
-start_image_install()
-{
- if [ -z "${IMAGE_FILE}" ]
- then
- exit_err "ERROR: installMedium set to image but no image file specified!"
- fi
-
- # We are ready to start mounting, lets read the config and do it
- while read line
- do
- echo $line | grep "^disk0=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found a disk= entry, lets get the disk we are working on
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- DISK="$VAL"
- fi
-
- echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found our flag to commit this disk setup / lets do sanity check and do it
- if [ ! -z "${DISK}" ]
- then
-
- # Write the image
- write_image "${IMAGE_FILE}" "${DISK}"
-
- # Increment our disk counter to look for next disk and unset
- unset DISK
- break
-
- else
- exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!"
- fi
- fi
-
- done <${CFGF}
-};
-
-# Entrance function, which starts the installation process
-init_extraction()
-{
- # Figure out what file we are using to install from via the config
- get_value_from_cfg installFile
-
- if [ ! -z "${VAL}" ]
- then
- INSFILE="${VAL}" ; export INSFILE
- else
- # If no installFile specified, try our defaults
- if [ "$INSTALLTYPE" = "FreeBSD" ]
- then
- case $PACKAGETYPE in
- uzip) INSFILE="${FBSD_UZIP_FILE}" ;;
- tar) INSFILE="${FBSD_TAR_FILE}" ;;
- split)
- INSDIR="${FBSD_BRANCH_DIR}"
-
- # This is to trick opt_mount into not failing
- INSFILE="${INSDIR}"
- ;;
- esac
- else
- case $PACKAGETYPE in
- uzip) INSFILE="${UZIP_FILE}" ;;
- tar) INSFILE="${TAR_FILE}" ;;
- esac
- fi
- export INSFILE
- fi
-
- # Lets start by figuring out what medium we are using
- case ${INSTALLMEDIUM} in
- LiveCD) # Copies files using cpdup. Ideal for pre-staged fs
- if [ ! -f /usr/local/bin/cpdup ]
- then
- echo "Could not locate cpdup binary" >>${LOGOUT}
- exit_err "Could not locate cpdup binary (pkg_add -r cpdup)?"
- fi
- get_value_from_cfg cpdupPathsPrefix
- if [ ! -z "${VAL}" ]
- CPDUPPATHPREFIX=""
- then
- CPDUPPATHPREFIX="${VAL}" ; export CPDUPPATHPREFIX
- fi
- get_value_from_cfg cpdupPaths
- if [ ! -z "${VAL}" ]
- then
- CPDUPDIR="${VAL}" ; export CPDUPDIR
- fi
- oIFS=$IFS
- IFS=","
- for FILE in $CPDUPDIR; do
- echo_log "pc-sysinstall: Running cpdup -o ${CPDUPPATHPREFIX}/${FILE} /mnt/${FILE}"
- /usr/local/bin/cpdup -o ${CPDUPPATHPREFIX}/${FILE} /mnt/${FILE} >&1 2>&1
- if [ "$?" != "0" ]
- then
- echo "cpdup failure occurred:" >>${LOGOUT}
- exit_err "ERROR: Error occurred during cpdup"
- fi
- done
- IFS=$oIFS
- return
- ;;
- dvd|usb) # Lets start by mounting the disk
- opt_mount
- if [ ! -z "${INSDIR}" ]
- then
- INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR
- start_extract_split
- else
- INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE
- start_extract_uzip_tar
- fi
- ;;
- ftp) fetch_install_file
- start_extract_uzip_tar
- ;;
- rsync) start_rsync_copy
- ;;
- *) exit_err "ERROR: Unknown install medium" ;;
- esac
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-ftp.sh b/usr/sbin/pc-sysinstall/backend/functions-ftp.sh
deleted file mode 100755
index fa05e3f..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-ftp.sh
+++ /dev/null
@@ -1,417 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-ftp.sh,v 1.4 2010/08/24 06:11:46 imp Exp $
-
-# Functions which runs commands on the system
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-DEFAULT_FTP_SERVER="ftp.freebsd.org"
-
-MAIN_FTP_SERVERS="\
-Main Site: ftp.freebsd.org"
-
-IPV6_FTP_SERVERS="\
-IPv6 Main Site: ftp.freebsd.org|\
-IPv6 Ireland: ftp3.ie.freebsd.org|\
-IPv6 Israel: ftp.il.freebsd.org|\
-IPv6 Japan: ftp2.jp.freebsd.org|\
-IPv6 USA: ftp4.us.freebsd.org|\
-IPv6 Turkey: ftp2.tr.freebsd.org"
-
-PRIMARY_FTP_SERVERS="\
-Primary: ftp1.freebsd.org|\
-Primary #2: ftp2.freebsd.org|\
-Primary #3: ftp3.freebsd.org|\
-Primary #4: ftp4.freebsd.org|\
-Primary #5: ftp5.freebsd.org|\
-Primary #6: ftp6.freebsd.org|\
-Primary #7: ftp7.freebsd.org|\
-Primary #8: ftp8.freebsd.org|\
-Primary #9: ftp9.freebsd.org|\
-Primary #10: ftp10.freebsd.org|\
-Primary #11: ftp11.freebsd.org|\
-Primary #12: ftp12.freebsd.org|\
-Primary #13: ftp13.freebsd.org|\
-Primary #14: ftp14.freebsd.org"
-
-ARGENTINA_FTP_SERVERS="\
-Argentina: ftp.ar.freebsd.org"
-
-AUSTRALIA_FTP_SERVERS="\
-Australia: ftp.au.freebsd.org|\
-Australia #2: ftp2.au.freebsd.org|\
-Australia #3: ftp3.au.freebsd.org"
-
-AUSTRIA_FTP_SERVERS="\
-Austria: ftp.at.freebsd.org|\
-Austria #2: ftp2.at.freebsd.org"
-
-BRAZIL_FTP_SERVERS="\
-Brazil: ftp.br.freebsd.org|\
-Brazil #2: ftp2.br.freebsd.org|\
-Brazil #3: ftp3.br.freebsd.org|\
-Brazil #4: ftp4.br.freebsd.org|\
-Brazil #5: ftp5.br.freebsd.org|\
-Brazil #6: ftp6.br.freebsd.org|\
-Brazil #7: ftp7.br.freebsd.org"
-
-CANADA_FTP_SERVERS="\
-Canada: ftp.ca.freebsd.org"
-
-CHINA_FTP_SERVERS="\
-China: ftp.cn.freebsd.org|\
-China #2: ftp2.cn.freebsd.org"
-
-CROATIA_FTP_SERVERS="\
-Croatia: ftp.hr.freebsd.org"
-
-CZECH_REPUBLIC_FTP_SERVERS="\
-Czech Republic: ftp.cz.freebsd.org"
-
-DENMARK_FTP_SERVERS="\
-Denmark: ftp.dk.freebsd.org|\
-Denmark #2: ftp2.dk.freebsd.org"
-
-ESTONIA_FTP_SERVERS="\
-Estonia: ftp.ee.freebsd.org"
-
-FINLAND_FTP_SERVERS="\
-Finland: ftp.fi.freebsd.org"
-
-FRANCE_FTP_SERVERS="\
-France: ftp.fr.freebsd.org|\
-France #2: ftp2.fr.freebsd.org|\
-France #3: ftp3.fr.freebsd.org|\
-France #5: ftp5.fr.freebsd.org|\
-France #6: ftp6.fr.freebsd.org|\
-France #8: ftp8.fr.freebsd.org"
-
-GERMANY_FTP_SERVERS="\
-Germany: ftp.de.freebsd.org|\
-Germany #2: ftp2.de.freebsd.org|\
-Germany #3: ftp3.de.freebsd.org|\
-Germany #4: ftp4.de.freebsd.org|\
-Germany #5: ftp5.de.freebsd.org|\
-Germany #6: ftp6.de.freebsd.org|\
-Germany #7: ftp7.de.freebsd.org|\
-Germany #8: ftp8.de.freebsd.org"
-
-GREECE_FTP_SERVERS="\
-Greece: ftp.gr.freebsd.org|\
-Greece #2: ftp2.gr.freebsd.org"
-
-HUNGARY_FTP_SERVERS="\
-Hungary: ftp.hu.freebsd.org"
-
-ICELAND_FTP_SERVERS="\
-Iceland: ftp.is.freebsd.org"
-
-IRELAND_FTP_SERVERS="\
-Ireland: ftp.ie.freebsd.org|\
-Ireland #2: ftp2.ie.freebsd.org|\
-Ireland #3: ftp3.ie.freebsd.org"
-
-ISRAEL_FTP_SERVERS="\
-Israel: ftp.il.freebsd.org"
-
-ITALY_FTP_SERVERS="\
-Italy: ftp.it.freebsd.org"
-
-JAPAN_FTP_SERVERS="\
-Japan: ftp.jp.freebsd.org|\
-Japan #2: ftp2.jp.freebsd.org|\
-Japan #3: ftp3.jp.freebsd.org|\
-Japan #4: ftp4.jp.freebsd.org|\
-Japan #5: ftp5.jp.freebsd.org|\
-Japan #6: ftp6.jp.freebsd.org|\
-Japan #7: ftp7.jp.freebsd.org|\
-Japan #8: ftp8.jp.freebsd.org|\
-Japan #9: ftp9.jp.freebsd.org"
-
-KOREA_FTP_SERVERS="\
-Korea: ftp.kr.freebsd.org|\
-Korea #2: ftp2.kr.freebsd.org"
-
-LITHUANIA_FTP_SERVERS="\
-Lithuania: ftp.lt.freebsd.org"
-
-NETHERLANDS_FTP_SERVERS="\
-Netherlands: ftp.nl.freebsd.org|\
-Netherlands #2: ftp2.nl.freebsd.org"
-
-NORWAY_FTP_SERVERS="\
-Norway: ftp.no.freebsd.org|\
-Norway #3: ftp3.no.freebsd.org"
-
-POLAND_FTP_SERVERS="\
-Poland: ftp.pl.freebsd.org|\
-Poland #2: ftp2.pl.freebsd.org|\
-Poland #5: ftp5.pl.freebsd.org"
-
-PORTUGAL_FTP_SERVERS="\
-Portugal: ftp.pt.freebsd.org|\
-Portugal #2: ftp2.pt.freebsd.org|\
-Portugal #4: ftp4.pt.freebsd.org"
-
-ROMANIA_FTP_SERVERS="\
-Romania: ftp.ro.freebsd.org"
-
-RUSSIA_FTP_SERVERS="\
-Russia: ftp.ru.freebsd.org|\
-Russia #2: ftp2.ru.freebsd.org|\
-Russia #3: ftp3.ru.freebsd.org|\
-Russia #4: ftp4.ru.freebsd.org"
-
-SINGAPORE_FTP_SERVERS="\
-Singapore: ftp.sg.freebsd.org"
-
-SLOVAK_REPUBLIC_FTP_SERVERS="\
-Slovak Republic: ftp.sk.freebsd.org"
-
-SLOVENIA_FTP_SERVERS="\
-Slovenia: ftp.si.freebsd.org|\
-Slovenia #2: ftp2.si.freebsd.org"
-
-SOUTH_AFRICA_FTP_SERVERS="\
-South Africa: ftp.za.freebsd.org|\
-South Africa #2: ftp2.za.freebsd.org|\
-South Africa #3: ftp3.za.freebsd.org|\
-South Africa #4: ftp4.za.freebsd.org"
-
-SPAIN_FTP_SERVERS="\
-Spain: ftp.es.freebsd.org|\
-Spain #2: ftp2.es.freebsd.org|\
-Spain #3: ftp3.es.freebsd.org"
-
-SWEDEN_FTP_SERVERS="\
-Sweden: ftp.se.freebsd.org|\
-Sweden #2: ftp2.se.freebsd.org|\
-Sweden #3: ftp3.se.freebsd.org|\
-Sweden #5: ftp5.se.freebsd.org"
-
-SWITZERLAND_FTP_SERVERS="\
-Switzerland: ftp.ch.freebsd.org|\
-Switzerland #2: ftp2.ch.freebsd.org"
-
-TAIWAN_FTP_SERVERS="\
-Taiwan: ftp.tw.freebsd.org|\
-Taiwan #2: ftp2.tw.freebsd.org|\
-Taiwan #3: ftp3.tw.freebsd.org|\
-Taiwan #4: ftp4.tw.freebsd.org|\
-Taiwan #6: ftp6.tw.freebsd.org|\
-Taiwan #11: ftp11.tw.freebsd.org"
-
-TURKEY_FTP_SERVERS="\
-Turkey: ftp.tr.freebsd.org|\
-Turkey #2: ftp2.tr.freebsd.org"
-
-UK_FTP_SERVERS="\
-UK: ftp.uk.freebsd.org|\
-UK #2: ftp2.uk.freebsd.org|\
-UK #3: ftp3.uk.freebsd.org|\
-UK #4: ftp4.uk.freebsd.org|\
-UK #5: ftp5.uk.freebsd.org|\
-UK #6: ftp6.uk.freebsd.org"
-
-UKRAINE_FTP_SERVERS="\
-Ukraine: ftp.ua.freebsd.org|\
-Ukraine #2: ftp2.ua.freebsd.org|\
-Ukraine #5: ftp5.ua.freebsd.org|\
-Ukraine #6: ftp6.ua.freebsd.org|\
-Ukraine #7: ftp7.ua.freebsd.org|\
-Ukraine #8: ftp8.ua.freebsd.org"
-
-USA_FTP_SERVERS="\
-USA #1: ftp1.us.freebsd.org|\
-USA #2: ftp2.us.freebsd.org|\
-USA #3: ftp3.us.freebsd.org|\
-USA #4: ftp4.us.freebsd.org|\
-USA #5: ftp5.us.freebsd.org|\
-USA #6: ftp6.us.freebsd.org|\
-USA #7: ftp7.us.freebsd.org|\
-USA #8: ftp8.us.freebsd.org|\
-USA #9: ftp9.us.freebsd.org|\
-USA #10: ftp10.us.freebsd.org|\
-USA #11: ftp11.us.freebsd.org|\
-USA #12: ftp12.us.freebsd.org|\
-USA #13: ftp13.us.freebsd.org|\
-USA #14: ftp14.us.freebsd.org|\
-USA #15: ftp15.us.freebsd.org"
-
-show_mirrors()
-{
- MIRRORS="${1}"
- if [ -n "${MIRRORS}" ]
- then
- SAVE_IFS="${IFS}"
- IFS="|"
- for m in ${MIRRORS}
- do
- echo "$m"
- done
- IFS="${SAVE_IFS}"
- fi
-};
-
-set_ftp_mirror()
-{
- MIRROR="${1}"
- echo "${MIRROR}" > "${CONFDIR}/mirrors.conf"
-};
-
-get_ftp_mirror()
-{
- MIRROR="${DEFAULT_FTP_SERVER}"
- if [ -f "${CONFDIR}/mirrors.conf" ]
- then
- MIRROR=`cat "${CONFDIR}/mirrors.conf"`
- fi
-
- VAL="${MIRROR}"
- export VAL
-};
-
-
-get_ftpHost()
-{
- get_value_from_cfg ftpPath
- ftpPath="$VAL"
-
- ftpHost=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\2|'`
- VAL="${ftpHost}"
-
- export VAL
-};
-
-get_ftpDir()
-{
- get_value_from_cfg ftpPath
- ftpPath="$VAL"
-
- ftpDir=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\3|'`
- VAL="${ftpDir}"
-
- export VAL
-};
-
-get_ftp_mirrors()
-{
- COUNTRY="${1}"
- if [ -n "$COUNTRY" ]
- then
- COUNTRY=`echo $COUNTRY|tr A-Z a-z`
- case "${COUNTRY}" in
- argentina*) VAL="${ARGENTINA_FTP_SERVERS}" ;;
- australia*) VAL="${AUSTRALIA_FTP_SERVERS}" ;;
- austria*) VAL="${AUSTRIA_FTP_SERVERS}" ;;
- brazil*) VAL="${BRAZIL_FTP_SERVERS}" ;;
- canada*) VAL="${CANADA_FTP_SERVERS}" ;;
- china*) VAL="${CHINA_FTP_SERVERS}" ;;
- croatia*) VAL="${CROATIA_FTP_SERVERS}" ;;
- czech*) VAL="${CZECH_REPUBLIC_FTP_SERVERS}" ;;
- denmark*) VAL="${DENMARK_FTP_SERVERS}" ;;
- estonia*) VAL="${ESTONIA_FTP_SERVERS}" ;;
- finland*) VAL="${FINLAND_FTP_SERVERS}" ;;
- france*) VAL="${FRANCE_FTP_SERVERS}" ;;
- germany*) VAL="${GERMANY_FTP_SERVERS}" ;;
- greece*) VAL="${GREECE_FTP_SERVERS}" ;;
- hungary*) VAL="${HUNGARY_FTP_SERVERS}" ;;
- iceland*) VAL="${ICELAND_FTP_SERVERS}" ;;
- ireland*) VAL="${IRELAND_FTP_SERVERS}" ;;
- israel*) VAL="${ISRAEL_FTP_SERVERS}" ;;
- italy*) VAL="${ITALY_FTP_SERVERS}" ;;
- japan*) VAL="${JAPAN_FTP_SERVERS}" ;;
- korea*) VAL="${KOREA_FTP_SERVERS}" ;;
- lithuania*) VAL="${LITHUANIA_FTP_SERVERS}" ;;
- netherlands*) VAL="${NETHERLANDS_FTP_SERVERS}" ;;
- norway*) VAL="${NORWAY_FTP_SERVERS}" ;;
- poland*) VAL="${POLAND_FTP_SERVERS}" ;;
- portugal*) VAL="${PORTUGAL_FTP_SERVERS}" ;;
- romania*) VAL="${ROMAINIA_FTP_SERVERS}" ;;
- russia*) VAL="${RUSSIA_FTP_SERVERS}" ;;
- singapore*) VAL="${SINGAPORE_FTP_SERVERS}" ;;
- slovak*) VAL="${SLOVAK_REPUBLIC_FTP_SERVERS}" ;;
- slovenia*) VAL="${SLOVENIA_FTP_SERVERS}" ;;
- *africa*) VAL="${SOUTH_AFRICA_FTP_SERVERS}" ;;
- spain*) VAL="${SPAIN_FTP_SERVERS}" ;;
- sweden*) VAL="${SWEDEN_FTP_SERVERS}" ;;
- switzerland*) VAL="${SWITZERLAND_FTP_SERVERS}" ;;
- taiwan*) VAL="${TAIWAN_FTP_SERVERS}" ;;
- turkey*) VAL="${TURKEY_FTP_SERVERS}" ;;
- ukraine*) VAL="${UKRAINE_FTP_SERVERS}" ;;
- uk*) VAL="${UK_FTP_SERVERS}" ;;
- usa*) VAL="${USA_FTP_SERVERS}" ;;
- esac
- else
- VAL="${MAIN_FTP_SERVERS}"
- VAL="${VAL}|${IPV6_FTP_SERVERS}"
- VAL="${VAL}|${PRIMARY_FTP_SERVERS}"
- VAL="${VAL}|${ARGENTINA_FTP_SERVERS}"
- VAL="${VAL}|${AUSTRALIA_FTP_SERVERS}"
- VAL="${VAL}|${AUSTRIA_FTP_SERVERS}"
- VAL="${VAL}|${BRAZIL_FTP_SERVERS}"
- VAL="${VAL}|${CANADA_FTP_SERVERS}"
- VAL="${VAL}|${CHINA_FTP_SERVERS}"
- VAL="${VAL}|${CROATIA_FTP_SERVERS}"
- VAL="${VAL}|${CZECH_REPUBLIC_FTP_SERVERS}"
- VAL="${VAL}|${DENMARK_FTP_SERVERS}"
- VAL="${VAL}|${ESTONIA_FTP_SERVERS}"
- VAL="${VAL}|${FINLAND_FTP_SERVERS}"
- VAL="${VAL}|${FRANCE_FTP_SERVERS}"
- VAL="${VAL}|${GERMANY_FTP_SERVERS}"
- VAL="${VAL}|${GREECE_FTP_SERVERS}"
- VAL="${VAL}|${HUNGARY_FTP_SERVERS}"
- VAL="${VAL}|${ICELAND_FTP_SERVERS}"
- VAL="${VAL}|${IRELAND_FTP_SERVERS}"
- VAL="${VAL}|${ISRAEL_FTP_SERVERS}"
- VAL="${VAL}|${ITALY_FTP_SERVERS}"
- VAL="${VAL}|${JAPAN_FTP_SERVERS}"
- VAL="${VAL}|${KOREA_FTP_SERVERS}"
- VAL="${VAL}|${LITHUANIA_FTP_SERVERS}"
- VAL="${VAL}|${NETHERLANDS_FTP_SERVERS}"
- VAL="${VAL}|${NORWAY_FTP_SERVERS}"
- VAL="${VAL}|${POLAND_FTP_SERVERS}"
- VAL="${VAL}|${PORTUGAL_FTP_SERVERS}"
- VAL="${VAL}|${ROMANIA_FTP_SERVERS}"
- VAL="${VAL}|${RUSSIA_FTP_SERVERS}"
- VAL="${VAL}|${SINGAPORE_FTP_SERVERS}"
- VAL="${VAL}|${SLOVAK_REPUBLIC_FTP_SERVERS}"
- VAL="${VAL}|${SLOVENIA_FTP_SERVERS}"
- VAL="${VAL}|${SOUTH_AFRICA_FTP_SERVERS}"
- VAL="${VAL}|${SPAIN_FTP_SERVERS}"
- VAL="${VAL}|${SWEDEN_FTP_SERVERS}"
- VAL="${VAL}|${SWITZERLAND_FTP_SERVERS}"
- VAL="${VAL}|${TAIWAN_FTP_SERVERS}"
- VAL="${VAL}|${TURKEY_FTP_SERVERS}"
- VAL="${VAL}|${UKRAINE_FTP_SERVERS}"
- VAL="${VAL}|${UK_FTP_SERVERS}"
- VAL="${VAL}|${USA_FTP_SERVERS}"
- fi
-
- export VAL
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-installcomponents.sh b/usr/sbin/pc-sysinstall/backend/functions-installcomponents.sh
deleted file mode 100755
index 5aa6f84..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-installcomponents.sh
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh,v 1.4 2010/09/08 20:10:24 imp Exp $
-
-# Functions which check and load any optional modules specified in the config
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-copy_component()
-{
- COMPONENT="$1"
- FAILED="0"
- CFILES=""
-
- # Check the type, and set the components subdir properly
- TYPE="`grep 'type:' ${COMPDIR}/${COMPONENT}/component.cfg | cut -d ' ' -f 2`"
- if [ "${TYPE}" = "PBI" ]
- then
- SUBDIR="PBI"
- else
- SUBDIR="components"
- fi
-
- # Lets start by downloading / copying the files this component needs
- while read line
- do
- CFILE="`echo $line | cut -d ':' -f 1`"
- CFILEMD5="`echo $line | cut -d ':' -f 2`"
- CFILE2MD5="`echo $line | cut -d ':' -f 3`"
-
- case ${INSTALLMEDIUM} in
- dvd|usb)
- # On both dvd / usb, we can just copy the file
- cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \
- ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
- RESULT="$?"
- ;;
-
- ftp)
- get_value_from_cfg ftpPath
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!"
- fi
- FTPPATH="${VAL}"
-
- fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0"
- RESULT="$?"
- ;;
-
- sftp) ;;
- esac
-
- if [ "${RESULT}" != "0" ]
- then
- echo_log "WARNING: Failed to copy ${CFILE}"
- FAILED="1"
- else
- # Now lets check the MD5 to confirm the file is valid
- CHECKMD5=`md5 -q ${FSMNT}/${COMPTMPDIR}/${CFILE}`
- if [ "${CHECKMD5}" != "${CFILEMD5}" -a "${CHECKMD5}" != "${CFILE2MD5}" ]
- then
- echo_log "WARNING: ${CFILE} failed md5 checksum"
- FAILED="1"
- else
- if [ -z "${CFILES}" ]
- then
- CFILES="${CFILE}"
- else
- CFILES="${CFILES},${CFILE}"
- fi
- fi
- fi
-
-
- done < ${COMPDIR}/${COMPONENT}/distfiles
-
- if [ "${FAILED}" = "0" ]
- then
- # Now install the component
- run_component_install ${COMPONENT} ${CFILES}
- fi
-
-};
-
-run_component_install()
-{
- COMPONENT="$1"
- CFILES="$1"
-
- # Lets install this component now
- # Start by making a wrapper script which sets the variables
- # for the component to use
- echo "#!/bin/sh
-COMPTMPDIR=\"${COMPTMPDIR}\"
-export COMPTMPDIR
-CFILE=\"${CFILE}\"
-export CFILE
-
-sh ${COMPTMPDIR}/install.sh
-
-" >${FSMNT}/.componentwrapper.sh
- chmod 755 ${FSMNT}/.componentwrapper.sh
-
- # Copy over the install script for this component
- cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/
-
- echo_log "INSTALL COMPONENT: ${i}"
- chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT}
- rm ${FSMNT}/.componentwrapper.sh
-
-};
-
-# Check for any modules specified, and begin loading them
-install_components()
-{
- # First, lets check and see if we even have any optional modules
- get_value_from_cfg installComponents
- if [ ! -z "${VAL}" ]
- then
- # Lets start by cleaning up the string and getting it ready to parse
- strip_white_space ${VAL}
- COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"`
- for i in $COMPONENTS
- do
- if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ]
- then
- echo_log "WARNING: Component ${i} doesn't seem to exist"
- else
-
- # Make the tmpdir on the disk
- mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
-
- # Start by grabbing the component files
- copy_component ${i}
-
- # Remove the tmpdir now
- rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
- fi
- done
- fi
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-installpackages.sh b/usr/sbin/pc-sysinstall/backend/functions-installpackages.sh
deleted file mode 100644
index b8f383a..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-installpackages.sh
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which check and load any optional packages specified in the config
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-# Recursively determine all dependencies for this package
-determine_package_dependencies()
-{
- local PKGNAME="${1}"
- local DEPFILE="${2}"
-
- grep "${PKGNAME}" "${DEPFILE}" >/dev/null
- if [ "$?" -ne "0" ]
- then
- echo "${PKGNAME}" >> "${DEPFILE}"
- get_package_dependencies "${PKGNAME}" "1"
-
- local DEPS="${VAL}"
- for d in ${DEPS}
- do
- determine_package_dependencies "${d}" "${DEPFILE}"
- done
- fi
-};
-
-# Fetch packages dependencies from a file
-fetch_package_dependencies()
-{
- local DEPFILE
- local DEPS
- local SAVEDIR
-
- DEPFILE="${1}"
- DEPS=`cat "${DEPFILE}"`
- SAVEDIR="${2}"
-
- for d in ${DEPS}
- do
- get_package_short_name "${d}"
- SNAME="${VAL}"
-
- get_package_category "${SNAME}"
- CATEGORY="${VAL}"
-
- fetch_package "${CATEGORY}" "${d}" "${SAVEDIR}"
- done
-};
-
-# Check for any packages specified, and begin loading them
-install_packages()
-{
- # First, lets check and see if we even have any packages to install
- get_value_from_cfg installPackages
- if [ ! -z "${VAL}" ]
- then
- HERE=`pwd`
- rc_nohalt "mkdir -p ${FSMNT}/${PKGTMPDIR}"
- rc_nohalt "cd ${FSMNT}/${PKGTMPDIR}"
-
- if [ ! -f "${CONFDIR}/INDEX" ]
- then
- get_package_index
- fi
-
- if [ ! -f "${CONFDIR}/INDEX.parsed" ]
- then
- parse_package_index
- fi
-
- # Lets start by cleaning up the string and getting it ready to parse
- strip_white_space ${VAL}
- PACKAGES=`echo ${VAL} | sed -e "s|,| |g"`
- for i in $PACKAGES
- do
- if get_package_name "${i}"
- then
- PKGNAME="${VAL}"
- DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
-
- rc_nohalt "touch ${DEPFILE}"
- determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
- fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
-
- # If the package is not already installed, install it!
- if ! run_chroot_cmd "pkg_info -e ${PKGNAME}"
- then
- rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz"
- fi
-
- rc_nohalt "rm ${DEPFILE}"
- fi
-
- rc_nohalt "cd ${HERE}"
- done
-
- rm -rf "${FSMNT}/${PKGTMPDIR}"
- fi
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-localize.sh b/usr/sbin/pc-sysinstall/backend/functions-localize.sh
deleted file mode 100755
index a56f957..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-localize.sh
+++ /dev/null
@@ -1,511 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-localize.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which runs commands on the system
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-
-# Function which localizes a FreeBSD install
-localize_freebsd()
-{
- sed -i.bak "s/lang=en_US/lang=${LOCALE}/g" ${FSMNT}/etc/login.conf
- rm ${FSMNT}/etc/login.conf.bak
-};
-
-
-# Function which localizes a PC-BSD install
-localize_pcbsd()
-{
- #Change the skel files
- ##########################################################################
- sed -i.bak "s/Country=us/Country=${COUNTRY}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
- sed -i.bak "s/Country=us/Country=${COUNTRY}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals
- sed -i.bak "s/Language=en_US/Language=${SETLANG}:${LOCALE}/g" ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
- sed -i.bak "s/Language=en_US/Language=${SETLANG}:${LOCALE}/g" ${FSMNT}/root/.kde4/share/config/kdeglobals
-
- #Change KDM Langs
- ##########################################################################
- sed -i.bak "s/Language=en_US/Language=${LOCALE}.UTF-8/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
-
- # Check if we have a localized splash screen and copy it
- if [ -e "${FSMNT}/usr/PCBSD/splash-screens/loading-screen-${SETLANG}.pcx" ]
- then
- cp ${FSMNT}/usr/PCBSD/splash-screens/loading-screen-${SETLANG}.pcx ${FSMNT}/boot/loading-screen.pcx
- fi
-
-};
-
-localize_x_keyboard()
-{
- KEYMOD="$1"
- KEYLAY="$2"
- KEYVAR="$3"
- COUNTRY="$4"
- OPTION="grp:alt_shift_toggle"
- SETXKBMAP=""
-
- if [ "${COUNTRY}" = "NONE" -o "${COUNTRY}" = "us" -o "${COUNTRY}" = "C" ] ; then
- #In this case we don't need any additional language
- COUNTRY=""
- OPTION=""
- else
- COUNTRY=",${COUNTRY}"
- fi
-
- if [ "${KEYMOD}" != "NONE" ]
- then
- SETXKBMAP="-model ${KEYMOD}"
- KXMODEL="${KEYMOD}"
- else
- KXMODEL="pc104"
- fi
-
- if [ "${KEYLAY}" != "NONE" ]
- then
- localize_key_layout "$KEYLAY"
- SETXKBMAP="${SETXKBMAP} -layout ${KEYLAY}"
- KXLAYOUT="${KEYLAY}"
- else
- KXLAYOUT="us"
- fi
-
- if [ "${KEYVAR}" != "NONE" ]
- then
- SETXKBMAP="${SETXKBMAP} -variant ${KEYVAR}"
- KXVAR="(${KEYVAR})"
- else
- KXVAR=""
- fi
-
- # Setup .xprofile with our setxkbmap call now
- if [ ! -z "${SETXKBMAP}" ]
- then
- if [ ! -e "${FSMNT}/usr/share/skel/.xprofile" ]
- then
- echo "#!/bin/sh" >${FSMNT}/usr/share/skel/.xprofile
- fi
-
- # Save the keyboard layout for user / root X logins
- echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/share/skel/.xprofile
- chmod 755 ${FSMNT}/usr/share/skel/.xprofile
- cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile
-
- # Save it for KDM
- echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup
- fi
-
-
- # Create the kxkbrc configuration using these options
- echo "[Layout]
-DisplayNames=${KXLAYOUT}${COUNTRY}
-IndicatorOnly=false
-LayoutList=${KXLAYOUT}${KXVAR}${COUNTRY}
-Model=${KXMODEL}
-Options=${OPTION}
-ResetOldOptions=true
-ShowFlag=true
-ShowSingle=false
-SwitchMode=WinClass
-Use=true " >${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc
-
-};
-
-localize_key_layout()
-{
-
- KEYLAYOUT="$1"
-
- # Set the keylayout in rc.conf
- case ${KEYLAYOUT} in
- am) KEYLAYOUT_CONSOLE="hy.armscii-8" ;;
- ch) KEYLAYOUT_CONSOLE="swissgerman.iso" ;;
- cz) KEYLAYOUT_CONSOLE="cz.iso2" ;;
- de) KEYLAYOUT_CONSOLE="german.iso" ;;
- dk) KEYLAYOUT_CONSOLE="danish.iso" ;;
- ee) KEYLAYOUT_CONSOLE="estonian.iso" ;;
- es) KEYLAYOUT_CONSOLE="spanish.iso" ;;
- fi) KEYLAYOUT_CONSOLE="finnish.iso" ;;
- is) KEYLAYOUT_CONSOLE="icelandic.iso" ;;
- jp) KEYLAYOUT_CONSOLE="jp.106" ;;
- nl) KEYLAYOUT_CONSOLE="dutch.iso.acc" ;;
- no) KEYLAYOUT_CONSOLE="norwegian.iso" ;;
- pl) KEYLAYOUT_CONSOLE="pl_PL.ISO8859-2" ;;
- ru) KEYLAYOUT_CONSOLE="ru.koi8-r" ;;
- sk) KEYLAYOUT_CONSOLE="sk.iso2" ;;
- se) KEYLAYOUT_CONSOLE="swedish.iso" ;;
- tr) KEYLAYOUT_CONSOLE="tr.iso9.q" ;;
- gb) KEYLAYOUT_CONSOLE="uk.iso" ;;
- *) if [ ! -z "${KEYLAYOUT}" ]
- then
- KEYLAYOUT_CONSOLE="${KEYLAYOUT}.iso"
- fi
- ;;
- esac
-
- if [ ! -z "${KEYLAYOUT_CONSOLE}" ]
- then
- echo "keymap=\"${KEYLAYOUT_CONSOLE}\"" >>${FSMNT}/etc/rc.conf
- fi
-
-};
-
-# Function which prunes other l10n files from the KDE install
-localize_prune_langs()
-{
- get_value_from_cfg localizeLang
- KEEPLANG="$VAL"
- if [ -z "$KEEPLANG" ] ; then
- KEEPLANG="en"
- fi
- export KEEPLANG
-
- echo_log "Pruning other l10n files, keeping ${KEEPLANG}"
-
- # Create the script to do uninstalls
- echo '#!/bin/sh
-
- for i in `pkg_info | grep "kde-l10n" | cut -d " " -f 1`
- do
- echo "$i" | grep "${KEEPLANG}-kde"
- if [ "$?" != "0" ] ; then
- pkg_delete ${i}
- fi
- done
- ' > ${FSMNT}/.pruneLangs.sh
-
- chmod 755 ${FSMNT}/.pruneLangs.sh
- chroot ${FSMNT} /.pruneLangs.sh >/dev/null 2>/dev/null
- rm ${FSMNT}/.pruneLangs.sh
-
-};
-
-# Function which sets COUNTRY SETLANG and LOCALE based upon $1
-localize_get_codes()
-{
- TARGETLANG="${1}"
- # Setup the presets for the specific lang
- case $TARGETLANG in
- af)
- COUNTRY="C"
- SETLANG="af"
- LOCALE="af_ZA"
- ;;
- ar)
- COUNTRY="C"
- SETLANG="ar"
- LOCALE="en_US"
- ;;
- az)
- COUNTRY="C"
- SETLANG="az"
- LOCALE="en_US"
- ;;
- ca)
- COUNTRY="es"
- SETLANG="es:ca"
- LOCALE="ca_ES"
- ;;
- be)
- COUNTRY="be"
- SETLANG="be"
- LOCALE="be_BY"
- ;;
- bn)
- COUNTRY="bn"
- SETLANG="bn"
- LOCALE="en_US"
- ;;
- bg)
- COUNTRY="bg"
- SETLANG="bg"
- LOCALE="bg_BG"
- ;;
- cs)
- COUNTRY="cz"
- SETLANG="cs"
- LOCALE="cs_CZ"
- ;;
- da)
- COUNTRY="dk"
- SETLANG="da"
- LOCALE="da_DK"
- ;;
- de)
- COUNTRY="de"
- SETLANG="de"
- LOCALE="de_DE"
- ;;
- en_GB)
- COUNTRY="gb"
- SETLANG="en_GB:cy"
- LOCALE="en_GB"
- ;;
- el)
- COUNTRY="gr"
- SETLANG="el:gr"
- LOCALE="el_GR"
- ;;
- es)
- COUNTRY="es"
- SETLANG="es"
- LOCALE="es_ES"
- ;;
- es_LA)
- COUNTRY="us"
- SETLANG="es:en_US"
- LOCALE="es_ES"
- ;;
- et)
- COUNTRY="ee"
- SETLANG="et"
- LOCALE="et_EE"
- ;;
- fr)
- COUNTRY="fr"
- SETLANG="fr"
- LOCALE="fr_FR"
- ;;
- he)
- COUNTRY="il"
- SETLANG="he:ar"
- LOCALE="he_IL"
- ;;
- hr)
- COUNTRY="hr"
- SETLANG="hr"
- LOCALE="hr_HR"
- ;;
- hu)
- COUNTRY="hu"
- SETLANG="hu"
- LOCALE="hu_HU"
- ;;
- it)
- COUNTRY="it"
- SETLANG="it"
- LOCALE="it_IT"
- ;;
- ja)
- COUNTRY="jp"
- SETLANG="ja"
- LOCALE="ja_JP"
- ;;
- ko)
- COUNTRY="kr"
- SETLANG="ko"
- LOCALE="ko_KR"
- ;;
- nl)
- COUNTRY="nl"
- SETLANG="nl"
- LOCALE="nl_NL"
- ;;
- nn)
- COUNTRY="no"
- SETLANG="nn"
- LOCALE="en_US"
- ;;
- pa)
- COUNTRY="pa"
- SETLANG="pa"
- LOCALE="en_US"
- ;;
- pl)
- COUNTRY="pl"
- SETLANG="pl"
- LOCALE="pl_PL"
- ;;
- pt)
- COUNTRY="pt"
- SETLANG="pt"
- LOCALE="pt_PT"
- ;;
- pt_BR)
- COUNTRY="br"
- SETLANG="pt_BR"
- LOCALE="pt_BR"
- ;;
- ru)
- COUNTRY="ru"
- SETLANG="ru"
- LOCALE="ru_RU"
- ;;
- sl)
- COUNTRY="si"
- SETLANG="sl"
- LOCALE="sl_SI"
- ;;
- sk)
- COUNTRY="sk"
- SETLANG="sk"
- LOCALE="sk_SK"
- ;;
- sv)
- COUNTRY="se"
- SETLANG="sv"
- LOCALE="sv_SE"
- ;;
- uk)
- COUNTRY="ua"
- SETLANG="uk"
- LOCALE="uk_UA"
- ;;
- vi)
- COUNTRY="vn"
- SETLANG="vi"
- LOCALE="en_US"
- ;;
- zh_CN)
- COUNTRY="cn"
- SETLANG="zh_CN"
- LOCALE="zh_CN"
- ;;
- zh_TW)
- COUNTRY="tw"
- SETLANG="zh_TW"
- LOCALE="zh_TW"
- ;;
- *)
- COUNTRY="C"
- SETLANG="${TARGETLANG}"
- LOCALE="en_US"
- ;;
- esac
-
- export COUNTRY SETLANG LOCALE
-
-};
-
-# Function which sets the timezone on the system
-set_timezone()
-{
- TZONE="$1"
- cp ${FSMNT}/usr/share/zoneinfo/${TZONE} ${FSMNT}/etc/localtime
-};
-
-# Function which enables / disables NTP
-set_ntp()
-{
- ENABLED="$1"
- if [ "$ENABLED" = "yes" -o "${ENABLED}" = "YES" ]
- then
- cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep 'ntpd_enable="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- echo 'ntpd_enable="YES"' >>${FSMNT}/etc/rc.conf
- echo 'ntpd_sync_on_start="YES"' >>${FSMNT}/etc/rc.conf
- fi
- else
- cat ${FSMNT}/etc/rc.conf 2>/dev/null | grep 'ntpd_enable="YES"' >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- sed -i.bak 's|ntpd_enable="YES"||g' ${FSMNT}/etc/rc.conf
- fi
- fi
-};
-
-# Starts checking for localization directives
-run_localize()
-{
- KEYLAYOUT="NONE"
- KEYMOD="NONE"
- KEYVAR="NONE"
-
- while read line
- do
- # Check if we need to do any localization
- echo $line | grep "^localizeLang=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
-
- # Set our country / lang / locale variables
- get_value_from_string "$line"
- localize_get_codes ${VAL}
-
- get_value_from_string "$line"
- # If we are doing PC-BSD install, localize it as well as FreeBSD base
- if [ "${INSTALLTYPE}" != "FreeBSD" ]
- then
- localize_pcbsd "$VAL"
- fi
- localize_freebsd "$VAL"
- fi
-
- # Check if we need to do any keylayouts
- echo $line | grep "^localizeKeyLayout=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- get_value_from_string "$line"
- KEYLAYOUT="$VAL"
- fi
-
- # Check if we need to do any key models
- echo $line | grep "^localizeKeyModel=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- get_value_from_string "$line"
- KEYMOD="$VAL"
- fi
-
- # Check if we need to do any key variant
- echo $line | grep "^localizeKeyVariant=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- get_value_from_string "$line"
- KEYVAR="$VAL"
- fi
-
-
- # Check if we need to set a timezone
- echo $line | grep "^timeZone=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- get_value_from_string "$line"
- set_timezone "$VAL"
- fi
-
- # Check if we need to set a timezone
- echo $line | grep "^enableNTP=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- get_value_from_string "$line"
- set_ntp "$VAL"
- fi
- done <${CFGF}
-
- if [ "${INSTALLTYPE}" != "FreeBSD" ] ; then
- # Do our X keyboard localization
- localize_x_keyboard "${KEYMOD}" "${KEYLAYOUT}" "${KEYVAR}" "${COUNTRY}"
- fi
-
- # Check if we want to prunt any other KDE lang files to save some disk space
- get_value_from_cfg localizePrune
- if [ "${VAL}" = "yes" -o "${VAL}" = "YES" ] ; then
- localize_prune_langs
- fi
-
- # Update the login.conf db, even if we didn't localize, its a good idea to make sure its up2date
- run_chroot_cmd "/usr/bin/cap_mkdb /etc/login.conf" >/dev/null 2>/dev/null
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-mountdisk.sh b/usr/sbin/pc-sysinstall/backend/functions-mountdisk.sh
deleted file mode 100755
index 9424a62..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-mountdisk.sh
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh,v 1.5 2010/10/09 08:52:09 imp Exp $
-
-# Functions related mounting the newly formatted disk partitions
-
-# Mounts all the specified partition to the mount-point
-mount_partition()
-{
- if [ -z "${1}" -o -z "${2}" -o -z "${3}" ]
- then
- exit_err "ERROR: Missing arguments for mount_partition"
- fi
-
- PART="${1}"
- PARTFS="${2}"
- MNTPOINT="${3}"
- MNTFLAGS="${4}"
-
- # Setup the MNTOPTS
- if [ -z "${MNTOPTS}" ]
- then
- MNTFLAGS="-o rw"
- else
- MNTFLAGS="-o rw,${MNTFLAGS}"
- fi
-
-
- #We are on ZFS, lets setup this mount-point
- if [ "${PARTFS}" = "ZFS" ]
- then
- ZPOOLNAME=$(get_zpool_name "${PART}")
-
- # Check if we have multiple zfs mounts specified
- for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'`
- do
- # First make sure we create the mount point
- if [ ! -d "${FSMNT}${ZMNT}" ] ; then
- mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT}
- fi
-
- if [ "${ZMNT}" = "/" ] ; then
- ZNAME=""
- else
- ZNAME="${ZMNT}"
- echo_log "zfs create -p ${ZPOOLNAME}${ZNAME}"
- rc_halt "zfs create -p ${ZPOOLNAME}${ZNAME}"
- fi
- sleep 2
- rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}"
-
- # Disable atime for this zfs partition, speed increase
- rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}"
- done
-
- else
- # If we are not on ZFS, lets do the mount now
- # First make sure we create the mount point
- if [ ! -d "${FSMNT}${MNTPOINT}" ]
- then
- mkdir -p ${FSMNT}${MNTPOINT} >>${LOGOUT} 2>>${LOGOUT}
- fi
-
- echo_log "mount ${MNTFLAGS} /dev/${PART} -> ${FSMNT}${MNTPOINT}"
- sleep 2
- rc_halt "mount ${MNTFLAGS} /dev/${PART} ${FSMNT}${MNTPOINT}"
- fi
-
-};
-
-# Mounts all the new file systems to prepare for installation
-mount_all_filesystems()
-{
- # Make sure our mount point exists
- mkdir -p ${FSMNT} >/dev/null 2>/dev/null
-
- # First lets find and mount the / partition
- #########################################################
- for PART in `ls ${PARTDIR}`
- do
- if [ ! -e "/dev/${PART}" ]
- then
- exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
- fi
-
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
-
- if [ "${PARTENC}" = "ON" ]
- then
- EXT=".eli"
- else
- EXT=""
- fi
-
- # Check for root partition for mounting, including ZFS "/,/usr" type
- echo "$PARTMNT" | grep "/," >/dev/null
- if [ "$?" = "0" -o "$PARTMNT" = "/" ]
- then
- case ${PARTFS} in
- UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+SUJ) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;;
- ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT} ;;
- IMAGE) mount_partition ${PART} ${PARTFS} ${PARTMNT} ;;
- *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
- esac
- fi
- done
-
- # Now that we've mounted "/" lets do any other remaining mount-points
- ##################################################################
- for PART in `ls ${PARTDIR}`
- do
- if [ ! -e "/dev/${PART}" ]
- then
- exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
- fi
-
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
-
- if [ "${PARTENC}" = "ON" ]
- then
- EXT=".eli"
- else
- EXT=""
- fi
-
- # Check if we've found "/" again, don't need to mount it twice
- echo "$PARTMNT" | grep "/," >/dev/null
- if [ "$?" != "0" -a "$PARTMNT" != "/" ]
- then
- case ${PARTFS} in
- UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+SUJ) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
- UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;;
- ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT} ;;
- SWAP)
- # Lets enable this swap now
- if [ "$PARTENC" = "ON" ]
- then
- echo_log "Enabling encrypted swap on /dev/${PART}"
- rc_halt "geli onetime -d -e 3des ${PART}"
- sleep 5
- rc_halt "swapon /dev/${PART}.eli"
- else
- echo_log "swapon ${PART}"
- sleep 5
- rc_halt "swapon /dev/${PART}"
- fi
- ;;
- IMAGE)
- if [ ! -d "${PARTMNT}" ]
- then
- mkdir -p "${PARTMNT}"
- fi
- mount_partition ${PART} ${PARTFS} ${PARTMNT}
- ;;
- *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
- esac
- fi
- done
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-mountoptical.sh b/usr/sbin/pc-sysinstall/backend/functions-mountoptical.sh
deleted file mode 100755
index 1e0eff3..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-mountoptical.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which perform mounting / unmounting and switching of
-# optical / usb media
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-# Displays an optical failure message
-opt_fail()
-{
- # If we got here, we must not have a DVD/USB we can find :(
- get_value_from_cfg installInteractive
- if [ "${VAL}" = "yes" ]
- then
- # We are running interactive, and didn't find a DVD, prompt user again
- echo_log "DISK ERROR: Unable to find installation disk!"
- echo_log "Please insert the installation disk and press enter."
- read tmp
- else
- exit_err "ERROR: Unable to locate installation DVD/USB"
- fi
-};
-
-# Performs the extraction of data to disk
-opt_mount()
-{
- FOUND="0"
-
- # Ensure we have a directory where its supposed to be
- if [ ! -d "${CDMNT}" ]
- then
- mkdir -p ${CDMNT}
- fi
-
-
- # Start by checking if we already have a cd mounted at CDMNT
- mount | grep "${CDMNT} " >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- if [ -e "${CDMNT}/${INSFILE}" ]
- then
- echo "MOUNTED" >${TMPDIR}/cdmnt
- echo_log "FOUND DVD: MOUNTED"
- FOUND="1"
- return
- fi
-
- # failed to find optical disk
- opt_fail
- return
- fi
-
- # Setup our loop to search for installation media
- while
- z=1
- do
-
- # Loop though and look for an installation disk
- for i in `ls -1 /dev/acd* /dev/cd* /dev/scd* /dev/rscd* 2>/dev/null`
- do
- # Find the CD Device
- /sbin/mount_cd9660 $i ${CDMNT}
-
- # Check the package type to see if we have our install data
- if [ -e "${CDMNT}/${INSFILE}" ]
- then
- echo "${i}" >${TMPDIR}/cdmnt
- echo_log "FOUND DVD: ${i}"
- FOUND="1"
- break
- fi
- #/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
- done
-
- # If no DVD found, try USB
- if [ "$FOUND" != "1" ]
- then
- # Loop though and look for an installation disk
- for i in `ls -1 /dev/da* 2>/dev/null`
- do
- # Check if we can mount this device UFS
- /sbin/mount -r $i ${CDMNT}
-
- # Check the package type to see if we have our install data
- if [ -e "${CDMNT}/${INSFILE}" ]
- then
- echo "${i}" >${TMPDIR}/cdmnt
- echo_log "FOUND USB: ${i}"
- FOUND="1"
- break
- fi
- #/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
-
- # Also check if it is a FAT mount
- /sbin/mount -r -t msdosfs $i ${CDMNT}
-
- # Check the package type to see if we have our install data
- if [ -e "${CDMNT}/${INSFILE}" ]
- then
- echo "${i}" >${TMPDIR}/cdmnt
- echo_log "FOUND USB: ${i}"
- FOUND="1"
- break
- fi
- #/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
- done
- fi # End of USB Check
-
-
- if [ "$FOUND" = "1" ]
- then
- break
- fi
-
- # Failed to find a disk, take action now
- opt_fail
-
- done
-
-};
-
-# Function to unmount optical media
-opt_umount()
-{
- /sbin/umount ${CDMNT} >/dev/null 2>/dev/null
-};
-
diff --git a/usr/sbin/pc-sysinstall/backend/functions-networking.sh b/usr/sbin/pc-sysinstall/backend/functions-networking.sh
deleted file mode 100755
index fa0fa06..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-networking.sh
+++ /dev/null
@@ -1,357 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-networking.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which perform our networking setup
-
-# Function which creates a kde4 .desktop file for the PC-BSD net tray
-create_desktop_nettray()
-{
- NIC="${1}"
- echo "#!/usr/bin/env xdg-open
-[Desktop Entry]
-Exec=/usr/local/kde4/bin/pc-nettray ${NIC}
-Icon=network
-StartupNotify=false
-Type=Application" > ${FSMNT}/usr/share/skel/.kde4/Autostart/tray-${NIC}.desktop
- chmod 744 ${FSMNT}/usr/share/skel/.kde4/Autostart/tray-${NIC}.desktop
-
-};
-
-# Function which checks is a nic is wifi or not
-check_is_wifi()
-{
- NIC="$1"
- ifconfig ${NIC} | grep "802.11" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- return 0
- else
- return 1
- fi
-};
-
-# Function to get the first available wired nic, used for lagg0 setup
-get_first_wired_nic()
-{
- rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
- # start by getting a list of nics on this system
- ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
- if [ -e "${TMPDIR}/.niclist" ]
- then
- while read line
- do
- NIC="`echo $line | cut -d ':' -f 1`"
- check_is_wifi ${NIC}
- if [ "$?" != "0" ]
- then
- VAL="${NIC}" ; export VAL
- return
- fi
- done < ${TMPDIR}/.niclist
- fi
-
- VAL="" ; export VAL
- return
-};
-
-# Function which simply enables plain dhcp on all detected nics, not fancy lagg interface
-enable_plain_dhcp_all()
-{
- rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
- # start by getting a list of nics on this system
- ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
- if [ -e "${TMPDIR}/.niclist" ]
- then
- echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf
- WLANCOUNT="0"
- while read line
- do
- NIC="`echo $line | cut -d ':' -f 1`"
- DESC="`echo $line | cut -d ':' -f 2`"
- echo_log "Setting $NIC to DHCP on the system."
- check_is_wifi ${NIC}
- if [ "$?" = "0" ]
- then
- # We have a wifi device, setup a wlan* entry for it
- WLAN="wlan${WLANCOUNT}"
- echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf
- echo "ifconfig_${WLAN}=\"DHCP\"" >>${FSMNT}/etc/rc.conf
- CNIC="${WLAN}"
- WLANCOUNT="`expr ${WLANCOUNT} + 1`"
- else
- echo "ifconfig_${NIC}=\"DHCP\"" >>${FSMNT}/etc/rc.conf
- CNIC="${NIC}"
- fi
-
- done < ${TMPDIR}/.niclist
- fi
-};
-
-# Function which enables fancy lagg dhcp on specified wifi
-enable_lagg_dhcp()
-{
- WIFINIC="$1"
-
- # Get the first wired nic
- get_first_wired_nic
- WIRENIC=$VAL
- LAGGPORT="laggport ${WIFINIC}"
-
- echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf
- if [ ! -z "$WIRENIC" ]
- then
- echo "ifconfig_${WIRENIC}=\"up\"" >> ${FSMNT}/etc/rc.conf
- echo "ifconfig_${WIFINIC}=\"\`ifconfig ${WIRENIC} ether\`\"" >> ${FSMNT}/etc/rc.conf
- echo "ifconfig_${WIFINIC}=\"ether \${ifconfig_${WIFINIC}##*ether }\"" >> ${FSMNT}/etc/rc.conf
- LAGGPORT="laggport ${WIRENIC} ${LAGGPORT}"
- fi
-
- echo "wlans_${WIFINIC}=\"wlan0\"" >> ${FSMNT}/etc/rc.conf
- echo "cloned_interfaces=\"lagg0\"" >> ${FSMNT}/etc/rc.conf
- echo "ifconfig_lagg0=\"laggproto failover ${LAGGPORT} DHCP\"" >> ${FSMNT}/etc/rc.conf
-
-};
-
-# Function which detects available nics, and runs them to DHCP on the
-save_auto_dhcp()
-{
- rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null
- # start by getting a list of nics on this system
- ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
- if [ -e "${TMPDIR}/.niclist" ]
- then
- while read line
- do
- NIC="`echo $line | cut -d ':' -f 1`"
- DESC="`echo $line | cut -d ':' -f 2`"
- check_is_wifi "${NIC}"
- if [ "$?" = "0" ]
- then
- # We have a wifi device, lets do fancy lagg interface
- enable_lagg_dhcp "${NIC}"
- return
- fi
-
- done < ${TMPDIR}/.niclist
- fi
-
- # Got here, looks like no wifi, so lets simply enable plain-ole-dhcp
- enable_plain_dhcp_all
-
-};
-
-
-# Function which saves a manual nic setup to the installed system
-save_manual_nic()
-{
- # Get the target nic
- NIC="$1"
-
- get_value_from_cfg netSaveIP
- NETIP="${VAL}"
-
- if [ "$NETIP" = "DHCP" ]
- then
- echo_log "Setting $NIC to DHCP on the system."
- echo "ifconfig_${NIC}=\"DHCP\"" >>${FSMNT}/etc/rc.conf
- return 0
- fi
-
- # If we get here, we have a manual setup, lets do so now
-
- # Set the manual IP
- IFARGS="inet ${NETIP}"
-
- # Check if we have a netmask to set
- get_value_from_cfg netSaveMask
- NETMASK="${VAL}"
- if [ ! -z "${NETMASK}" ]
- then
- IFARGS="${IFARGS} netmask ${NETMASK}"
- fi
-
-
- echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf
- echo "ifconfig_${NIC}=\"${IFARGS}\"" >>${FSMNT}/etc/rc.conf
-
- # Check if we have a default router to set
- get_value_from_cfg netSaveDefaultRouter
- NETROUTE="${VAL}"
- if [ ! -z "${NETROUTE}" ]
- then
- echo "defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf
- fi
-
- # Check if we have a nameserver to enable
- get_value_from_cfg netSaveNameServer
- NAMESERVER="${VAL}"
- if [ ! -z "${NAMESERVER}" ]
- then
- echo "nameserver ${NAMESERVER}" >${FSMNT}/etc/resolv.conf
- fi
-
-};
-
-# Function which determines if a nic is active / up
-is_nic_active()
-{
- ifconfig ${1} | grep "status: active" >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- return 0
- else
- return 1
- fi
-};
-
-
-# Function which detects available nics, and runs DHCP on them until
-# a success is found
-enable_auto_dhcp()
-{
- # start by getting a list of nics on this system
- ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
- while read line
- do
- NIC="`echo $line | cut -d ':' -f 1`"
- DESC="`echo $line | cut -d ':' -f 2`"
-
- is_nic_active "${NIC}"
- if [ "$?" = "0" ] ; then
- echo_log "Trying DHCP on $NIC $DESC"
- dhclient ${NIC} >/dev/null 2>/dev/null
- if [ "$?" = "0" ] ; then
- # Got a valid DHCP IP, we can return now
- WRKNIC="$NIC" ; export WRKNIC
- return 0
- fi
- fi
- done < ${TMPDIR}/.niclist
-
-};
-
-# Get the mac address of a target NIC
-get_nic_mac()
-{
- FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
- export FOUNDMAC
-}
-
-# Function which performs the manual setup of a target nic in the cfg
-enable_manual_nic()
-{
- # Get the target nic
- NIC="$1"
-
- # Check that this NIC exists
- rc_halt "ifconfig ${NIC}"
-
- get_value_from_cfg netIP
- NETIP="${VAL}"
-
- if [ "$NETIP" = "DHCP" ]
- then
- echo_log "Enabling DHCP on $NIC"
- rc_halt "dhclient ${NIC}"
- return 0
- fi
-
- # If we get here, we have a manual setup, lets do so now
-
- # Set the manual IP
- rc_halt "ifconfig ${NIC} ${NETIP}"
-
- # Check if we have a netmask to set
- get_value_from_cfg netMask
- NETMASK="${VAL}"
- if [ ! -z "${NETMASK}" ]
- then
- rc_halt "ifconfig ${NIC} netmask ${NETMASK}"
- fi
-
- # Check if we have a default router to set
- get_value_from_cfg netDefaultRouter
- NETROUTE="${VAL}"
- if [ ! -z "${NETROUTE}" ]
- then
- rc_halt "route add default ${NETROUTE}"
- fi
-
- # Check if we have a nameserver to enable
- get_value_from_cfg netNameServer
- NAMESERVER="${VAL}"
- if [ ! -z "${NAMESERVER}" ]
- then
- echo "nameserver ${NAMESERVER}" >/etc/resolv.conf
- fi
-
-
-};
-
-
-# Function which parses the cfg and enables networking per specified
-start_networking()
-{
- # Check if we have any networking requested
- get_value_from_cfg netDev
- if [ -z "${VAL}" ]
- then
- return 0
- fi
-
- NETDEV="${VAL}"
- if [ "$NETDEV" = "AUTO-DHCP" ]
- then
- enable_auto_dhcp
- else
- enable_manual_nic ${NETDEV}
- fi
-
-};
-
-
-# Function which checks the cfg and enables the specified networking on
-# the installed system
-save_networking_install()
-{
-
- # Check if we have any networking requested to save
- get_value_from_cfg netSaveDev
- if [ -z "${VAL}" ]
- then
- return 0
- fi
-
- NETDEV="${VAL}"
- if [ "$NETDEV" = "AUTO-DHCP" ]
- then
- save_auto_dhcp
- else
- save_manual_nic ${NETDEV}
- fi
-
-};
-
diff --git a/usr/sbin/pc-sysinstall/backend/functions-newfs.sh b/usr/sbin/pc-sysinstall/backend/functions-newfs.sh
deleted file mode 100755
index 5525d1c..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-newfs.sh
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-newfs.sh,v 1.6 2010/10/09 08:52:09 imp Exp $
-
-# Functions related to disk operations using newfs
-
-
-# Function which performs the ZFS magic
-setup_zfs_filesystem()
-{
- PART="$1"
- PARTFS="$2"
- PARTMNT="$3"
- EXT="$4"
- PARTGEOM="$5"
- ZPOOLOPTS="$6"
- ROOTSLICE="`echo ${PART} | rev | cut -b 2- | rev`"
- ZPOOLNAME=$(get_zpool_name "${PART}")
-
- # Sleep a few moments, let the disk catch its breath
- sleep 5
- sync
-
- # Check if we have some custom zpool arguments and use them if so
- if [ ! -z "${ZPOOLOPTS}" ] ; then
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS}"
- else
- # No zpool options, create pool on single device
- rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}"
- fi
-
- # Disable atime for this zfs partition, speed increase
- rc_nohalt "zfs set atime=off ${ZPOOLNAME}"
-
- # Check if we have multiple zfs mounts specified
- for i in `echo ${PARTMNT} | sed 's|,| |g'`
- do
- # Check if we ended up with needing a zfs bootable partition
- if [ "${i}" = "/" -o "${i}" = "/boot" ]
- then
- if [ "$HAVEBOOT" = "YES" ] ; then continue ; fi
- if [ "${PARTGEOM}" = "MBR" ]
- then
- # Lets stamp the proper ZFS boot loader
- echo_log "Setting up ZFS boot loader support"
- rc_halt "zpool set bootfs=${ZPOOLNAME} ${ZPOOLNAME}"
- rc_halt "zpool export ${ZPOOLNAME}"
- rc_halt "dd if=/boot/zfsboot of=/dev/${ROOTSLICE} count=1"
- rc_halt "dd if=/boot/zfsboot of=/dev/${PART}${EXT} skip=1 seek=1024"
- rc_halt "zpool import ${ZPOOLNAME}"
- fi
- fi
- done
-
-};
-
-# Runs newfs on all the partiions which we've setup with bsdlabel
-setup_filesystems()
-{
-
- # Create the keydir
- rm -rf ${GELIKEYDIR} >/dev/null 2>/dev/null
- mkdir ${GELIKEYDIR}
-
- # Lets go ahead and read through the saved partitions we created, and determine if we need to run
- # newfs on any of them
- for PART in `ls ${PARTDIR}`
- do
- if [ ! -e "/dev/${PART}" ]
- then
- exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
- fi
-
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
- PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
- PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d ':' -f 5`"
- PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 6`"
- PARTIMAGE="`cat ${PARTDIR}/${PART} | cut -d ':' -f 7`"
-
- # Make sure journaling isn't enabled on this device
- if [ -e "/dev/${PART}.journal" ]
- then
- rc_nohalt "gjournal stop -f ${PART}.journal"
- rc_nohalt "gjournal clear ${PART}"
- fi
-
- # Setup encryption if necessary
- if [ "${PARTENC}" = "ON" -a "${PARTFS}" != "SWAP" ]
- then
- echo_log "Creating geli provider for ${PART}"
- rc_halt "dd if=/dev/random of=${GELIKEYDIR}/${PART}.key bs=64 count=1"
- rc_halt "geli init -b -s 4096 -P -K ${GELIKEYDIR}/${PART}.key /dev/${PART}"
- rc_halt "geli attach -p -k ${GELIKEYDIR}/${PART}.key /dev/${PART}"
-
- EXT=".eli"
- else
- # No Encryption
- EXT=""
- fi
-
- case ${PARTFS} in
- UFS)
- echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- sleep 2
- rc_halt "newfs /dev/${PART}${EXT}"
- sleep 2
- rc_halt "sync"
- rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
- rc_halt "sync"
-
- # Set flag that we've found a boot partition
- if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
- HAVEBOOT="YES"
- fi
- sleep 2
- ;;
-
- UFS+S)
- echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- sleep 2
- rc_halt "newfs -U /dev/${PART}${EXT}"
- sleep 2
- rc_halt "sync"
- rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
- rc_halt "sync"
- # Set flag that we've found a boot partition
- if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
- HAVEBOOT="YES"
- fi
- sleep 2
- ;;
-
- UFS+SUJ)
- echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- sleep 2
- rc_halt "newfs -U /dev/${PART}${EXT}"
- sleep 2
- rc_halt "sync"
- rc_halt "tunefs -j enable /dev/${PART}${EXT}"
- sleep 2
- rc_halt "sync"
- rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
- rc_halt "sync"
- # Set flag that we've found a boot partition
- if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
- HAVEBOOT="YES"
- fi
- sleep 2
- ;;
-
-
- UFS+J)
- echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- sleep 2
- rc_halt "newfs /dev/${PART}${EXT}"
- sleep 2
- rc_halt "gjournal label -f /dev/${PART}${EXT}"
- sleep 2
- rc_halt "newfs -O 2 -J /dev/${PART}${EXT}.journal"
- sleep 2
- rc_halt "sync"
- rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal"
- rc_halt "sync"
- # Set flag that we've found a boot partition
- if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
- HAVEBOOT="YES"
- fi
- sleep 2
- ;;
-
- ZFS)
- echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
- setup_zfs_filesystem "${PART}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}" "${PARTXTRAOPTS}"
- ;;
-
- SWAP)
- rc_halt "sync"
- rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
- rc_halt "sync"
- sleep 2
- ;;
-
- IMAGE)
- write_image "${PARTIMAGE}" "${PART}"
- sleep 2
- ;;
-
- *) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
- esac
-
- done
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-packages.sh b/usr/sbin/pc-sysinstall/backend/functions-packages.sh
deleted file mode 100755
index ac5e213..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-packages.sh
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-packages.sh,v 1.6 2010/09/08 20:10:24 imp Exp $
-
-# Functions which runs commands on the system
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-. ${BACKEND}/functions-ftp.sh
-
-
-get_package_index_by_ftp()
-{
- local INDEX_FILE
- local FTP_SERVER
-
- FTP_SERVER="${1}"
- INDEX_FILE="INDEX"
- USE_BZIP2=0
-
- if [ -f "/usr/bin/bzip2" ]
- then
- INDEX_FILE="${INDEX_FILE}.bz2"
- USE_BZIP2=1
- fi
-
- INDEX_PATH="${CONFDIR}/${INDEX_FILE}"
- fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1"
- if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ]
- then
- bzip2 -d "${INDEX_PATH}"
- fi
-};
-
-get_package_index_by_fs()
-{
- local INDEX_FILE
-
- INDEX_FILE="${CDMNT}/packages/INDEX"
- fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0"
-};
-
-get_package_index_size()
-{
- if [ -f "${CONFDIR}/INDEX" ]
- then
- SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'`
- else
- get_ftp_mirror
- FTPHOST="${VAL}"
-
- FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
- FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
-
- fetch -s "${FTPPATH}/INDEX.bz2"
- fi
-};
-
-get_package_index()
-{
- RES=0
-
- if [ -z "${INSTALLMODE}" ]
- then
- get_ftp_mirror
- FTPHOST="${VAL}"
-
- FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
- FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
-
- get_package_index_by_ftp "${FTPPATH}"
-
- else
- get_value_from_cfg ftpHost
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
- fi
-
- FTPHOST="${VAL}"
-
- get_value_from_cfg ftpDir
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
- fi
-
- FTPDIR="${VAL}"
- FTPPATH="ftp://${FTPHOST}${FTPDIR}"
-
- case "${INSTALLMEDIUM}" in
- usb|dvd) get_package_index_by_fs ;;
- ftp) get_package_index_by_ftp "${FTPPATH}" ;;
- sftp) ;;
- *) RES=1 ;;
- esac
-
- fi
-
- return ${RES}
-};
-
-parse_package_index()
-{
- INDEX_FILE="${PKGDIR}/INDEX"
-
- exec 3<&0
- exec 0<"${INDEX_FILE}"
-
- while read -r line
- do
- PKGNAME=""
- CATEGORY=""
- PACKAGE=""
- DESC=""
- DEPS=""
- i=0
-
- SAVE_IFS="${IFS}"
- IFS="|"
-
- for part in ${line}
- do
- if [ "${i}" -eq "0" ]
- then
- PKGNAME="${part}"
-
- elif [ "${i}" -eq "1" ]
- then
- PACKAGE=`basename "${part}"`
-
- elif [ "${i}" -eq "3" ]
- then
- DESC="${part}"
-
- elif [ "${i}" -eq "6" ]
- then
- CATEGORY=`echo "${part}" | cut -f1 -d' '`
-
- elif [ "${i}" -eq "8" ]
- then
- DEPS="${part}"
- fi
-
- i=$((i+1))
- done
-
- echo "${CATEGORY}|${PACKAGE}|${DESC}" >> "${INDEX_FILE}.parsed"
- echo "${PACKAGE}|${PKGNAME}|${DEPS}" >> "${INDEX_FILE}.deps"
-
- IFS="${SAVE_IFS}"
- done
-
- exec 0<&3
-};
-
-show_package_file()
-{
- PKGFILE="${1}"
-
- echo "Available Packages:"
-
- exec 3<&0
- exec 0<"${PKGFILE}"
-
- while read -r line
- do
- CATEGORY=`echo "${line}" | cut -f1 -d'|'`
- PACKAGE=`echo "${line}" | cut -f2 -d'|'`
- DESC=`echo "${line}" | cut -f3 -d'|'`
-
- echo "${CATEGORY}/${PACKAGE}:${DESC}"
- done
-
- exec 0<&3
-};
-
-show_packages_by_category()
-{
- CATEGORY="${1}"
- INDEX_FILE="${PKGDIR}/INDEX.parsed"
- TMPFILE="/tmp/.pkg.cat"
-
- grep "^${CATEGORY}|" "${INDEX_FILE}" > "${TMPFILE}"
- show_package_file "${TMPFILE}"
- rm "${TMPFILE}"
-};
-
-show_package_by_name()
-{
- CATEGORY="${1}"
- PACKAGE="${2}"
- INDEX_FILE="${PKGDIR}/INDEX.parsed"
- TMPFILE="/tmp/.pkg.cat.pak"
-
- grep "^${CATEGORY}|${PACKAGE}" "${INDEX_FILE}" > "${TMPFILE}"
- show_package_file "${TMPFILE}"
- rm "${TMPFILE}"
-};
-
-show_packages()
-{
- show_package_file "${PKGDIR}/INDEX.parsed"
-};
-
-get_package_dependencies()
-{
- PACKAGE="${1}"
- LONG="${2:-0}"
- RES=0
-
- INDEX_FILE="${PKGDIR}/INDEX.deps"
- REGEX="^${PACKAGE}|"
-
- if [ "${LONG}" -ne "0" ]
- then
- REGEX="^.*|${PACKAGE}|"
- fi
-
- LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
- DEPS=`echo "${LINE}"|cut -f3 -d'|'`
-
- VAL="${DEPS}"
- export VAL
-
- if [ -z "${VAL}" ]
- then
- RES=1
- fi
-
- return ${RES}
-};
-
-get_package_name()
-{
- PACKAGE="${1}"
- RES=0
-
- INDEX_FILE="${PKGDIR}/INDEX.deps"
- REGEX="^${PACKAGE}|"
-
- LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
- NAME=`echo "${LINE}"|cut -f2 -d'|'`
-
- VAL="${NAME}"
- export VAL
-
- if [ -z "${VAL}" ]
- then
- RES=1
- fi
-
- return ${RES}
-};
-
-get_package_short_name()
-{
- PACKAGE="${1}"
- RES=0
-
- INDEX_FILE="${PKGDIR}/INDEX.deps"
- REGEX="^.*|${PACKAGE}|"
-
- LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
- NAME=`echo "${LINE}"|cut -f1 -d'|'`
-
- VAL="${NAME}"
- export VAL
-
- if [ -z "${VAL}" ]
- then
- RES=1
- fi
-
- return ${RES}
-};
-
-get_package_category()
-{
- PACKAGE="${1}"
- INDEX_FILE="${PKGDIR}/INDEX.parsed"
- RES=0
-
- LINE=`grep "|${PACKAGE}|" "${INDEX_FILE}" 2>/dev/null`
- NAME=`echo "${LINE}"|cut -f1 -d'|'`
-
- VAL="${NAME}"
- export VAL
-
- if [ -z "${VAL}" ]
- then
- RES=1
- fi
-
- return ${RES}
-};
-
-fetch_package_by_ftp()
-{
- CATEGORY="${1}"
- PACKAGE="${2}"
- SAVEDIR="${3}"
-
- get_value_from_cfg ftpHost
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
- fi
- FTPHOST="${VAL}"
-
- get_value_from_cfg ftpDir
- if [ -z "$VAL" ]
- then
- exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
- fi
- FTPDIR="${VAL}"
-
- PACKAGE="${PACKAGE}.tbz"
- FTP_SERVER="ftp://${FTPHOST}${FTPDIR}"
-
- if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
- then
- PKGPATH="${CATEGORY}/${PACKAGE}"
- FTP_PATH="${FTP_HOST}/packages/${PKGPATH}"
- fetch_file "${FTP_PATH}" "${SAVEDIR}/" "0"
- fi
-};
-
-fetch_package_by_fs()
-{
- CATEGORY="${1}"
- PACKAGE="${2}"
- SAVEDIR="${3}"
-
- PACKAGE="${PACKAGE}.tbz"
- if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
- then
- fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0"
- fi
-};
-
-fetch_package()
-{
- CATEGORY="${1}"
- PACKAGE="${2}"
- SAVEDIR="${3}"
-
- case "${INSTALLMEDIUM}" in
- usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
- ftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
- sftp) ;;
- esac
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-parse.sh b/usr/sbin/pc-sysinstall/backend/functions-parse.sh
deleted file mode 100755
index d8e5723..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-parse.sh
+++ /dev/null
@@ -1,232 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-parse.sh,v 1.4 2010/09/08 20:10:24 imp Exp $
-
-# functions.sh
-# Library of functions which pc-sysinstall may call upon for parsing the config
-
-# which gets the value of a setting in the provided line
-get_value_from_string()
-{
- if [ ! -z "${1}" ]
- then
- VAL="`echo ${1} | cut -d '=' -f 2`"
- export VAL
- else
- echo "Error: Did we forgot to supply a string to parse?"
- exit 1
- fi
-};
-
-# Get the value from the cfg file including spaces
-get_value_from_cfg_with_spaces()
-{
- if [ ! -z "${1}" ]
- then
- VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2`
- export VAL
- else
- exit_err "Error: Did we forgot to supply a setting to grab?"
- fi
-};
-
-
-# Get the value from the cfg file
-get_value_from_cfg()
-{
- if [ ! -z "${1}" ]
- then
- VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
- export VAL
- else
- exit_err "Error: Did we forgot to supply a setting to grab?"
- fi
-};
-
-# Checks the value of a setting in the provided line with supplied possibilities
-# 1 = setting we are checking, 2 = list of valid values
-if_check_value_exists()
-{
- if [ ! -z "${1}" -a ! -z "${2}" ]
- then
- # Get the first occurance of the setting from the config, strip out whitespace
-
- VAL=`grep "^${1}" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
- if [ -z "${VAL}" ]
- then
- # This value doesn't exist, lets return
- return 0
- fi
-
-
- VALID="1"
- for i in ${2}
- do
- VAL=`echo "$VAL"|tr A-Z a-z`
- if [ "$VAL" = "${i}" ]
- then
- VALID="0"
- fi
- done
- if [ "$VALID" = "1" ]
- then
- exit_err "Error: ${1} is set to unknown value $VAL"
- fi
- else
- exit_err "Error: Did we forgot to supply a string to parse and setting to grab?"
- fi
-};
-
-# Checks the value of a setting in the provided line with supplied possibilities
-# 1 = setting we are checking, 2 = list of valid values
-check_value()
-{
- if [ ! -z "${1}" -a ! -z "${2}" ]
- then
- # Get the first occurance of the setting from the config, strip out whitespace
- VAL=`grep "^${1}" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
- VALID="1"
- for i in ${2}
- do
- if [ "$VAL" = "${i}" ]
- then
- VALID="0"
- fi
- done
- if [ "$VALID" = "1" ]
- then
- exit_err "Error: ${1} is set to unknown value $VAL"
- fi
- else
- exit_err "Error: Did we forgot to supply a string to parse and setting to grab?"
- fi
-};
-
-# Checks for the presense of the supplied arguements in the config file
-# 1 = values to confirm exist
-file_sanity_check()
-{
- if [ ! -z "$CFGF" -a ! -z "$1" ]
- then
- for i in $1
- do
- grep "^${i}=" $CFGF >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- LN=`grep "^${i}=" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
- if [ -z "${LN}" ]
- then
- echo "Error: Config fails sanity test! ${i}= is empty"
- exit 1
- fi
- else
- echo "Error: Config fails sanity test! Missing ${i}="
- exit 1
- fi
- done
- else
- echo "Error: Missing config file, and / or values to sanity check for!"
- exit 1
- fi
-};
-
-
-# Function which merges the contents of a new config into the specified old one
-# Only works with <val>= type configurations
-merge_config()
-{
- OLDCFG="${1}"
- NEWCFG="${2}"
- FINALCFG="${3}"
-
- # Copy our oldcfg to the new one, which will be used as basis
- cp ${OLDCFG} ${FINALCFG}
-
- # Remove blank lines from new file
- cat ${NEWCFG} | sed '/^$/d' > ${FINALCFG}.tmp
-
- # Set our marker if we've found any
- FOUNDMERGE="NO"
-
- while read newline
- do
- echo ${newline} | grep "^#" >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then
- VAL="`echo ${newline} | cut -d '=' -f 1`"
- cat ${OLDCFG} | grep ${VAL} >/dev/null 2>/dev/null
- if [ "$?" != "0" ] ; then
- if [ "${FOUNDMERGE}" = "NO" ] ; then
- echo "" >> ${FINALCFG}
- echo "# Auto-merged values from newer ${NEWCFG}" >> ${FINALCFG}
- FOUNDMERGE="YES"
- fi
- echo "${newline}" >> ${FINALCFG}
- fi
- fi
- done < ${FINALCFG}.tmp
- rm ${FINALCFG}.tmp
-
-};
-
-# Loop to check for a specified mount-point in a list
-check_for_mount()
-{
- MNTS="${1}"
- FINDMNT="${2}"
-
- # Check if we found a valid root partition
- for CHECKMNT in `echo ${MNTS} | sed 's|,| |g'`
- do
- if [ "${CHECKMNT}" = "${FINDMNT}" ] ; then
- return 0
- fi
- done
-
- return 1
-};
-
-# Function which returns the next line in the specified config file
-get_next_cfg_line()
-{
- CURFILE="$1"
- CURLINE="$2"
-
- FOUND="1"
-
- while read line
- do
- if [ "$FOUND" = "0" ] ; then
- VAL="$line" ; export VAL
- return
- fi
- if [ "$line" = "${CURLINE}" ] ; then
- FOUND="0"
- fi
- done <${CURFILE}
-
- # Got here, couldn't find this line or at end of file, set VAL to ""
- VAL="" ; export VAL
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-runcommands.sh b/usr/sbin/pc-sysinstall/backend/functions-runcommands.sh
deleted file mode 100755
index 29e3606..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-runcommands.sh
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-runcommands.sh,v 1.3 2010/08/19 05:59:27 imp Exp $
-
-# Functions which runs commands on the system
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-run_chroot_cmd()
-{
- CMD="$@"
- echo_log "Running chroot command: ${CMD}"
- echo "$CMD" >${FSMNT}/.runcmd.sh
- chmod 755 ${FSMNT}/.runcmd.sh
- chroot ${FSMNT} sh /.runcmd.sh
- RES=$?
-
- rm ${FSMNT}/.runcmd.sh
- return ${RES}
-};
-
-run_chroot_script()
-{
- SCRIPT="$@"
- SBASE=`basename $SCRIPT`
-
- cp ${SCRIPT} ${FSMNT}/.$SBASE
- chmod 755 ${FSMNT}/.${SBASE}
-
- echo_log "Running chroot script: ${SCRIPT}"
- chroot ${FSMNT} /.${SBASE}
- RES=$?
-
- rm ${FSMNT}/.${SBASE}
- return ${RES}
-};
-
-
-run_ext_cmd()
-{
- CMD="$@"
- # Make sure to export FSMNT, in case cmd needs it
- export FSMNT
- echo_log "Running external command: ${CMD}"
- echo "${CMD}"> ${TMPDIR}/.runcmd.sh
- chmod 755 ${TMPDIR}/.runcmd.sh
- sh ${TMPDIR}/.runcmd.sh
- RES=$?
-
- rm ${TMPDIR}/.runcmd.sh
- return ${RES}
-};
-
-
-# Starts the user setup
-run_commands()
-{
- while read line
- do
- # Check if we need to run any chroot command
- echo $line | grep ^runCommand= >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "$line"
- run_chroot_cmd "$VAL"
- fi
-
- # Check if we need to run any chroot script
- echo $line | grep ^runScript= >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "$line"
- run_chroot_script "$VAL"
- fi
-
- # Check if we need to run any chroot command
- echo $line | grep ^runExtCommand= >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "$line"
- run_ext_cmd "$VAL"
- fi
-
- done <${CFGF}
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-unmount.sh b/usr/sbin/pc-sysinstall/backend/functions-unmount.sh
deleted file mode 100755
index 367cb27..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-unmount.sh
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-unmount.sh,v 1.4 2010/10/09 07:45:24 imp Exp $
-
-# Functions which unmount all mounted disk filesystems
-
-# Unmount all mounted partitions under specified dir
-umount_all_dir()
-{
- _udir="$1"
- _umntdirs=`mount | sort -r | grep "on $_udir" | cut -d ' ' -f 3`
- for _ud in $_umntdirs
- do
- umount -f ${_ud}
- done
-}
-
-# Script that adds our gmirror devices for syncing
-start_gmirror_sync()
-{
-
- cd ${MIRRORCFGDIR}
- for DISK in `ls *`
- do
- MIRRORDISK="`cat ${DISK} | cut -d ':' -f 1`"
- MIRRORBAL="`cat ${DISK} | cut -d ':' -f 2`"
- MIRRORNAME="`cat ${DISK} | cut -d ':' -f 3`"
-
- # Start the mirroring service
- rc_halt "gmirror insert ${MIRRORNAME} /dev/${MIRRORDISK}"
-
- done
-
-};
-
-# Unmounts all our mounted file-systems
-unmount_all_filesystems()
-{
- # Copy the logfile to disk before we unmount
- cp ${LOGOUT} ${FSMNT}/root/pc-sysinstall.log
- cd /
-
- # Start by unmounting any ZFS partitions
- zfs_cleanup_unmount
-
- # Lets read our partition list, and unmount each
- ##################################################################
- for PART in `ls ${PARTDIR}`
- do
-
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
- PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
-
- if [ "${PARTENC}" = "ON" ]
- then
- EXT=".eli"
- else
- EXT=""
- fi
-
- #if [ "${PARTFS}" = "SWAP" ]
- #then
- # rc_nohalt "swapoff /dev/${PART}${EXT}"
- #fi
-
- # Check if we've found "/", and unmount that last
- if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
- then
- #rc_halt "umount -f /dev/${PART}${EXT}"
-
- # Re-check if we are missing a label for this device and create it again if so
- if [ ! -e "/dev/label/${PARTLABEL}" ]
- then
- case ${PARTFS} in
- UFS) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
- UFS+S) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
- UFS+SUJ) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
- UFS+J) glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal ;;
- *) ;;
- esac
- fi
- fi
-
- # Check if we've found "/" and make sure the label exists
- if [ "$PARTMNT" = "/" -a "${PARTFS}" != "ZFS" ]
- then
- if [ ! -e "/dev/label/${PARTLABEL}" ]
- then
- case ${PARTFS} in
- UFS) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
- UFS+S) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
- UFS+SUJ) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
- UFS+J) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal" ;;
- *) ;;
- esac
- fi
- fi
- done
-
- # Last lets the /mnt partition
- #########################################################
- #rc_nohalt "umount -f ${FSMNT}"
-
- # If are using a ZFS on "/" set it to legacy
- if [ ! -z "${FOUNDZFSROOT}" ]
- then
- rc_halt "zfs set mountpoint=legacy ${FOUNDZFSROOT}"
- fi
-
- # If we need to relabel "/" do it now
- if [ ! -z "${ROOTRELABEL}" ]
- then
- ${ROOTRELABEL}
- fi
-
- # Unmount our CDMNT
- #rc_nohalt "umount -f ${CDMNT}" >/dev/null 2>/dev/null
-
- # Check if we need to run any gmirror syncing
- ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Lets start syncing now
- start_gmirror_sync
- fi
-
-};
-
-# Unmounts any filesystems after a failure
-unmount_all_filesystems_failure()
-{
- cd /
-
- # if we did a fresh install, start unmounting
- if [ "${INSTALLMODE}" = "fresh" ]
- then
-
- # Lets read our partition list, and unmount each
- ##################################################################
- if [ -d "${PARTDIR}" ]
- then
- for PART in `ls ${PARTDIR}`
- do
-
- PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
- PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
- PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
-
- #if [ "${PARTFS}" = "SWAP" ]
- #then
- # if [ "${PARTENC}" = "ON" ]
- # then
- # rc_nohalt "swapoff /dev/${PART}.eli"
- # else
- # rc_nohalt "swapoff /dev/${PART}"
- # fi
- #fi
-
- # Check if we've found "/" again, don't need to mount it twice
- if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
- then
- #rc_nohalt "umount -f /dev/${PART}"
- #rc_nohalt "umount -f ${FSMNT}${PARTMNT}"
- fi
- done
-
- # Last lets the /mnt partition
- #########################################################
- #rc_nohalt "umount -f ${FSMNT}"
-
- fi
- else
- # We are doing a upgrade, try unmounting any of these filesystems
- chroot ${FSMNT} /sbin/umount -a >>${LOGOUT} >>${LOGOUT}
- umount -f ${FSMNT}/usr >>${LOGOUT} 2>>${LOGOUT}
- umount -f ${FSMNT}/dev >>${LOGOUT} 2>>${LOGOUT}
- umount -f ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
- rc_nohalt "sh ${TMPDIR}/.upgrade-unmount"
- fi
-
- # Unmount our CDMNT
- #rc_nohalt "umount ${CDMNT}"
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-upgrade.sh b/usr/sbin/pc-sysinstall/backend/functions-upgrade.sh
deleted file mode 100755
index 0b06630..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-upgrade.sh
+++ /dev/null
@@ -1,247 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which perform the mounting / unmount for upgrades
-
-. ${PROGDIR}/backend/functions-unmount.sh
-
-mount_target_slice()
-{
- MPART="${1}"
-
- # Import any zpools
- zpool import -o altroot=${FSMNT} -a
- umount_all_dir "${FSMNT}"
-
- # Set a variable of files we want to make backups of before doing upgrade
- BKFILES="/etc/rc.conf /boot/loader.conf"
-
- if [ -e "/dev/${MPART}" ] ; then
- rc_nohalt "mount /dev/${MPART} ${FSMNT}"
- if [ "$?" != "0" ] ; then
- # Check if we have ZFS tank name
- rc_halt "mount -t zfs ${MPART} ${FSMNT}"
- fi
- else
- # Check if we have ZFS tank name
- rc_halt "mount -t zfs ${MPART} ${FSMNT}"
- fi
-
- # Mount devfs in chroot
- mount -t devfs devfs ${FSMNT}/dev
-
- # Check if we have any ZFS partitions to mount
- zfs mount -a
-
- # Mount all the fstab goodies on disk
- chroot ${FSMNT} /sbin/mount -a >>${LOGOUT} 2>>${LOGOUT}
- chroot ${FSMNT} umount /proc >/dev/null 2>/dev/null
- chroot ${FSMNT} umount /compat/linux/proc >/dev/null 2>/dev/null
-
- # Now before we start the upgrade, make sure we set our noschg flags
- echo_log "Cleaning up old filesystem... Please wait..."
- rc_halt "chflags -R noschg ${FSMNT}"
-
- # Make backup copies of some files
- for i in ${BKFILES}
- do
- cp ${FSMNT}${i} ${FSMNT}${i}.preUpgrade >/dev/null 2>/dev/null
- done
-
- # Remove some old dirs
- rm -rf ${FSMNT}/etc/rc.d >/dev/null 2>/dev/null
-
- # If we are doing PC-BSD install, lets cleanup old pkgs on disk
- if [ "$INSTALLTYPE" != "FreeBSD" ]
- then
- echo_log "Removing old packages, this may take a while... Please wait..."
- echo '#/bin/sh
-for i in `pkg_info -E \*`
-do
- echo "Uninstalling package: ${i}"
- pkg_delete -f ${i} >/dev/null 2>/dev/null
-done
-' >${FSMNT}/.cleanPkgs.sh
- chmod 755 ${FSMNT}/.cleanPkgs.sh
- chroot ${FSMNT} /.cleanPkgs.sh
- rm ${FSMNT}/.cleanPkgs.sh
- run_chroot_cmd "pkg_delete -f \*" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /usr/PCBSD" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /PCBSD" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /var/db/pkgs" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /usr/local32" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /usr/sbin" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /usr/lib" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /usr/bin" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /boot/kernel" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /sbin" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /bin" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /lib" >/dev/null 2>/dev/null
- run_chroot_cmd "rm -rf /libexec" >/dev/null 2>/dev/null
- fi
-
-};
-
-# Mount the target upgrade partitions
-mount_upgrade()
-{
-
- # Make sure we remove the old upgrade-mount script
- rm -rf ${TMPDIR}/.upgrade-unmount >/dev/null 2>/dev/null
-
- # We are ready to start mounting, lets read the config and do it
- while read line
- do
- echo $line | grep "^disk0=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
-
- # Found a disk= entry, lets get the disk we are working on
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- DISK="$VAL"
- fi
-
- echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found our flag to commit this disk setup / lets do sanity check and do it
- if [ ! -z "${DISK}" ]
- then
-
- # Start mounting this slice
- mount_target_slice "${DISK}"
-
- # Increment our disk counter to look for next disk and unset
- unset DISK
- break
- else
- exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!"
- fi
- fi
-
- done <${CFGF}
-
-};
-
-copy_skel_files_upgrade()
-{
-
- # Now make sure we fix any user profile scripts, which cause problems from 7.x->8.x
- echo '#!/bin/sh
-
-cd /home
-for i in `ls`
-do
-
- # Backup the old profile dirs
- if [ -d "${i}" ]
- then
- mv /home/${i}/.kde4 /home/${i}/.kde4.preUpgrade >/dev/null 2>/dev/null
- mv /home/${i}/.kde /home/${i}/.kde.preUpgrade >/dev/null 2>/dev/null
- mv /home/${i}/.fluxbox /home/${i}/.fluxbox.preUpgrade >/dev/null 2>/dev/null
-
- # Copy over the skel directories
- tar cv --exclude "./dot.*" -f - -C /usr/share/skel . 2>/dev/null | tar xvf - -C /home/${i} 2>/dev/null
-
- for j in `ls /usr/share/skel/dot*`
- do
- dname=`echo ${j} | sed s/dot//`
- cp /usr/share/skel/${j} /home/${i}/${dname}
- done
-
- chown -R ${i}:${i} /home/${i}
- fi
-
-done
-' >${FSMNT}/.fixUserProfile.sh
- chmod 755 ${FSMNT}/.fixUserProfile.sh
- chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
- rm ${FSMNT}/.fixUserProfile.sh
-
-
-
- # if the user wants to keep their original .kde4 profile
- ###########################################################################
- get_value_from_cfg "upgradeKeepDesktopProfile"
- if [ "$VAL" = "YES" -o "$VAL" = "yes" ] ; then
- echo '#!/bin/sh
- cd /home
-for i in `ls`
-do
- # Import the old config again
- if [ -d "${i}/.kde4.preUpgrade" ]
- then
- # Copy over the skel directories
- tar cv -f - -C /home/${i}/.kde4.preUpgrade . 2>/dev/null | tar xvf - -C /home/${i}/.kde4 2>/dev/null
- chown -R ${i}:${i} /home/${i}/.kde4
- fi
-done
-' >${FSMNT}/.fixUserProfile.sh
- chmod 755 ${FSMNT}/.fixUserProfile.sh
- chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
- rm ${FSMNT}/.fixUserProfile.sh
-
- fi
-
-};
-
-# Function which merges some configuration files with the new defaults
-merge_old_configs()
-{
-
- # Merge the loader.conf with old
- cp ${FSMNT}/boot/loader.conf ${FSMNT}/boot/loader.conf.new
- merge_config "${FSMNT}/boot/loader.conf.preUpgrade" "${FSMNT}/boot/loader.conf.new" "${FSMNT}/boot/loader.conf"
- rm ${FSMNT}/boot/loader.conf.new
-
- # Merge the rc.conf with old
- cp ${FSMNT}/etc/rc.conf ${FSMNT}/etc/rc.conf.new
- merge_config "${FSMNT}/etc/rc.conf.preUpgrade" "${FSMNT}/etc/rc.conf.new" "${FSMNT}/etc/rc.conf"
- rm ${FSMNT}/etc/rc.conf.new
-
-};
-
-# Function which unmounts all the mounted file-systems
-unmount_upgrade()
-{
-
- # If on PC-BSD, make sure we copy any fixed skel files
- if [ "$INSTALLTYPE" != "FreeBSD" ] ; then
- copy_skel_files_upgrade
- fi
-
- cd /
-
- # Unmount FS
- umount_all_dir "${FSMNT}"
-
- # Run our saved unmount script for these file-systems
- rc_nohalt "umount -f ${FSMNT}"
-
- umount ${CDMNT}
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions-users.sh b/usr/sbin/pc-sysinstall/backend/functions-users.sh
deleted file mode 100755
index be786a1..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions-users.sh
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions-users.sh,v 1.3 2010/08/24 06:11:46 imp Exp $
-
-# Functions which runs commands on the system
-
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-parse.sh
-
-
-# Function which checks and sets up auto-login for a user if specified
-check_autologin()
-{
- get_value_from_cfg autoLoginUser
- if [ ! -z "${VAL}" -a "${INSTALLTYPE}" = "PCBSD" ]
- then
- AUTOU="${VAL}"
- # Add the auto-login user line
- sed -i.bak "s/AutoLoginUser=/AutoLoginUser=${AUTOU}/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
-
- # Add the auto-login user line
- sed -i.bak "s/AutoLoginEnable=false/AutoLoginEnable=true/g" ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
-
- fi
-};
-
-# Function which actually runs the adduser command on the filesystem
-add_user()
-{
- ARGS="${1}"
-
- if [ -e "${FSMNT}/.tmpPass" ]
- then
- # Add a user with a supplied password
- run_chroot_cmd "cat /.tmpPass | pw useradd ${ARGS}"
- rc_halt "rm ${FSMNT}/.tmpPass"
- else
- # Add a user with no password
- run_chroot_cmd "cat /.tmpPass | pw useradd ${ARGS}"
- fi
-
-};
-
-# Function which reads in the config, and adds any users specified
-setup_users()
-{
-
- # We are ready to start setting up the users, lets read the config
- while read line
- do
-
- echo $line | grep "^userName=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- USERNAME="$VAL"
- fi
-
- echo $line | grep "^userComment=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- USERCOMMENT="$VAL"
- fi
-
- echo $line | grep "^userPass=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- USERPASS="$VAL"
- fi
-
- echo $line | grep "^userShell=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- strip_white_space "$VAL"
- USERSHELL="$VAL"
- fi
-
- echo $line | grep "^userHome=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- USERHOME="$VAL"
- fi
-
- echo $line | grep "^userGroups=" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- get_value_from_string "${line}"
- USERGROUPS="$VAL"
- fi
-
-
- echo $line | grep "^commitUser" >/dev/null 2>/dev/null
- if [ "$?" = "0" ]
- then
- # Found our flag to commit this user, lets check and do it
- if [ ! -z "${USERNAME}" ]
- then
-
- # Now add this user to the system, by building our args list
- ARGS="-n ${USERNAME}"
-
- if [ ! -z "${USERCOMMENT}" ]
- then
- ARGS="${ARGS} -c \"${USERCOMMENT}\""
- fi
-
- if [ ! -z "${USERPASS}" ]
- then
- ARGS="${ARGS} -h 0"
- echo "${USERPASS}" >${FSMNT}/.tmpPass
- else
- ARGS="${ARGS} -h -"
- rm ${FSMNT}/.tmpPass 2>/dev/null 2>/dev/null
- fi
-
- if [ ! -z "${USERSHELL}" ]
- then
- ARGS="${ARGS} -s \"${USERSHELL}\""
- else
- ARGS="${ARGS} -s \"/nonexistant\""
- fi
-
- if [ ! -z "${USERHOME}" ]
- then
- ARGS="${ARGS} -m -d \"${USERHOME}\""
- fi
-
- if [ ! -z "${USERGROUPS}" ]
- then
- ARGS="${ARGS} -G \"${USERGROUPS}\""
- fi
-
- add_user "${ARGS}"
-
- # Unset our vars before looking for any more users
- unset USERNAME USERCOMMENT USERPASS USERSHELL USERHOME USERGROUPS
- else
- exit_err "ERROR: commitUser was called without any userName= entry!!!"
- fi
- fi
-
- done <${CFGF}
-
-
- # Check if we need to enable a user to auto-login to the desktop
- check_autologin
-
-};
diff --git a/usr/sbin/pc-sysinstall/backend/functions.sh b/usr/sbin/pc-sysinstall/backend/functions.sh
deleted file mode 100755
index 5d52009..0000000
--- a/usr/sbin/pc-sysinstall/backend/functions.sh
+++ /dev/null
@@ -1,497 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/functions.sh,v 1.7 2010/10/21 22:33:50 imp Exp $
-
-# functions.sh
-# Library of functions which pc-sysinstall may call upon
-
-# Function which displays the help-index file
-display_help()
-{
- if [ -e "${PROGDIR}/doc/help-index" ]
- then
- cat ${PROGDIR}/doc/help-index
- else
- echo "Error: ${PROGDIR}/doc/help-index not found"
- exit 1
- fi
-};
-
-# Function which displays the help for a specified command
-display_command_help()
-{
- if [ -z "$1" ]
- then
- echo "Error: No command specified to display help for"
- exit 1
- fi
-
- if [ -e "${PROGDIR}/doc/help-${1}" ]
- then
- cat ${PROGDIR}/doc/help-${1}
- else
- echo "Error: ${PROGDIR}/doc/help-${1} not found"
- exit 1
- fi
-};
-
-# Function to convert bytes to megabytes
-convert_byte_to_megabyte()
-{
- if [ -z "${1}" ]
- then
- echo "Error: No bytes specified!"
- exit 1
- fi
-
- expr -e ${1} / 1048576
-};
-
-# Function to convert blocks to megabytes
-convert_blocks_to_megabyte()
-{
- if [ -z "${1}" ] ; then
- echo "Error: No blocks specified!"
- exit 1
- fi
-
- expr -e ${1} / 2048
-};
-
-# Takes $1 and strips the whitespace out of it, returns VAL
-strip_white_space()
-{
- if [ -z "${1}" ]
- then
- echo "Error: No value setup to strip whitespace from!"
-
- exit 1
- fi
-
- VAL=`echo "$1" | tr -d ' '`
- export VAL
-};
-
-# Displays an error message and exits with error 1
-exit_err()
-{
- # Echo the message for the users benefit
- echo "$1"
-
- # Save this error to the log file
- echo "${1}" >>$LOGOUT
-
- # Check if we need to unmount any file-systems after this failure
- unmount_all_filesystems_failure
-
- echo "For more details see log file: $LOGOUT"
-
- exit 1
-};
-
-# Run-command, don't halt if command exits with non-0
-rc_nohalt()
-{
- CMD="$1"
-
- if [ -z "${CMD}" ]
- then
- exit_err "Error: missing argument in rc_nohalt()"
- fi
-
- echo "Running: ${CMD}" >>${LOGOUT}
- ${CMD} >>${LOGOUT} 2>>${LOGOUT}
-
-};
-
-# Run-command, halt if command exits with non-0
-rc_halt()
-{
- CMD="$1"
-
- if [ -z "${CMD}" ]
- then
- exit_err "Error: missing argument in rc_halt()"
- fi
-
- echo "Running: ${CMD}" >>${LOGOUT}
- eval ${CMD} >>${LOGOUT} 2>>${LOGOUT}
- STATUS="$?"
- if [ "${STATUS}" != "0" ]
- then
- exit_err "Error ${STATUS}: ${CMD}"
- fi
-};
-
-# Run-command w/echo to screen, halt if command exits with non-0
-rc_halt_echo()
-{
- CMD="$1"
-
- if [ -z "${CMD}" ]
- then
- exit_err "Error: missing argument in rc_halt_echo()"
- fi
-
- echo "Running: ${CMD}" >>${LOGOUT}
- ${CMD} 2>&1 | tee -a ${LOGOUT}
- STATUS="$?"
- if [ "$STATUS" != "0" ]
- then
- exit_err "Error ${STATUS}: $CMD"
- fi
-
-};
-
-# Run-command w/echo, don't halt if command exits with non-0
-rc_nohalt_echo()
-{
- CMD="$1"
-
- if [ -z "${CMD}" ]
- then
- exit_err "Error: missing argument in rc_nohalt_echo()"
- fi
-
- echo "Running: ${CMD}" >>${LOGOUT}
- ${CMD} 2>&1 | tee -a ${LOGOUT}
-
-};
-
-# Echo to the screen and to the log
-echo_log()
-{
- STR="$1"
-
- if [ -z "${STR}" ]
- then
- exit_err "Error: missing argument in echo_log()"
- fi
-
- echo "${STR}" | tee -a ${LOGOUT}
-};
-
-# Make sure we have a numeric
-is_num()
-{
- expr $1 + 1 2>/dev/null
- return $?
-}
-
-# Function which uses "fetch" to download a file, and display a progress report
-fetch_file()
-{
-
- FETCHFILE="$1"
- FETCHOUTFILE="$2"
- EXITFAILED="$3"
-
- SIZEFILE="${TMPDIR}/.fetchSize"
- EXITFILE="${TMPDIR}/.fetchExit"
-
- rm ${SIZEFILE} 2>/dev/null >/dev/null
- rm ${FETCHOUTFILE} 2>/dev/null >/dev/null
-
- fetch -s "${FETCHFILE}" >${SIZEFILE}
- SIZE="`cat ${SIZEFILE}`"
- SIZE="`expr ${SIZE} / 1024`"
- echo "FETCH: ${FETCHFILE}"
- echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT}
-
- ( fetch -o ${FETCHOUTFILE} "${FETCHFILE}" >/dev/null 2>/dev/null ; echo "$?" > ${EXITFILE} ) &
- PID="$!"
- while
- z=1
- do
-
- if [ -e "${FETCHOUTFILE}" ]
- then
- DSIZE=`du -k ${FETCHOUTFILE} | tr -d '\t' | cut -d '/' -f 1`
- if [ $(is_num "$DSIZE") ] ; then
- if [ $SIZE -lt $DSIZE ] ; then DSIZE="$SIZE"; fi
- echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}"
- echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}" >>${LOGOUT}
- fi
- fi
-
- # Check if the download is finished
- ps -p ${PID} >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
- break;
- fi
-
- sleep 2
- done
-
- echo "FETCHDONE"
-
- EXIT="`cat ${EXITFILE}`"
- if [ "${EXIT}" != "0" -a "$EXITFAILED" = "1" ]
- then
- exit_err "Error: Failed to download ${FETCHFILE}"
- fi
-
- return $EXIT
-
-};
-
-# Function to return a the zpool name for this device
-get_zpool_name()
-{
- DEVICE="$1"
-
- # Set the base name we use for zpools
- BASENAME="tank"
-
- if [ ! -d "${TMPDIR}/.zpools" ] ; then
- mkdir -p ${TMPDIR}/.zpools
- fi
-
- if [ -e "${TMPDIR}/.zpools/${DEVICE}" ] ; then
- cat ${TMPDIR}/.zpools/${DEVICE}
- return 0
- else
- # Need to generate a zpool name for this device
- NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
- NEWNAME="${BASENAME}${NUM}"
- echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE}
- echo "${NEWNAME}"
- return
- fi
-};
-
-iscompressed()
-{
- local FILE
- local RES
-
- FILE="$1"
- RES=1
-
- if echo "${FILE}" | \
- grep -iE '\.(Z|lzo|lzw|lzma|gz|bz2|xz|zip)$' >/dev/null 2>&1
- then
- RES=0
- fi
-
- return ${RES}
-}
-
-get_compression_type()
-{
- local FILE
- local SUFFIX
-
- FILE="$1"
- SUFFIX=`echo "${FILE}" | sed -E 's|^(.+)\.(.+)$|\2|'`
-
- VAL=""
- SUFFIX=`echo "${SUFFIX}" | tr A-Z a-z`
- case "${SUFFIX}" in
- z) VAL="lzw" ;;
- lzo) VAL="lzo" ;;
- lzw) VAL="lzw" ;;
- lzma) VAL="lzma" ;;
- gz) VAL="gzip" ;;
- bz2) VAL="bzip2" ;;
- xz) VAL="xz" ;;
- zip) VAL="zip" ;;
- esac
-
- export VAL
-}
-
-write_image()
-{
- local DEVICE_FILE
-
- IMAGE_FILE="$1"
- DEVICE_FILE="$2"
-
- if [ -z "${IMAGE_FILE}" ]
- then
- exit_err "ERROR: Image file not specified!"
- fi
-
- if [ -z "${DEVICE_FILE}" ]
- then
- exit_err "ERROR: Device file not specified!"
- fi
-
- if [ ! -f "${IMAGE_FILE}" ]
- then
- exit_err "ERROR: '${IMAGE_FILE}' does not exist!"
- fi
-
- DEVICE_FILE="${DEVICE_FILE#/dev/}"
- DEVICE_FILE="/dev/${DEVICE_FILE}"
-
- if [ ! -c "${DEVICE_FILE}" ]
- then
- exit_err "ERROR: '${DEVICE_FILE}' is not a character device!"
- fi
-
- if iscompressed "${IMAGE_FILE}"
- then
- local COMPRESSION
-
- get_compression_type "${IMAGE_FILE}"
- COMPRESSION="${VAL}"
-
- case "${COMPRESSION}" in
- lzw)
- rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.Z}"
- ;;
-
- lzo)
- rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.lzo}"
- ;;
-
- lzma)
- rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.lzma}"
- ;;
-
- gzip)
- rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.gz}"
- ;;
-
- bzip2)
- rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.bz2}"
- ;;
-
- xz)
- rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.xz}"
- ;;
-
- zip)
- rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}"
- IMAGE_FILE="${IMAGE_FILE%.zip}"
- ;;
-
- *)
- exit_err "ERROR: ${COMPRESSION} compression is not supported"
- ;;
- esac
-
- else
- rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE}"
-
- fi
-};
-
-install_fresh()
-{
- # Lets start setting up the disk slices now
- setup_disk_slice
-
- if [ -z "${ROOTIMAGE}" ]
- then
-
- # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels
- setup_disk_label
-
- # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs
- # to setup the filesystems
- setup_filesystems
-
- # Lets mount the partitions now
- mount_all_filesystems
-
- # We are ready to begin extraction, lets start now
- init_extraction
-
- # Check if we have any optional modules to load
- install_components
-
- # Check if we have any packages to install
- install_packages
-
- # Do any localization in configuration
- run_localize
-
- # Save any networking config on the installed system
- save_networking_install
-
- # Now add any users
- setup_users
-
- # Now run any commands specified
- run_commands
-
- # Do any last cleanup / setup before unmounting
- run_final_cleanup
-
- # Unmount and finish up
- unmount_all_filesystems
- fi
-
- echo_log "Installation finished!"
-};
-
-install_image()
-{
- # We are ready to begin extraction, lets start now
- init_extraction
-
- echo_log "Installation finished!"
-};
-
-install_upgrade()
-{
- # We're going to do an upgrade, skip all the disk setup
- # and start by mounting the target drive/slices
- mount_upgrade
-
- # Start the extraction process
- init_extraction
-
- # Do any localization in configuration
- run_localize
-
- # ow run any commands specified
- run_commands
-
- # Merge any old configuration files
- merge_old_configs
-
- # Check if we have any optional modules to load
- install_components
-
- # Check if we have any packages to install
- install_packages
-
- # All finished, unmount the file-systems
- unmount_upgrade
-
- echo_log "Upgrade finished!"
-};
diff --git a/usr/sbin/pc-sysinstall/backend/installimage.sh b/usr/sbin/pc-sysinstall/backend/installimage.sh
deleted file mode 100644
index 3ef77dd..0000000
--- a/usr/sbin/pc-sysinstall/backend/installimage.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/installimage.sh,v 1.1 2010/09/09 03:33:07 imp Exp $
-
-# Source our functions scripts
-. ${BACKEND}/functions.sh
-
-IMAGE_FILE="${1}"
-DEVICE_FILE="${2}"
-
-write_image "${IMAGE_FILE}" "${DEVICE_FILE}"
diff --git a/usr/sbin/pc-sysinstall/backend/parseconfig.sh b/usr/sbin/pc-sysinstall/backend/parseconfig.sh
deleted file mode 100755
index 83c6042..0000000
--- a/usr/sbin/pc-sysinstall/backend/parseconfig.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/parseconfig.sh,v 1.6 2010/10/09 08:52:09 imp Exp $
-
-# Main install configuration parsing script
-#
-
-# Source our functions scripts
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-bsdlabel.sh
-. ${BACKEND}/functions-cleanup.sh
-. ${BACKEND}/functions-disk.sh
-. ${BACKEND}/functions-extractimage.sh
-. ${BACKEND}/functions-installcomponents.sh
-. ${BACKEND}/functions-installpackages.sh
-. ${BACKEND}/functions-localize.sh
-. ${BACKEND}/functions-mountdisk.sh
-. ${BACKEND}/functions-networking.sh
-. ${BACKEND}/functions-newfs.sh
-. ${BACKEND}/functions-packages.sh
-. ${BACKEND}/functions-parse.sh
-. ${BACKEND}/functions-runcommands.sh
-. ${BACKEND}/functions-ftp.sh
-. ${BACKEND}/functions-unmount.sh
-. ${BACKEND}/functions-upgrade.sh
-. ${BACKEND}/functions-users.sh
-
-# Check that the config file exists
-if [ ! -e "${1}" ]
-then
- echo "ERROR: Install configuration $1 does not exist!"
- exit 1
-fi
-
-# Set our config file variable
-CFGF="$1"
-
-# Check the dirname of the provided CFGF and make sure its a full path
-DIR="`dirname ${CFGF}`"
-if [ "${DIR}" = "." ]
-then
- CFGF="`pwd`/${CFGF}"
-fi
-export CFGF
-
-# Start by doing a sanity check, which will catch any obvious mistakes in the config
-file_sanity_check "installMode disk0 installType installMedium packageType"
-
-# We passed the Sanity check, lets grab some of the universal config settings and store them
-check_value installMode "fresh upgrade"
-check_value bootManager "bsd none"
-check_value installType "PCBSD FreeBSD"
-check_value installMedium "dvd usb ftp rsync LiveCD"
-check_value packageType "uzip tar rsync split cpdup"
-if_check_value_exists partition "all ALL s1 s2 s3 s4 free FREE"
-if_check_value_exists mirrorbal "load prefer round-robin split"
-
-# We passed all sanity checks! Yay, lets start the install
-echo "File Sanity Check -> OK"
-
-# Lets load the various universal settings now
-get_value_from_cfg installMode
-INSTALLMODE="${VAL}" ; export INSTALLMODE
-
-get_value_from_cfg installType
-INSTALLTYPE="${VAL}" ; export INSTALLTYPE
-
-get_value_from_cfg installMedium
-INSTALLMEDIUM="${VAL}" ; export INSTALLMEDIUM
-
-get_value_from_cfg packageType
-PACKAGETYPE="${VAL}" ; export PACKAGETYPE
-
-# Check if we are doing any networking setup
-start_networking
-
-# If we are not doing an upgrade, lets go ahead and setup the disk
-case "${INSTALLMODE}" in
- fresh)
- if [ "${INSTALLMEDIUM}" = "image" ]
- then
- install_image
- else
- install_fresh
- fi
- ;;
-
- upgrade)
- install_upgrade
- ;;
-
- *)
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/usr/sbin/pc-sysinstall/backend/startautoinstall.sh b/usr/sbin/pc-sysinstall/backend/startautoinstall.sh
deleted file mode 100755
index 153d449..0000000
--- a/usr/sbin/pc-sysinstall/backend/startautoinstall.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/sh
-#-
-# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Script which reads the pc-autoinstall.conf directive, and begins the install
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/backend/startautoinstall.sh,v 1.2 2010/06/27 16:46:11 imp Exp $
-
-# Source our functions scripts
-. ${BACKEND}/functions.sh
-. ${BACKEND}/functions-networking.sh
-. ${BACKEND}/functions-parse.sh
-
-# Check that the config file exists
-if [ ! -e "${1}" ]
-then
- echo "ERROR: Install configuration $1 does not exist!"
- exit 1
-fi
-
-# Set our config file variable
-CONF=${1}
-INSTALL_CFG="/tmp/pc-sysinstall.cfg"
-
-# Check if the config file is on disk as well
-PCCFG=`grep "pc_config:" ${CONF} | grep -v "^#" | sed "s|pc_config: ||g" | sed "s|pc_config:||g"`
-SHUTDOWN_CMD=`grep "shutdown_cmd:" ${CONF} | grep -v "^#" | sed "s|shutdown_cmd: ||g" | sed "s|shutdown_cmd:||g"`
-CONFIRM_INS=`grep "confirm_install:" ${CONF} | grep -v "^#" | sed "s|confirm_install: ||g" | sed "s|confirm_install:||g"`
-
-# Check that this isn't a http / ftp file we need to fetch later
-echo "${PCCFG}" | grep -e "^http" -e "^ftp" > /dev/null 2>/dev/null
-if [ "$?" != "0" ]
-then
- # Copy over the install cfg file, if not done already
- if [ ! -e "${INSTALL_CFG}" ]
- then
- cp ${PCCFG} ${INSTALL_CFG}
- fi
- # Make sure we have the file which was copied into /tmp previously
- if [ ! -e "${INSTALL_CFG}" ]
- then
- echo "Error: ${INSTALL_CFG} is missing! Exiting in 10 seconds..."
- sleep 10
- exit 150
- fi
-else
- # We need to fetch a remote file, check and set any nic options before doing so
- NICCFG=`grep "nic_config:" ${CONF} | grep -v "^#" | sed "s|nic_config: ||g" | sed "s|nic_config:||g"`
- if [ "${NICCFG}" = "dhcp-all" -o "${NICCFG}" = "DHCP-ALL" ]
- then
- # Try to auto-enable dhcp on any nics we find
- enable_auto_dhcp
- else
- echo "Running command \"ifconfig ${NICCFG}\""
- ifconfig ${NICCFG}
- WRKNIC="`echo ${NICCFG} | cut -d ' ' -f 1`"
- NICDNS=`grep "nic_dns:" ${CONF} | grep -v "^#" | sed "s|nic_dns: ||g" | sed "s|nic_dns:||g"`
- NICGATE=`grep "nic_gateway:" ${CONF} | grep -v "^#" | sed "s|nic_gateway: ||g" | sed "s|nic_gateway:||g"`
-
- echo "nameserver ${NICDNS}" >/etc/resolv.conf
-
- echo "Running command \"route add default ${NICGATE}\""
- route add default ${NICGATE}
- fi
-
- get_nic_mac "$WRKNIC"
- nic_mac="${FOUNDMAC}"
-
- PCCFG=`echo ${PCCFG} | sed "s|%%NIC_MAC%%|${nic_mac}|g"`
-
- # Now try to fetch the remove file
- echo "Fetching cfg with: \"fetch -o ${INSTALL_CFG} ${PCCFG}\""
- fetch -o "${INSTALL_CFG}" "${PCCFG}"
- if [ "$?" != "0" ]
- then
- echo "ERROR: Failed to fetch ${PCCFG}, install aborted"
- exit 150
- fi
-
-fi
-
-# If we end up with a valid config, lets proccede
-if [ -e "${INSTALL_CFG}" ]
-then
-
- if [ "${CONFIRM_INS}" != "no" -a "${CONFIRM_INS}" != "NO" ]
- then
- echo "Type in 'install' to begin automated installation. Warning: Data on target disks may be destroyed!"
- read tmp
- case $tmp in
- install|INSTALL) ;;
- *) echo "Install canceled!" ; exit 150 ;;
- esac
- fi
-
- ${PROGDIR}/pc-sysinstall -c ${INSTALL_CFG}
- if [ "$?" = "0" ]
- then
- if [ ! -z "$SHUTDOWN_CMD" ]
- then
- ${SHUTDOWN_CMD}
- else
- echo "SUCCESS: Installation finished! Press ENTER to reboot."
- read tmp
- shutdown -r now
- fi
- else
- echo "ERROR: Installation failed, press ENTER to drop to shell."
- read tmp
- /bin/csh
- fi
-else
- echo "ERROR: Failed to get /tmp/pc-sysinstall.cfg for automated install..."
- exit 150
-fi
diff --git a/usr/sbin/pc-sysinstall/conf/Makefile b/usr/sbin/pc-sysinstall/conf/Makefile
deleted file mode 100644
index 0fe7ff0..0000000
--- a/usr/sbin/pc-sysinstall/conf/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/conf/Makefile,v 1.2 2010/06/24 22:29:36 imp Exp $
-
-NO_OBJ=
-
-FILESGROUPS= CONF LICENSE
-CONF= exclude-from-upgrade pc-sysinstall.conf avail-langs
-CONFDIR= ${SHAREDIR}/pc-sysinstall/conf
-LICENSE= licenses/bsd-en.txt licenses/intel-en.txt licenses/nvidia-en.txt
-LICENSEDIR= ${SHAREDIR}/pc-sysinstall/conf/license
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/conf/avail-langs b/usr/sbin/pc-sysinstall/conf/avail-langs
deleted file mode 100644
index d78e14a..0000000
--- a/usr/sbin/pc-sysinstall/conf/avail-langs
+++ /dev/null
@@ -1,20 +0,0 @@
-en English
-bg Bulgarian
-ca Catalan
-zh_TW Chinese_(Taiwan)
-cs Czech
-nl Dutch
-fr French
-de German
-en_GB English_(UK)
-en_ZA English_(South Africa)
-it Italian
-ja Japanese
-pt_BR Portuguese_(Brazil)
-pl Polish
-pa Punjabi
-ru Russian
-sk Slovak
-sl Slovenian
-es Spanish
-uk Ukrainian
diff --git a/usr/sbin/pc-sysinstall/conf/exclude-from-upgrade b/usr/sbin/pc-sysinstall/conf/exclude-from-upgrade
deleted file mode 100644
index b0529d4..0000000
--- a/usr/sbin/pc-sysinstall/conf/exclude-from-upgrade
+++ /dev/null
@@ -1,15 +0,0 @@
-etc/fstab
-dev
-etc/passwd
-etc/pwd.db
-etc/group
-etc/master.passwd
-etc/spwd.db
-etc/hosts
-etc/resolv.conf
-etc/localtime
-etc/hosts
-etc/X11
-etc/nsmb.conf
-usr/Programs/.config/ProgList
-Programs/.config/ProgList
diff --git a/usr/sbin/pc-sysinstall/conf/licenses/bsd-en.txt b/usr/sbin/pc-sysinstall/conf/licenses/bsd-en.txt
deleted file mode 100644
index a30b67e..0000000
--- a/usr/sbin/pc-sysinstall/conf/licenses/bsd-en.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-SECTION 1: BSD LICENSE
---------------------------------------------------------------------------------
-Copyright (c) 1998, Regents of the University of California
-All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- Neither the name of the University of California, Berkeley nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPR
-ESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO E
-VENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCI
-DENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AN ON ANY THEORY OF LIABILITY, WHETHER
- IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/usr/sbin/pc-sysinstall/conf/licenses/intel-en.txt b/usr/sbin/pc-sysinstall/conf/licenses/intel-en.txt
deleted file mode 100644
index 0858ff7..0000000
--- a/usr/sbin/pc-sysinstall/conf/licenses/intel-en.txt
+++ /dev/null
@@ -1,207 +0,0 @@
-Section 2: Intel Firmware license
---------------------------------------------------------------------------------
- TERMS AND CONDITIONS
- IMPORTANT - PLEASE READ BEFORE INSTALLING OR USING THIS INTEL(C) SOFTWARE
-
-Do not use or load this firmware (the "Software") until you have carefully read
-the following terms and conditions. By loading or using the Software, you agree
-to the terms of this Agreement. If you do not wish to so agree, do not install
-or use the Software.
-
-LICENSEES:
-
-Please note:
-
-* If you are an End-User, only Exhibit A, the SOFTWARE LICENSE AGREEMENT,
- applies.
-* If you are an Original Equipment Manufacturer (OEM), Independent Hardware
- Vendor (IHV), or Independent Software Vendor (ISV), this complete Agreement
- applies
-
---------------------------------------------------------------------------------
-
-For OEMs, IHVs, and ISVs:
-
-LICENSE. This Software is licensed for use only in conjunction with Intel
-component products. Use of the Software in conjunction with non-Intel component
-products is not licensed hereunder. Subject to the terms of this Agreement,
-Intel grants to you a nonexclusive, nontransferable, worldwide, fully paid-up
-license under Intel's copyrights to: (i) copy the Software internally for your
-own development and maintenance purposes; (ii) copy and distribute the Software
-to your end-users, but only under a license agreement with terms at least as
-restrictive as those contained in Intel's Final, Single User License Agreement,
-attached as Exhibit A; and (iii) modify, copy and distribute the end-user
-documentation which may accompany the Software, but only in association with
-the Software.
-
-If you are not the final manufacturer or vendor of a computer system or software
-program incorporating the Software, then you may transfer a copy of the
-Software, including any related documentation (modified or unmodified) to your
-recipient for use in accordance with the terms of this Agreement, provided such
-recipient agrees to be fully bound by the terms hereof. You shall not otherwise
-assign, sublicense, lease, or in any other way transfer or disclose Software to
-any third party. You may not, nor may you assist any other person or entity to
-modify, translate, convert to another programming language, decompile, reverse
-engineer, or disassemble any portion of the Software or otherwise attempt to
-derive source code from any object code modules of the Software or any internal
-data files generated by the Software. Your rights to redistribute the Software
-shall be contingent upon your installation of this Agreement in its entirety in
-the same directory as the Software.
-
-CONTRACTORS. For the purpose of this Agreement, and notwithstanding anything
-to the contrary hereunder, solely with respect to the requirements for
-compliance with the terms hereunder, any contractors or consultants that You
-use to perform the work or otherwise assist You in the development or products
-using this Software shall be deemed to be End Users and accordingly, upon
-receipt of the Software, shall be bound by the terms of Exhibit A, Software
-License Agreement. No additional agreement between You and such consultants or
-contractors is required under this Agreement to detail such compliance.
-
-TRADEMARKS. Except as expressly provided herein, you shall not use Intel's
-name in any publications, advertisements, or other announcements without
-Intel's prior written consent. You do not have any rights to use any Intel
-trademarks or logos.
-
-OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Software and accompanying materials, if
-any, are owned by Intel or its suppliers and licensors and may be protected by
-copyright, trademark, patent and trade secret law and international treaties.
-Any rights, express or implied, in the intellectual property embodied in the
-foregoing, other than those specified in this Agreement, are reserved by Intel
-and its suppliers and licensors or otherwise as set forth in any applicable
-open source license agreement. You will keep the Software free of liens,
-attachments, and other encumbrances. You agree not to remove any proprietary
-notices and/or any labels from the Software and accompanying materials without
-prior written approval by Intel
-
-LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS AND LICENSORS
-BE LIABLE FOR ANY DAMAGES WHATSOEVER FROM ANY CAUSE OF ACTION OF ANY KIND
-(INCLUDING, WITHOUT LIMITATION, LOST PROFITS, BUSINESS INTERRUPTION, OR LOST
-INFORMATION) ARISING OUT OF THE USE, MODIFICATION, OR INABILITY TO USE THE
-INTEL SOFTWARE, OR OTHERWISE, NOR FOR PUNITIVE, INCIDENTAL, CONSEQUENTIAL, OR
-SPECIAL DAMAGES OF ANY KIND, EVEN IF INTEL OR ITS SUPPLIERS AND LICENSORS HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT
-EXCLUSION OR LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES, CONSEQUENTIAL OR
-INCIDENTAL DAMAGES, SO CERTAIN LIMITATIONS MAY NOT APPLY. YOU MAY ALSO HAVE
-OTHER LEGAL RIGHTS THAT VARY BETWEEN JURISDICTIONS.
-
-EXCLUSION OF WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS" AND POSSIBLY WITH
-FAULTS. UNLESS EXPRESSLY AGREED OTHERWISE, INTEL AND ITS SUPPLIERS AND
-LICENSORS DISCLAIM ANY AND ALL WARRANTIES AND GUARANTEES, EXPRESS, IMPLIED OR
-OTHERWISE, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. Intel does not warrant
-or assume responsibility for the accuracy or completeness of any information,
-text, graphics, links or other items contained within the Software. You assume
-all liability, financial or otherwise, associated with Your use or disposition
-of the Software.
-
-APPLICABLE LAW. Claims arising under this Agreement shall be governed by the
-laws of State of California], excluding its principles of conflict of laws and
-the United Nations Convention on Contracts for the Sale of Goods.
-
-WAIVER AND AMENDMENT. No modification, amendment or waiver of any provision of
-this Agreement shall be effective unless in writing and signed by an officer of
-Intel. No failure or delay in exercising any right, power, or remedy under
-this Agreement shall operate as a waiver of any such right, power or remedy.
-Without limiting the foregoing, terms and conditions on any purchase orders or
-similar materials submitted by you to Intel, and any terms contained in IntelÂ’s
-standard acknowledgment form that are in conflict with these terms, shall be of
-no force or effect.
-
-SEVERABILITY. If any provision of this Agreement is held by a court of
-competent jurisdiction to be contrary to law, such provision shall be changed
-and interpreted so as to best accomplish the objectives of the original
-provision to the fullest extent allowed by law and the remaining provisions of
-this Agreement shall remain in full force and effect.
-
-EXPORT RESTRICTIONS. Each party acknowledges that the Software is subject to
-applicable import and export regulations of the United States and of the
-countries in which each party transacts business, specifically including U.S.
-Export Administration Act and Export Administration Regulations. Each party
-shall comply with such laws and regulations, as well as all other laws and
-regulations applicable to the Software. Without limiting the generality of the
-foregoing, each party agrees that it will not export, re-export, transfer or
-divert any of the Software or the direct programs thereof to any restricted
-place or party in accordance with U.S. export regulations. Note that Software
-containing encryption may be subject to additional restrictions.
-
-GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED RIGHTS."
-Use, duplication, or disclosure by the Government is subject to restrictions as
-set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or their successors. Use
-of the Software by the Government constitutes acknowledgment of Intel's
-proprietary rights therein. Contractor or Manufacturer is Intel Corporation,
-2200 Mission College Blvd., Santa Clara, CA 95052.
-
-TERMINATION OF THE AGREEMENT. Intel may terminate this Agreement if you violate
-its terms. Upon termination, you will immediately destroy the Software or
-return all copies of the Software to Intel.
-
---------------------------------------------------------------------------------
-
-EXHIBIT "A"
-
-SOFTWARE LICENSE AGREEMENT (Final, Single User)
-
-IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
-
-Do not use or load this firmware image (the "Software") until you have carefully
-read the following terms and conditions. By loading or using the Software, you
-agree to the terms of this Agreement. If you do not wish to so agree, do not
-install or use the Software.
-
-LICENSE. You may copy and use the Software, subject to these conditions:
-1. This Software is licensed for use only in conjunction with Intel component
- products. Use of the Software in conjunction with non-Intel component
- products is not licensed hereunder.
-2. You may not copy, modify, rent, sell, distribute or transfer any part of the
- Software except as provided in this Agreement, and you agree to prevent
- unauthorized copying of the Software.
-3. You may not reverse engineer, decompile, or disassemble the Software.
-4. You may not sublicense the Software.
-5. The Software may contain the software or other property of third party
- suppliers.
-
-OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software
-remains with Intel or its suppliers. The Software is copyrighted and protected
-by the laws of the United States and other countries, and international treaty
-provisions. You may not remove any copyright notices from the Software. Intel
-may make changes to the Software, or items referenced therein, at any time
-without notice, but is not obligated to support or update the Software. Except
-as otherwise expressly provided, Intel grants no express or implied right under
-Intel patents, copyrights, trademarks, or other intellectual property rights.
-You may transfer the Software only if a copy of this license accompanies the
-Software and the recipient agrees to be fully bound by these terms.
-
-EXCLUSION OF OTHER WARRANTIES EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS PROVIDED
-"AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING
-WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR
-PURPOSE. Intel does not warrant or assume responsibility for the accuracy or
-completeness of any information, text, graphics, links or other items contained
-within the Software.
-
-LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE FOR
-ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS, BUSINESS
-INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR INABILITY TO
-USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR LIMITATION OF LIABILITY FOR
-IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE
-LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE OTHER LEGAL RIGHTS THAT VARY
-BETWEEN JURISDICTIONS.
-
-TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time if
-you violate its terms. Upon termination, you will immediately destroy the
-Software.
-
-APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the
-laws of California, excluding its principles of conflict of laws and the United
-Nations Convention on Contracts for the Sale of Goods. You may not export the
-Software in violation of applicable export laws and regulations. Intel is not
-obligated under any other agreements unless they are in writing and signed by
-an authorized representative
-of Intel.
-
-GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED RIGHTS."
-Use, duplication, or disclosure by the Government is subject to restrictions as
-set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or their successors. Use
-of the Software by the Government constitutes acknowledgment of Intel's
-proprietary rights therein. Contractor or Manufacturer is Intel Corporation,
-2200 Mission College Blvd., Santa Clara, CA 95052.
diff --git a/usr/sbin/pc-sysinstall/conf/licenses/nvidia-en.txt b/usr/sbin/pc-sysinstall/conf/licenses/nvidia-en.txt
deleted file mode 100644
index 22c7906..0000000
--- a/usr/sbin/pc-sysinstall/conf/licenses/nvidia-en.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Section 3: NVIDIA driver license agreement
---------------------------------------------------------------------------------
-License For Customer Use of NVIDIA Software
-
-IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries ("NVIDIA") downloadable herefrom, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download the SOFTWARE.
-
-RECITALS
-
-Use of NVIDIA's products requires three elements: the SOFTWARE, the hardware on a graphics controller board, and a personal computer. The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is not sold, and instead is only licensed for use, strictly in accordance with this document. The hardware is protected by various patents, and is sold, but this LICENSE does not cover that sale, since it may not necessarily be sold as a package with the SOFTWARE. This LICENSE sets forth the terms and conditions of the SOFTWARE LICENSE only.
-
-1. DEFINITIONS
-
-1.1 Customer. Customer means the entity or individual that downloads the SOFTWARE.
-
-2. GRANT OF LICENSE
-
-2.1 Rights and Limitations of Grant. NVIDIA hereby grants Customer the following non-exclusive, non-transferable right to use the SOFTWARE, with the following limitations:
-
-2.1.1 Rights. Customer may install and use one copy of the SOFTWARE on a single computer, and except for making one back-up copy of the Software, may not otherwise copy the SOFTWARE. This LICENSE of SOFTWARE may not be shared or used concurrently on different computers.
-
-2.1.2 Linux/FreeBSD Exception. Notwithstanding the foregoing terms of Section 2.1.1, SOFTWARE designed exclusively for use on the Linux or FreeBSD operating systems, or other operating systems derived from the source code to these operating systems, may be copied and redistributed, provided that the binary files thereof are not modified in any way (except for unzipping of compressed files).
-
-2.1.3 Limitations.
-
-No Reverse Engineering. Customer may not reverse engineer, decompile, or disassemble the SOFTWARE, nor attempt in any other manner to obtain the source code.
-
-No Separation of Components. The SOFTWARE is licensed as a single product. Its component parts may not be separated for use on more than one computer, nor otherwise used separately from the other parts.
-
-No Rental. Customer may not rent or lease the SOFTWARE to someone else.
-
-3. TERMINATION
-
-This LICENSE will automatically terminate if Customer fails to comply with any of the terms and conditions hereof. In such event, Customer must destroy all copies of the SOFTWARE and all of its component parts.
-
-Defensive Suspension. If Customer commences or participates in any legal proceeding against NVIDIA, then NVIDIA may, in its sole discretion, suspend or terminate all license grants and any other rights provided under this LICENSE during the pendency of such legal proceedings.
-
-4. COPYRIGHT
-
-All title and copyrights in and to the SOFTWARE (including but not limited to all images, photographs, animations, video, audio, music, text, and other information incorporated into the SOFTWARE), the accompanying printed materials, and any copies of the SOFTWARE, are owned by NVIDIA, or its suppliers. The SOFTWARE is protected by copyright laws and international treaty provisions. Accordingly, Customer is required to treat the SOFTWARE like any other copyrighted material, except as otherwise allowed pursuant to this LICENSE and that it may make one copy of the SOFTWARE solely for backup or archive purposes.
-
-5. APPLICABLE LAW
-
-This LICENSE shall be deemed to have been made in, and shall be construed pursuant to, the laws of the State of California. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed.
-
-6. DISCLAIMER OF WARRANTIES AND LIMITATION ON LIABILITY
-
-6.1 No Warranties. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED "AS IS" AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-6.2 No Liability for Consequential Damages. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. MISCELLANEOUS
-
-If any provision of this LICENSE is inconsistent with, or cannot be fully enforced under, the law, such provision will be construed as limited to the extent necessary to be consistent with and fully enforceable under the law. This LICENSE is the final, complete and exclusive agreement between the parties relating to the subject matter hereof, and supersedes all prior or contemporaneous understandings and agreements relating to such subject matter, whether oral or written. This LICENSE may only be modified in writing signed by an authorized officer of NVIDIA. Customer agrees that it will not ship, transfer or export the SOFTWARE into any country, or use the SOFTWARE in any manner, prohibited by the United States Bureau of Export Administration or any export laws, restrictions or regulations.
diff --git a/usr/sbin/pc-sysinstall/conf/pc-sysinstall.conf b/usr/sbin/pc-sysinstall/conf/pc-sysinstall.conf
deleted file mode 100644
index 92a5b3e..0000000
--- a/usr/sbin/pc-sysinstall/conf/pc-sysinstall.conf
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-# $FreeBSD: src/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf,v 1.4 2010/10/09 08:52:09 imp Exp $
-# Configuration options for pc-sysinstall
-
-TMPDIR="/tmp/.pc-sysinstall"
-export TMPDIR
-
-if [ ! -d "${TMPDIR}" ]
-then
- mkdir -p ${TMPDIR}
- chmod 777 ${TMPDIR}
-fi
-
-# Set our temp directory for storing partition information
-PARTDIR="${TMPDIR}/part-info"
-export PARTDIR
-
-# Set the SLICECFGDIR
-SLICECFGDIR="${TMPDIR}/.slice-cfg"
-export SLICECFGDIR
-
-# Set the MIRRORCFGDIR
-MIRRORCFGDIR="${TMPDIR}/.mirror-cfg"
-export MIRRORCFGDIR
-
-# Set the GELIKEYDIR
-GELIKEYDIR="${TMPDIR}/.geli-keys"
-export GELIKEYDIR
-
-# Set our log file
-LOGOUT="${TMPDIR}/pc-sysinstall.log"
-export LOGOUT
-
-# Set the number of rsync tries
-RSYNCTRIES="3"
-export RSYNCTRIES
-
-# Set our mount-points
-CDMNT="/cdmnt-install"
-FSMNT="/mnt"
-UZIP_DIR="/usr"
-BOOT_PART_MOUNT="/boot-mount"
-export FSMNT CDMNT UZIP_DIR BOOT_PART_MOUNT
-
-# Set the location of component files on DVD / usb / ftp
-# Relative to CDMNT or the FTP root
-COMPFILEDIR="extras/"
-export COMPFILEDIR
-
-# Set the component temp directory, which is relative to FSMNT
-COMPTMPDIR="/usr/.componenttmp"
-export COMPTMPDIR
-
-# set the package temp directory, which is relative to FSMNT
-PKGTMPDIR="/usr/.pkgtmp"
-export PKGTMPDIR
-
-# Variables to set the location of installation data
-UZIP_FILE="PCBSD.ufs.uzip"
-TAR_FILE="PCBSD.tbz"
-export UZIP_FILE TAR_FILE
-
-# Locations of FreeBSD only install files
-FBSD_UZIP_FILE="fbsd-release.ufs.uzip"
-FBSD_TAR_FILE="fbsd-release.tbz"
-FBSD_BRANCH="8.0-RELEASE"
-FBSD_BRANCH_DIR="${FBSD_BRANCH}"
-FBSD_ARCH=`uname -m`
-export FBSD_UZIP_FILE FBSD_TAR_FILE FBSD_BRANCH FBSD_BRANCH_DIR FBSD_ARCH
-
-# Location of image file
-IMAGE_FILE="/home/john/tmp/PCBSD8.1-x86-USB.img"
-export IMAGE_FILE
-
-# Our internet mirror listing file location
-NETSERVER="http://updates.pcbsd.org"
-ARCH="`uname -m`"
-
-# Check if we are running on a PC-BSD Disk
-if [ -e "/PCBSDVERSION" ] ; then
- VERSION="`cat /PCBSDVERSION`"
-else
- VERSION="UNKNOWN"
-fi
-
-MIRRORLIST="${NETSERVER}/mirrors-netinstall.php?ver=${VERSION}&arch=${ARCH}"
diff --git a/usr/sbin/pc-sysinstall/doc/Makefile b/usr/sbin/pc-sysinstall/doc/Makefile
deleted file mode 100644
index 22fb7a0..0000000
--- a/usr/sbin/pc-sysinstall/doc/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/doc/Makefile,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-FILES= help-disk-list help-disk-size help-index help-start-autoinstall
-
-FILESDIR=${SHAREDIR}/pc-sysinstall/doc
-NO_OBJ=
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/doc/help-disk-list b/usr/sbin/pc-sysinstall/doc/help-disk-list
deleted file mode 100644
index 0d4bff9..0000000
--- a/usr/sbin/pc-sysinstall/doc/help-disk-list
+++ /dev/null
@@ -1 +0,0 @@
-Holder
diff --git a/usr/sbin/pc-sysinstall/doc/help-disk-size b/usr/sbin/pc-sysinstall/doc/help-disk-size
deleted file mode 100644
index 0d4bff9..0000000
--- a/usr/sbin/pc-sysinstall/doc/help-disk-size
+++ /dev/null
@@ -1 +0,0 @@
-Holder
diff --git a/usr/sbin/pc-sysinstall/doc/help-index b/usr/sbin/pc-sysinstall/doc/help-index
deleted file mode 100644
index bad401f..0000000
--- a/usr/sbin/pc-sysinstall/doc/help-index
+++ /dev/null
@@ -1,100 +0,0 @@
-pc-sysinstall Help Index
------------------------------------------------
-Help Commands
-
- help
- Display this index file
-
- help <command>
- Display the help data for the specified command
-
-System Query Commands
- install-image <image> <device>
- Installs an image file to a device file
-
- disk-list
- Provides a listing of the disk drives detected on this system
-
- disk-part <disk>
- Queries the specified disk and returns information about its partitions
-
- disk-info <disk>
- Returns information about the disks size, cyls, heads, and sectors
-
- detect-laptop
- Tests to see if this system is a laptop or desktop
-
- detect-emulation
- Tests to see if this system is actually running in an emulator such as VirtualBox
-
- detect-nics
- Returns a listing of the detected network cards on this system
-
- list-config
- Returns a listing of the pc-sysinstall configuration
-
- list-components
- Returns a listing of the available components which can be installed
-
- list-mirrors [country]
- Returns a listing of the available FTP mirrors
-
- list-packages [category] [package]
- Returns a listing of the available packages
-
- list-rsync-backups <user> <host> <port>
- Returns a listing of available rsync-backups on the target server in the life-preserver/ dir
-
- list-tzones
- Returns a listing of available timezones
-
- query-langs
- Return a list of languages that the installer supports
-
- get-packages
- Retrieves the list of packages from an FTP mirror
-
- sys-mem
- Return the size of installed system RAM in MegaBytes
-
- set-mirror <mirror>
- Set FTP mirror
-
- test-netup
- Test if an internet connection is available
-
- update-part-list
- Return a list of PC-BSD & FreeBSD installs on this system for updates
-
- xkeyboard-layouts
- Return a list of keyboard layouts that xorg supports
-
- xkeyboard-models
- Return a list of keyboard models that xorg supports
-
- xkeyboard-variants
- Return a list of keyboard variants that xorg supports
-
-Partition Management Commands
-
- create-part <disk> <size>
- Create a new MBR primary slice on the target <disk> using <size> MB
-
- delete-part <partition>
- Deletes the disk partition specified. If this is the last partition,
- the disk partition layout will also be scrubbed, leaving a clean disk
- ready for MBR or GPT file system layouts.
-
-
-Installation Commands
-
- -c <cfg>
- Begin a install / upgrade with the specified cfg file
-
- start-autoinstall <conf>
- Start an automated installation with the specified conf file
- Normally only used by automated install scripts
-
- setup-ssh-keys <user> <host> <port>
- Setup SSH without a password for the target host and user and port
- Use to prompt the user to log into a server before doing a rsync + ssh restore
diff --git a/usr/sbin/pc-sysinstall/doc/help-start-autoinstall b/usr/sbin/pc-sysinstall/doc/help-start-autoinstall
deleted file mode 100644
index 1cb1e6a..0000000
--- a/usr/sbin/pc-sysinstall/doc/help-start-autoinstall
+++ /dev/null
@@ -1,39 +0,0 @@
-start-autoinstall - HELP
------------------------------------------------
-
-About:
- start-autoinstall is used when performing automated installationsr. It is able
- to configure networking with provided settings, and fetch an installation script from
- http / ftp server. This allows media to be created which fetches dynamic configuration
- options from a server-side supplier.
-
-Usage:
- pc-sysinstall start-autoinstall <config>
-
-Config Syntax:
-
- The configuration file for start-autoinstall can contain the following options:
-
- pc_config: <value>
- - Location of the pc-sysinstall installation configuration file, can be local
- or start with http:// or ftp:// to fetch from a remote system.
-
- shutdown_cmd: <value>
- - Command to execute post-installation, such as "shutdown -p now" or other.
-
- confirm_install: (YES/NO)
- - Prompt on the console to begin installation. Defaults to YES.
- Warning: Setting this to NO will start an installation as soon as start-autoinstall
- is run. (I.E. after booting some install media) It may be dangerous if a disk is left
- in a drive and the system is turned on!
-
- nic_config: (DHCP-ALL / <cfg>)
- - When set to DHCP-ALL, the software will attempt to get a network address from DHCP on
- any / all detected NICS. If set to some other command, it will be used as an argument
- to "ifconfig" to enable networking.
-
- nic_dns: <value>
- - Use the following DNS server for networking
-
- nic_gateway: <gateway>
- - Use the following default route / gateway for networking
diff --git a/usr/sbin/pc-sysinstall/examples/Makefile b/usr/sbin/pc-sysinstall/examples/Makefile
deleted file mode 100644
index 5bb58c9..0000000
--- a/usr/sbin/pc-sysinstall/examples/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/examples/Makefile,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-FILES= README pc-autoinstall.conf pcinstall.cfg.fbsd-netinstall \
- pcinstall.cfg.geli pcinstall.cfg.gmirror pcinstall.cfg.netinstall \
- pcinstall.cfg.restore pcinstall.cfg.rsync pcinstall.cfg.upgrade \
- pcinstall.cfg.zfs
-
-FILESDIR=${SHAREDIR}/examples/pc-sysinstall
-NO_OBJ=
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/examples/README b/usr/sbin/pc-sysinstall/examples/README
deleted file mode 100644
index 7d9fd5e..0000000
--- a/usr/sbin/pc-sysinstall/examples/README
+++ /dev/null
@@ -1,369 +0,0 @@
-pc-sysinstall README
-
-This file documents many of the variables used in pc-sysinstall
-config scripts
-#################################################################
-
-# hostname=
-
-Using hostname= will set the specified hostname on the
-installed system
-
-When hostname= is not present, pc-sysinstall will auto-generate
-a hostname such as freebsd-XXXX or pcbsd-XXXX
-
-# installMode=(fresh or upgrade)
-
-Set the type of install we are doing, fresh or upgrade.
-
-Fresh installs will format and mount the target disks before
-extracting the install images to the system. Using this mode
-it is also possible to do a system restore, by specifying a
-full system backup as the install source.
-
-Upgrades will mount the target disk, and extract the system
-archive to the disk, overwriting files on the disk.
-The conf/exclude-from-upgrade file can be used to specify
-additional files to exclude from overwriting during the
-install process.
-
-# installInteractive=(yes or no)
-
-Set if the installer is running in interactive mode, and
-is able to prompt for input from the user, defaults to no
-
-
-########################################################################
-# NETWORK SETTINGS
-########################################################################
-
-# netDev=(AUTO-DHCP or <nic>)
-
-netDev specifies what type of networking to enable for the installer
-Can be set to AUTO-DHCP or to a network interface, such as et0
-
-When set to AUTO-DHCP, pc-sysinstall will probe for all network devices
-and attempt to set DHCP mode on each, until a working network connection
-is established
-
-If netDev= is set to a network interface such as et0, the following options
-will need to be set in order to enable the interface
-
-# netIP=(IP address such as 192.168.0.100)
-
- Set netIP to an address that you wish to have the interface specified in
- netDev set to
- Only used when netDev is not set to AUTO-DHCP
-
-# netMask=(Netmask such as 255.255.255.0)
-
-Set netMask to the address you with to have the interface specified in
-netDev set to
-Only used when netDev is not set to AUTO-DHCP
-
-
-# netNameServer=(DNS Server such as 192.168.0.1)
-
-Set netNameServer to the DNS address you want to use during the install
-Only used when netDev is not set to AUTO-DHCP
-
-
-# netDefaultRouter=(192.168.0.1)
-
-Set netDefaultRouter to the gateway you wish to have the installer use
-Only used when netDev is not set to AUTO-DHCP
-
-
-
-# netSaveDev=(AUTO-DHCP or network interface)
-
-netSaveDev specifies what networking to enable on the installed system
-
-When set to AUTO-DHCP, pc-sysinstall will probe all network interfaces, and
-set them all to DHCP in the systems /etc/rc.conf file. Wireless devices will also
-have the corresponding wlan[0-9] device created.
-
-When set to a network interface, pc-sysinstall will set the target device with
-the settings specified by the variables below.
-
-# netSaveIP=192.168.0.49
-# netSaveMask=255.255.255.0
-# netSaveNameServer=208.67.222.222
-# netSaveDefaultRouter=192.168.0.1
-
-
-
-
-########################################################################
-# DISK SLICE SETTINGS
-########################################################################
-
-The following section specifies the target disk(s) to be used in the
-install or upgrade.
-
-# disk0=(disk device, such as ad0)
-
-The diskX= variable should be set to the target device for this drive, such
-as ad0, da0
-The first should begin with disk0=, and additional drives to disk1=, disk2
-if additional disks are to be setup.
-
-When doing an upgrade, the disk0= line should be set to the root device or
-root zpool of the target system to update. I.E:
- # disk0=tank0
- # disk0=ada0s1a
-
-
-# partition=(all, free, s1, s1, s3, s4, image)
-
-After setting disk[0-9], the partition= variable is used to specify which target
-partition we will be working with for this device.
-
-Setting this to "all" will setup the disk with a single FreeBSD slice as "s1"
-
-Setting this to "free" will allow pc-sysinstall to search for the first available
-primary slice with free space, and create the slice.
-
-Setting this to "s1, s2, s3 or s4" will use the specified MBR slice.
-
-Setting this to "image" will use an image to configure the disk.
-
-(This tag is unused for upgrades)
-
-# partscheme=(MBR/GPT)
-
-When performing a "full" disk (partition=all), the partscheme= variable is used
-to determine the partition scheme type gpart will be using on the disk. Valid
-choices are MBR or GPT.
-
-# mirror=(disk device such as ad1)
-
-Setting the mirror= variable will setup the target device as a gmirror
-of the diskX= device. The mirror device must be the same size or larger
-than the drive being mirrored.
-
-
-# mirrorbal=(load, prefer, round-robin, split)
-
-Allows the setting of the mirror balance method to be used, if not
-specified this defaults to "round-robin"
-
-# bootManager=(none, bsd)
-
-Setting this option will instruct pc-sysinstall to install the BSD boot Manager,
-or leave it empty
-
-# image=(/path/to/image/file) (/mountpoint)
-
-Setting this option will instruct pc-sysinstall to write the image file
-specified by the path to the disk.
-
-# commitDiskPart
-
-This command must be placed at the end of the diskX= section, before starting
-the listing of any additional diskX= directives.
-
-
-########################################################################
-# DISK PARTITION / MOUNT SETTINGS
-########################################################################
-
-The following settings specify the partitioning / mount points to setup
-on the target partition
-
-# disk0-part=UFS+S 500 /
-# disk0-part=SWAP 2000 none
-# disk0-part=UFS.eli 500 /usr
-# encpass=mypass
-# disk0-part=UFS+J 500 /tmp
-# disk0-part=ZFS 0 /data,/storage (mirror: ad1)
-# commitDiskLabel
-
-The above values instructs pc-sysinstall which partitions / mounts
-to create on the target drive / slice, specified by "disk0".
-(disk0 will resolve to the drive / slice specified in the previous section)
-
-The notation is as follows:
-<File System Type> <Size> <Mountpoint>
-
-Available FileSystems:
- UFS - Standard UFS2 FileSystem
-UFS+S - UFS2 + Softupdates enabled
-UFS+SUJ - UFS2 + Soft Updates + Journaling enabled
-UFS+J - UFS2 + Journaling through gjournal
- ZFS - Z File System, pools / mounts created automatically
- SWAP - BSD Swap space partition, mountpoint should be set to "none"
-
-Adding the ".eli" extension to any of the above file systems
-will enable disk encryption via geli
-(UFS.eli, UFS+S.eli, UFS+SUJ.eli, UFS+J.eli, ZFS.eli, SWAP.eli)
-
-If you with to use a passphrase with this encrypted partition, on the next line
-the flag "encpass=" should be entered:
-encpass=mypass
-
-All sizes are expressed in MegaBytes
-Specifying a size 0 instructs pc-sysinstall to use the rest of the
-available slice size, and should only be used for the last partition / mount
-
-When using "ZFS" specifically, it is possible to specify additional disks / partitions
-to include in the zpool. By using the syntax: (mirror: ad1,ad2) or (raidz: ad1,ad2), it is possible
-to include the disk "ad1" into the zpool for this partition, using the raidz / mirror methods.
-If you with to just include the disk into the pool in "basic" mode, then use (ad1,ad2) with no flags
-
-########################################################################
-# INSTALL OPTIONS / SOURCES
-########################################################################
-
-The following settings specify the type, locations and sources
-for this installation
-
-# installMedium=(dvd, usb, ftp, rsync, image)
-
-Set installMedium= to the source type we will be using for this install.
-
-Available Types:
- dvd - Search for and mount the DVD which contains the install archive
- usb - Search for and mount the USB drive which contains the install archive
- ftp - The install archive will be fetched from a FTP / HTTP server before install
-rsync - Pull the system data from a ssh + rsync server, specified with variables below
-image - Install system from an image
-
-# installType=(PCBSD, FreeBSD)
-
-Set the type of system we are installing, PCBSD or FreeBSD
-
-# installFile=fbsd-release.tbz
-
-The installer archive, if not using the defaults specified in conf/pc-sysinstall.conf
-
-# packageType=(tar, uzip, split)
-
-The archive type we are extracting from when using dvd, usb or ftp
-
-# ftpPath=ftp://ftp.pcbsd.org/pub/8.0/netinstall
-
-Location of the installer archive when using a installMedium=ftp
-
-# rsyncPath=life-preserver/back-2009-11-12T14_53_14
-
-The location of the rsync data on the remote server when using installMedium=rsync
-
-# rsyncUser=rsyncuser
-
-The username to use for the ssh server running rsync
-
-# rsyncHost=192.168.0.50
-
-The rsync / ssh server we wish to connect to
-
-# rsyncPort=22
-
-The port to use when connecting to a ssh + rsync server
-
-# installComponents=amarok,firefox,ports
-
-The specified components to install, view available with "./pc-sysinstall list-components"
-
-
-########################################################################
-# UPGRADE OPTIONS
-########################################################################
-
-Options specific to performing an upgrade
-
-# upgradeKeepDesktopProfile=(yes/no)
-
-This option allows you to specify if you wish to keep your existing users desktop
-profile data. The default is NO, and your existing profile will be moved to
-.kde4.preUpgrade automatically.
-
-########################################################################
-# USER OPTIONS
-########################################################################
-
-Options for setting up usernames and passwords on the installed system
-
-# rootPass=root
-
-Set the root password of the installed system to the specified string
-
-The below variables are used to setup a user on the installed system
-Be sure to call commitUser after after adding these values, and before
-starting another user block
-
-# userName=kris
-# userComment=Kris Moore
-# userPass=mypass
-# userShell=/bin/csh
-# userHome=/home/kris
-# userGroups=wheel,operator
-# commitUser
-
-########################################################################
-# RUN COMMANDS
-########################################################################
-
-The following variables can be set to run commands post-installation,
-allowing the user to further tweak / modify the system
-
-# runCommand=
-
-Run the specified command within chroot of the installed system
-
-# runScript=
-
-runScript will copy the specified script into FSMNT, and run it in chroot of the system
-Usefull when you have a 3rd party script on the DVD / USB, and you want to copy it into
-the installed system and run
-
-# runExtCommand=
-
-runExtCommand is used when you wish to run a command outside the chroot
-The variable $FSMNT is set to the mount-point of your installed system
-
-
-########################################################################
-# PC-BSD SPECIFC OPTIONS
-########################################################################
-
-Options for time-zones and NTP on the installed system
-
-# timeZone=
-
-timeZone can be set to the zone file in /usr/share/zoneinfo/ that is to be used
-example: America/New_York
-
-# enableNTP= (yes / no)
-
-set enableNTP to yes or no to enable or disable the NTP service on the system
-
-
-########################################################################
-# PC-BSD SPECIFC OPTIONS
-########################################################################
-
-Options specific to installing PC-BSD, such as localization, and KDE settings
-
-# localizeLang=en
-
-localizeLang will set the system console and Desktop to the target language
-
-# localizeKeyLayout=en
-
-localizeKeyLayout updates the system's xorg config to set the keyboard layout
-
-# localizeKeyModel=pc104
-
-localizeKeyModel updates the system's xorg config to set the keyboard model
-
-# localizeKeyVariant=intl
-
-localizeKeyVariant is used to update the xorg config to set the keyboard variant
-
-# autoLoginUser=kris
-
-Setting autoLoginUser will enable the specified user to log into the desktop
-automatically without entering a password
-
-$FreeBSD: src/usr.sbin/pc-sysinstall/examples/README,v 1.5 2010/10/09 08:52:09 imp Exp $
diff --git a/usr/sbin/pc-sysinstall/examples/pc-autoinstall.conf b/usr/sbin/pc-sysinstall/examples/pc-autoinstall.conf
deleted file mode 100644
index 260fc68..0000000
--- a/usr/sbin/pc-sysinstall/examples/pc-autoinstall.conf
+++ /dev/null
@@ -1,52 +0,0 @@
-# pc-autoinstall.conf example
-# $FreeBSD: src/usr.sbin/pc-sysinstall/examples/pc-autoinstall.conf,v 1.1 2010/06/24 22:21:47 imp Exp $
-#
-# Usage: Modify these variables, and copy the file to
-# /boot/pc-autoinstall.conf on your PC-BSD installation medium
-#
-# The conf will then be read at bootup, and your automated
-# install will take place
-##################################################################
-
-# Where the pc-sysinstall main config is located
-# Can be either a file on the booted CD / DVD / USB media,
-# or a remote file on http / ftp
-#
-# The value %%NIC_MAC%% is special, and will be substituted with
-# the macaddress of the enabled NIC from DHCP or manually set
-# with 'nic_config:'
-##################################################################
-
-# Examples:
-# pc_config: ftp://192.168.0.2/cust-install.cfg
-# pc_config: http://192.168.0.2/cust-install.cfg
-# pc_config: http://192.168.0.2/%%NIC_MAC%%.cfg
-# pc_config: /boot/cust-install.cfg
-
-# Set this to yes if we should confirm before doing an install
-# This should normally be set to yes, otherwise booting the wrong
-# disk will result in a system wipe
-# confirm_install: no
-confirm_install: yes
-
-# Set the command to run post-install, usually best to run shutdown
-# but this can be replaced with any other command / script you wish
-# to execute post-install
-# shutdown_cmd: shutdown -p now
-
-# Options for the network setup, should the cfg need to be fetched
-# from a remote location, only necessary when using ftp or http
-##################################################################
-
-# Special option, will attempt dhcp on all found NICs
-# until the file can be fetched, or we run out of interfaces
-# nic_config: dhcp-all
-
-# Line to be passed to the "ifconfig" command to bring up an interface
-# nic_config: em0 192.168.0.101 255.255.255.0
-
-# DNS server to use
-# nic_dns: 192.168.0.1
-
-# Default router / gateway
-# nic_gateway: 192.168.0.1
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall
deleted file mode 100644
index dad3be6..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall
+++ /dev/null
@@ -1,71 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=fresh
-installInteractive=yes
-hostname=pcbsd8
-
-# Set the disk parameters
-disk0=ad0
-partition=all
-bootManager=none
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-disk0-part=UFS 1000 /
-disk0-part=SWAP 2000 none
-disk0-part=UFS 0 /usr
-# Size 0 means use the rest of the slice size
-# Do it now!
-commitDiskLabel
-
-netDev=AUTO-DHCP
-#netDev=nfe0
-#netIP=192.168.0.49
-#netMask=255.255.255.0
-#netNameServer=208.67.222.222
-#netDefaultRouter=192.168.0.1
-
-netSaveDev=AUTO-DHCP
-#netSaveDev=nfe0
-#netSaveIP=192.168.0.49
-#netSaveMask=255.255.255.0
-#netSaveNameServer=208.67.222.222
-#netSaveDefaultRouter=192.168.0.1
-
-# Set if we are installing via optical, USB, or FTP
-#installType=PCBSD
-installType=FreeBSD
-#installMedium=dvd
-installMedium=ftp
-
-ftpPath=ftp://192.168.0.2/netinstall
-
-#packageType=uzip
-packageType=tar
-
-# List our components to install
-installComponents=ports,src
-
-# Setup user "kris" to log into the desktop automatically
-autoLoginUser=kris
-
-# Set the root pass
-rootPass=root
-
-# Setup our users
-userName=kris
-userComment=Kris Moore
-userPass=kris
-userShell=/bin/csh
-userHome=/home/kris
-userGroups=wheel,operator
-commitUser
-
-# Options for localizing an install
-localizeLang="ru"
-localizeKeyLayout="ru"
-localizeKeyModel="pc104"
-localizeKeyVariant="intl"
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.geli b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.geli
deleted file mode 100644
index b20a65d..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.geli
+++ /dev/null
@@ -1,50 +0,0 @@
-# Auto-Generated pc-sysinstall configuration
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.geli,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installInteractive=no
-installMode=fresh
-installType=FreeBSD
-packageType=tar
-installMedium=dvd
-netSaveDev=AUTO-DHCP
-
-# Timezone
-timeZone=America/New_York
-enableNTP=yes
-
-# Keyboard Layout Options
-localizeKeyModel=pc104
-localizeKeyLayout=us
-
-# Disk Setup for ad0
-disk0=ad0
-partition=ALL
-bootManager=none
-commitDiskPart
-
-# Partition Setup for ad0(ALL)
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk0-part=UFS 500 /boot
-disk0-part=UFS.eli 500 /
-disk0-part=UFS.eli 500 /usr
-encpass=mypass
-commitDiskLabel
-
-# Optional Components
-installComponents=
-
-# Root Password
-rootPass=mypass
-
-# Users
-userName=kris
-userComment=Kris Moore
-userPass=mypass
-userShell=/bin/csh
-userHome=/home/kris
-userGroups=wheel,operator
-autoLoginUser=kris
-commitUser
-
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror
deleted file mode 100644
index 6a20d23..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror
+++ /dev/null
@@ -1,45 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=fresh
-installInteractive=yes
-hostname=pcbsd8
-
-# Set the disk parameters
-disk0=ad0
-mirror=ad1
-mirrorbal=split
-partition=all
-bootManager=bsd
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-disk0-part=UFS+S 500 /
-disk0-part=SWAP 2000 none
-disk0-part=UFS+S 0 /usr
-# Size 0 means use the rest of the slice size
-# Do it now!
-commitDiskLabel
-
-# Set if we are installing via optical, USB, or FTP
-installType=FreeBSD
-installMedium=dvd
-
-#packageType=uzip
-packageType=tar
-#installComponents=ports,src
-
-# Run any commands post-install
-runCommand=echo 'root' | pw usermod root -h 0
-#runScript=/root/test.sh
-#runExtCommand=echo 'hey there'; touch $FSMNT/touched
-
-#autoLoginUser=kris
-
-# Options for localizing an install
-localizeLang="ru"
-localizeKeyLayout="ru"
-localizeKeyModel="pc104"
-localizeKeyVariant="intl"
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall
deleted file mode 100644
index a2c8222..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall
+++ /dev/null
@@ -1,68 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=fresh
-installInteractive=yes
-hostname=pcbsd8
-
-# Set the disk parameters
-disk0=ad0
-partition=all
-bootManager=none
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-disk0-part=UFS 1000 /
-disk0-part=SWAP 2000 none
-disk0-part=UFS 0 /usr
-# Size 0 means use the rest of the slice size
-# Do it now!
-commitDiskLabel
-
-netDev=AUTO-DHCP
-#netDev=nfe0
-#netIP=192.168.0.49
-#netMask=255.255.255.0
-#netNameServer=208.67.222.222
-#netDefaultRouter=192.168.0.1
-
-netSaveDev=AUTO-DHCP
-#netSaveDev=nfe0
-#netSaveIP=192.168.0.49
-#netSaveMask=255.255.255.0
-#netSaveNameServer=208.67.222.222
-#netSaveDefaultRouter=192.168.0.1
-
-# Set if we are installing via optical, USB, or FTP
-#installType=PCBSD
-installType=FreeBSD
-#installMedium=dvd
-installMedium=ftp
-
-ftpPath=ftp://192.168.0.2/netinstall
-
-#packageType=uzip
-packageType=tar
-#installComponents=ports,src
-
-#autoLoginUser=kris
-
-# Set the root pass
-rootPass=root
-
-# Setup our users
-userName=kris
-userComment=Kris Moore
-userPass=kris
-userShell=/bin/csh
-userHome=/home/kris
-userGroups=wheel,operator
-commitUser
-
-# Options for localizing an install
-localizeLang="ru"
-localizeKeyLayout="ru"
-localizeKeyModel="pc104"
-localizeKeyVariant="intl"
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.restore b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.restore
deleted file mode 100644
index c05bf05..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.restore
+++ /dev/null
@@ -1,57 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.restore,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=fresh
-installInteractive=no
-hostname=freebsd8
-
-# Set the disk parameters
-disk0=ad1
-partition=all
-bootManager=none
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk0-part=UFS+S 500 /
-disk0-part=SWAP.eli 2000 none
-disk0-part=UFS+S 0 /usr
-# Size 0 means use the rest of the slice size
-# Do it now!
-commitDiskLabel
-
-# Set if we are installing via optical, USB, or FTP
-installType=FreeBSD
-installMedium=dvd
-installFile=freebsd-release.tbz
-
-#packageType=uzip
-packageType=tar
-#installComponents=ports,src
-
-# Run any commands post-install
-#runCommand=echo 'root' | pw usermod root -h 0
-#runScript=/root/test.sh
-#runExtCommand=echo 'hey there'; touch $FSMNT/touched
-
-# Set the root pass
-rootPass=root
-
-# Setup our users
-userName=kris
-userComment=Kris Moore
-userPass=kris
-userShell=/bin/csh
-userHome=/home/kris
-userGroups=wheel,operator
-commitUser
-
-#autoLoginUser=kris
-
-# Options for localizing an install
-localizeLang="ru"
-localizeKeyLayout="ru"
-localizeKeyModel="pc104"
-localizeKeyVariant="intl"
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.rsync b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.rsync
deleted file mode 100644
index e6d7c6c..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.rsync
+++ /dev/null
@@ -1,45 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.rsync,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=fresh
-installInteractive=yes
-hostname=pcbsd8
-
-# Set the disk parameters
-disk0=ad0
-partition=all
-bootManager=none
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-disk0-part=UFS 2000 /
-disk0-part=SWAP 2000 none
-disk0-part=UFS 0 /usr
-# Size 0 means use the rest of the slice size
-# Do it now!
-commitDiskLabel
-
-netDev=AUTO-DHCP
-#netDev=nfe0
-#netIP=192.168.0.49
-#netMask=255.255.255.0
-#netNameServer=208.67.222.222
-#netDefaultRouter=192.168.0.1
-
-# Set if we are installing via optical, USB, or FTP
-#installType=PCBSD
-installType=FreeBSD
-#installMedium=dvd
-installMedium=rsync
-
-rsyncPath=life-preserver/back-2009-11-12T14_53_14
-rsyncUser=lifep
-rsyncHost=192.168.0.50
-rsyncPort=22
-
-#packageType=uzip
-packageType=tar
-#installComponents=ports,src
-
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade
deleted file mode 100644
index 754f05f..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade
+++ /dev/null
@@ -1,24 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade,v 1.1 2010/06/24 22:21:47 imp Exp $
-
-installMode=upgrade
-installInteractive=no
-hostname=freebsd8
-
-# Set the disk parameters
-disk0=ada0s1a
-bootManager=none
-commitDiskPart
-
-# Set if we are installing via optical, USB, or FTP
-installType=PCBSD
-installMedium=dvd
-
-packageType=uzip
-#installComponents=ports,src
-
-# Options for localizing an install
-localizeLang="ru"
-localizeKeyLayout="ru"
-localizeKeyModel="pc104"
-localizeKeyVariant="intl"
diff --git a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.zfs b/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.zfs
deleted file mode 100644
index 11dd38a..0000000
--- a/usr/sbin/pc-sysinstall/examples/pcinstall.cfg.zfs
+++ /dev/null
@@ -1,59 +0,0 @@
-# Auto-Generated pc-sysinstall configuration
-#$FreeBSD: src/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.zfs,v 1.1 2010/06/24 22:21:47 imp Exp $
-installInteractive=no
-installMode=fresh
-installType=FreeBSD
-packageType=tar
-installMedium=dvd
-netSaveDev=AUTO-DHCP
-
-# Timezone
-timeZone=America/New_York
-enableNTP=yes
-
-# Keyboard Layout Options
-localizeKeyModel=pc104
-localizeKeyLayout=us
-
-# Disk Setup for ad0
-disk0=ad0
-partition=ALL
-bootManager=none
-commitDiskPart
-
-# Partition Setup for ad0(ALL)
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk0-part=ZFS 0 /,/usr,/var,/data (mirror: ad1)
-commitDiskLabel
-
-# Disk Setup for ad3
-disk1=ad3
-partition=ALL
-bootManager=none
-commitDiskPart
-
-# Partition Setup for ad3(ALL)
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk1-part=SWAP 0 none
-commitDiskLabel
-
-# Optional Components
-installComponents=
-
-# Root Password
-rootPass=mypass
-
-# Users
-userName=kris
-userComment=Kris Moore
-userPass=mypass
-userShell=/bin/csh
-userHome=/home/kris
-userGroups=wheel,operator
-autoLoginUser=kris
-commitUser
-
diff --git a/usr/sbin/pc-sysinstall/examples/pfSense.cfg b/usr/sbin/pc-sysinstall/examples/pfSense.cfg
deleted file mode 100644
index d042954..0000000
--- a/usr/sbin/pc-sysinstall/examples/pfSense.cfg
+++ /dev/null
@@ -1,31 +0,0 @@
-# Sample configuration file for an installation using pc-sysinstall
-
-installMode=fresh
-installInteractive=yes
-installType=FreeBSD
-installMedium=LiveCD
-
-# Set the disk parameters
-disk0=ad0
-partition=all
-bootManager=bsd
-commitDiskPart
-
-# Setup the disk label
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# Size 0 means use the rest of the slice size
-disk0-part=SWAP 500 none
-disk1-part=UFS+S 0 /
-# Do it now!
-commitDiskLabel
-
-# Set if we are installing via optical, USB, or FTP
-installType=FreeBSD
-
-packageType=cpdup
-
-# Optional Components
-cpdupPaths=boot,COPYRIGHT,bin,conf,conf.default,dev,etc,home,kernels,libexec,lib,root,sbin,sys,usr,var
-
-runExtCommand=chmod a+rx /usr/local/bin/after_installation_routines.sh && cd / && /usr/local/bin/after_installation_routines.sh
diff --git a/usr/sbin/pc-sysinstall/examples/pfSense.cfg.zfs b/usr/sbin/pc-sysinstall/examples/pfSense.cfg.zfs
deleted file mode 100644
index c895206..0000000
--- a/usr/sbin/pc-sysinstall/examples/pfSense.cfg.zfs
+++ /dev/null
@@ -1,46 +0,0 @@
-# Auto-Generated pc-sysinstall configuration
-installInteractive=no
-installMode=fresh
-installType=FreeBSD
-installMedium=LiveCD
-packageType=cpdup
-
-# Timezone
-timeZone=Kentucky/Louisville
-
-# Keyboard Layout Options
-localizeKeyModel=pc104
-localizeKeyLayout=us
-
-# Disk Setup for ad0
-disk0=da0
-partition=ALL
-bootManager=none
-commitDiskPart
-
-# Partition Setup for da0(ALL)
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk0-part=SWAP 500 none
-disk1-part=ZFS+S 0 /
-
-commitDiskLabel
-
-# Disk Setup for da2
-disk1=da2
-partition=ALL
-bootManager=none
-commitDiskPart
-
-# Partition Setup for da2(ALL)
-# All sizes are expressed in MB
-# Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP
-# UFS.eli, UFS+S.eli, UFS+J.eli, ZFS.eli, SWAP.eli
-disk1-part=SWAP 0 none
-commitDiskLabel
-
-# Optional Components
-cpdupPaths=boot,COPYRIGHT,bin,conf,conf.default,dev,etc,home,kernels,libexec,lib,root,sbin,sys,usr,var
-
-runExtCommand=chmod a+rx /usr/local/bin/after_installation_routines.sh && cd / && /usr/local/bin/after_installation_routines.sh
diff --git a/usr/sbin/pc-sysinstall/pc-sysinstall/Makefile b/usr/sbin/pc-sysinstall/pc-sysinstall/Makefile
deleted file mode 100644
index 65abcc0..0000000
--- a/usr/sbin/pc-sysinstall/pc-sysinstall/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD: src/usr.sbin/pc-sysinstall/pc-sysinstall/Makefile,v 1.3 2010/06/27 17:14:04 imp Exp $
-
-SCRIPTS=pc-sysinstall.sh
-MAN= pc-sysinstall.8
-
-.include <bsd.prog.mk>
diff --git a/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 b/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8
deleted file mode 100644
index 2b42bbb..0000000
--- a/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 2010
-.\" iXsystems, Inc. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL Jordan Hubbard OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8,v 1.5 2010/10/08 12:40:16 uqs Exp $
-.\"
-.Dd June 24, 2010
-.Dt PC-SYSINSTALL 8
-.Os
-.Sh NAME
-.Nm pc-sysinstall
-.Nd System installer backend
-.Sh SYNOPSIS
-.Nm
-.Op Fl c Ar file
-.Op Ar command
-.Sh DESCRIPTION
-The
-.Nm
-utility is a hybrid backend for installing FreeBSD. When run in install mode
-it takes a configuration file and performs an installation according to the
-parameters specified in the configuration file. When called with one of
-the system query commands it provides information about the system to aid a
-front end in building an appropriate configuration file.
-.Pp
-The following options are available:
-.Bl -tag -width indent
-.It Fl c Ar file
-Perform an installation as directed by
-.Ar file.
-.El
-.Sh COMMANDS
-The
-.Cm command
-can be any one of the following:
-.Bl -tag -width indent
-.It help
-Display a list of all commands.
-.It help Ar command
-Display the help data for the specified command.
-.It disk-list
-Provide a listing of the storage devices detected on this system.
-.It disk-part Ar disk
-Queries the specified storage device and returns information about its
-partitions.
-.It disk-info Ar disk
-Returns information about a storage device's size, cylinders, heads, and
-sectors.
-.It detect-laptop
-Tests to see if this system is a laptop or desktop.
-.It detect-emulation
-Tests to see if this system is running in an emulator
-.It detect-nics
-Returns a listing of the detected network cards on this system.
-.It list-components
-Returns a listing of the available components which can be installed.
-.It list-rsync-backups Ar user Ar host Ar port
-Returns a listing of available rsync-backups on the target server in the
-life-preserver/ directory.
-.It list-tzones
-Returns a listing of available timezones.
-.It query-langs
-Returns a list of languages that the installer supports.
-.It sys-mem
-Returns the size of installed system RAM in MegaBytes.
-.It test-netup
-test if an internet connection is available.
-.It update-part-list
-Returns a list of PC-BSD and FreeBSD installs on this system for updates.
-.It xkeyboard-layouts
-Returns a list of keyboard layouts that xorg supports.
-.It xkeyboard-models
-Returns a list of keyboard models that xorg supports.
-.It xkeyboard-variants
-Returns a list of keyboard variants that xorg supports.
-.It create-part Ar disk Ar size
-Create a new MBR primary slice on the target disk using size MB.
-.It delete-part Ar partition
-Delete the disk partition specified. If this is the last partition, the
-disk partition layout will also be scrubbed, leaving a clean disk ready
-for MBR or GPT file system layouts.
-.It start-autoinstall Ar file
-Start an automated installation with the specified file. Normally only
-used by automated install scripts.
-.It setup-ssh-keys Ar user Ar host Ar port
-Setup SSH without a password for the target host, user, and port. Used to
-prompt the user to log into a server before doing a rsync + ssh restore.
-.El
-.Sh HISTORY
-This version of
-.Nm
-first appeared in
-.Fx 9.0 .
-.Sh AUTHORS
-.An Kris Moore Aq kmoore@FreeBSD.org
-.Sh BUGS
-This utility was written to install PC-BSD and has seen limited use as an
-installer for FreeBSD. It's likely that usage to install FreeBSD will expose
-edge cases that PC-BSD doesn't, as well as generate feature requests based
-on unforeseen needs.
diff --git a/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh b/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh
deleted file mode 100755
index 9f91e85..0000000
--- a/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh
+++ /dev/null
@@ -1,240 +0,0 @@
-#!/bin/sh
-#####################################################################
-# Author: Kris Moore
-# License: BSD
-# Description: pc-sysinstall provides a backend for performing
-# system installations, as well as calls which a front-end can use
-# to retrive information about the system
-#####################################################################
-# Copyright 2010 iXsystems
-# All rights reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted providing that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# $FreeBSD: src/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh,v 1.11 2010/09/08 20:10:24 imp Exp $
-#####################################################################
-
-# User-editable configuration variables
-
-# Set this to the program location
-if [ -z "${PROGDIR}" ]
-then
- PROGDIR="/usr/sbin/pc-sysinstall"
- export PROGDIR
-fi
-
-# Set this to the components location
-COMPDIR="${PROGDIR}/components"
-export COMPDIR
-
-CONFDIR="${PROGDIR}/conf"
-export CONFDIR
-
-# Set this to the packages location
-PKGDIR="${CONFDIR}"
-export PKGDIR
-
-# End of user-editable configuration
-#####################################################################
-
-# Set our QUERYDIR
-QUERYDIR="${PROGDIR}/backend-query"
-export QUERYDIR
-
-# Set our BACKEND
-BACKEND="${PROGDIR}/backend"
-export BACKEND
-
-PARTMANAGERDIR="${PROGDIR}/backend-partmanager"
-export PARTMANAGERDIR
-
-# Start by sourcing our conf file
-if [ -e "${PROGDIR}/conf/pc-sysinstall.conf" ]
-then
- . ${PROGDIR}/conf/pc-sysinstall.conf
-else
- echo "ERROR: Could not find ${PROGDIR}/conf/pc-sysinstall.conf"
- exit 1
-fi
-
-# Now source our functions.sh
-if [ -e "${PROGDIR}/backend/functions.sh" ]
-then
- . ${PROGDIR}/backend/functions.sh
-else
- echo "ERROR: Could not find ${PROGDIR}/backend/functions.sh"
- exit 1
-fi
-
-
-# Check if we are called without any flags and display help
-if [ -z "${1}" ]
-then
- # Display the help index
- display_help
- exit 0
-fi
-
-case $1 in
- # The -c flag has been given, time to parse the script
- -c)
- if [ -z "${2}" ]
- then
- display_help
- else
- ${BACKEND}/parseconfig.sh ${2}
- exit $?
- fi
- ;;
-
- # The user requsted help
- help)
- if [ -z "${2}" ]
- then
- display_help
- else
- display_command_help ${2}
- fi
- ;;
-
- # Install an image file to a device
- install-image) ${BACKEND}/installimage.sh "${2}" "${3}"
- ;;
-
- # Parse an auto-install directive, and begin the installation
- start-autoinstall) ${BACKEND}/startautoinstall.sh ${2}
- ;;
-
- # The user is wanting to create a new partition
- create-part) ${PARTMANAGERDIR}/create-part.sh "${2}" "${3}"
- ;;
-
- # The user is wanting to delete an existing partition
- delete-part) ${PARTMANAGERDIR}/delete-part.sh "${2}"
- ;;
-
- # The user is wanting to check if we are on a laptop or desktop
- detect-laptop) ${QUERYDIR}/detect-laptop.sh
- ;;
-
- # The user is wanting to see what nics are available on the system
- detect-nics) ${QUERYDIR}/detect-nics.sh
- ;;
-
- # The user is wanting to check if we are in emulation
- detect-emulation) ${QUERYDIR}/detect-emulation.sh
- ;;
-
- # The user is wanting to query a disk's information
- disk-info) ${QUERYDIR}/disk-info.sh ${2}
- ;;
-
- # The user is wanting to query which disks are available
- disk-list) ${QUERYDIR}/disk-list.sh $*
- ;;
-
- # The user is wanting to query a disk's partitions
- disk-part) ${QUERYDIR}/disk-part.sh ${2}
- ;;
-
- # Function allows the setting of networking by a calling front-end
- enable-net) ${QUERYDIR}/enable-net.sh "${2}" "${3}" "${4}" "${5}" "${6}" "${7}"
- ;;
-
- # Function which lists components available
- list-components) ${QUERYDIR}/list-components.sh
- ;;
-
- # Function which lists pc-sysinstall configuration
- list-config) ${QUERYDIR}/list-config.sh
- ;;
-
- # Function which lists available FTP mirrors
- list-mirrors) ${QUERYDIR}/list-mirrors.sh "${2}"
- ;;
-
- # Function which lists available packages
- list-packages) ${QUERYDIR}/list-packages.sh "${2}" "${3}"
- ;;
-
- # Function which lists available backups on a rsync/ssh server
- list-rsync-backups) ${QUERYDIR}/list-rsync-backups.sh "${2}" "${3}" "${4}"
- ;;
-
- # Function which lists timezones available
- list-tzones) ${QUERYDIR}/list-tzones.sh
- ;;
-
- # Requested a list of languages this install will support
- query-langs) ${QUERYDIR}/query-langs.sh
- ;;
-
- # Function which creates a error report, and mails it to the specified address
- send-logs) ${QUERYDIR}/send-logs.sh ${2}
- ;;
-
- # Function to get package index
- get-packages) ${QUERYDIR}/get-packages.sh "${2}"
- ;;
-
- # Function to set FTP mirror
- set-mirror) ${QUERYDIR}/set-mirror.sh "${2}"
- ;;
-
- # Function which allows setting up of SSH keys
- setup-ssh-keys) ${QUERYDIR}/setup-ssh-keys.sh "${2}" "${3}" "${4}"
- ;;
-
- # Function which lists the real memory of the system in MB
- sys-mem) ${QUERYDIR}/sys-mem.sh
- ;;
-
- # Run script which determines if we are booted from install media, or on disk
- test-live) ${QUERYDIR}/test-live.sh
- ;;
-
- # The user is wanting to test if the network is up and working
- test-netup) ${QUERYDIR}/test-netup.sh
- ;;
-
- # The user is wanting to get a list of partitions available to be updated / repaired
- update-part-list) ${QUERYDIR}/update-part-list.sh
- ;;
-
- # Requested a list of keyboard layouts that xorg supports
- xkeyboard-layouts) ${QUERYDIR}/xkeyboard-layouts.sh
- ;;
-
- # Requested a list of keyboard models that xorg supports
- xkeyboard-models) ${QUERYDIR}/xkeyboard-models.sh
- ;;
-
- # Requested a list of keyboard variants that xorg supports
- xkeyboard-variants) ${QUERYDIR}/xkeyboard-variants.sh
- ;;
-
- *) echo "Unknown Command: ${1}"
- exit 1 ;;
-esac
-
-# Exit with success if we made it to the end
-exit $?
OpenPOWER on IntegriCloud