Skip to content

Instantly share code, notes, and snippets.

@skarllot
Last active August 29, 2015 14:15
Show Gist options
  • Save skarllot/8075c1de50c215919351 to your computer and use it in GitHub Desktop.
Save skarllot/8075c1de50c215919351 to your computer and use it in GitHub Desktop.
pfSense patch files
diff --git a/etc/rc.carpbackup b/etc/rc.carpbackup
index 76cdfac..73ed0d7 100755
--- a/etc/rc.carpbackup
+++ b/etc/rc.carpbackup
@@ -50,5 +50,9 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'
}
}
+if (file_exists("/usr/local/etc/rc.d/quagga.sh")) {
+ // used to sleep(10); here, as apparently it worked around some issue w/2.0. w/2.1, it breaks things on systems with a significant number of CARP IPs.
+ mwexec_bg("/usr/local/etc/rc.d/quagga.sh stop");
+}
?>
\ No newline at end of file
diff --git a/etc/rc.carpmaster b/etc/rc.carpmaster
index cb5395e..df0101f 100755
--- a/etc/rc.carpmaster
+++ b/etc/rc.carpmaster
@@ -50,4 +50,7 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'
}
}
+if (file_exists("/usr/local/etc/rc.d/quagga.sh"))
+ mwexec_bg("/usr/local/etc/rc.d/quagga.sh start");
+
?>
\ No newline at end of file
diff --git a/etc/rc.start_packages b/etc/rc.start_packages
index bfeb776..9cf2dfe 100755
--- a/etc/rc.start_packages
+++ b/etc/rc.start_packages
@@ -41,6 +41,25 @@ require_once("service-utils.inc");
log_error("Restarting/Starting all packages.");
setup_library_paths();
+global $g;
+if (!file_exists("{$g['varrun_path']}/booting") && !isset($g['booting'])) {
+ $no_restart_packages = array("bgp", "ospf", "quagga", "zebra", "bird", "routed");
+} else {
+ $no_restart_packages = array();
+}
+
+function skip_restart($name) {
+ global $no_restart_packages;
+ foreach($no_restart_packages as $nrp_name) {
+ if (stripos($name, $nrp_name) === FALSE) {
+ continue;
+ } else {
+ return true;
+ }
+ }
+ return false;
+}
+
$rcfiles = glob(RCFILEPREFIX . "*.sh");
if (!$rcfiles)
$rcfiles = array();
@@ -52,6 +71,10 @@ else {
if (is_array($config['installedpackages']['package'])) {
foreach($config['installedpackages']['package'] as $package) {
+ if (skip_restart($package['name'])) {
+ echo "Not restarting package on skip list: {$package['name']}\n";
+ continue;
+ }
echo " Starting package {$package['name']}...";
sync_package($package['name']);
$internal_name = get_pkg_internal_name($package);
@@ -64,6 +87,10 @@ if (is_array($config['installedpackages']['package'])) {
$shell = @popen("/bin/sh", "w");
if ($shell) {
foreach ($rcfiles as $rcfile => $number) {
+ if (skip_restart($rcfile)) {
+ echo "Not restarting script on skip list: {$rcfile}\n";
+ continue;
+ }
echo " Starting {$rcfile}...";
fwrite($shell, "{$rcfile} start >>/tmp/bootup_messages 2>&1 &");
echo "done.\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment