diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-06-08 17:07:05 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-06-08 17:07:05 -0400 |
commit | 0c858a2798e4ff467f6bd8b6c76b5695359ade0f (patch) | |
tree | bbca37b191ded3fd935f41097b13c61879b88bc9 /config/openospfd/openospfd.inc | |
parent | 29ed129e8269c08af91cdb2f106cee936a5ae596 (diff) | |
download | pfsense-packages-0c858a2798e4ff467f6bd8b6c76b5695359ade0f.tar.gz pfsense-packages-0c858a2798e4ff467f6bd8b6c76b5695359ade0f.tar.bz2 pfsense-packages-0c858a2798e4ff467f6bd8b6c76b5695359ade0f.zip |
Rework script a bit. Use write_rcfile(). Add logic that was only in php to shell script
Diffstat (limited to 'config/openospfd/openospfd.inc')
-rw-r--r-- | config/openospfd/openospfd.inc | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/config/openospfd/openospfd.inc b/config/openospfd/openospfd.inc index 0a5ef351..332c671e 100644 --- a/config/openospfd/openospfd.inc +++ b/config/openospfd/openospfd.inc @@ -166,30 +166,31 @@ function ospfd_install_conf() { fclose($fd); // Create rc.d file - $fd = fopen("/usr/local/etc/rc.d/ospfd.sh","w"); - fwrite($fd, "#!/bin/sh\n\n"); - fwrite($fd, "# This file was created by the pfSense package manager. Do not edit!\n\n"); - fwrite($fd, "/usr/local/sbin/ospfd -f /usr/local/etc/ospfd.conf\n"); - fclose($fd); + $rc_file_stop = "killall ospfd"; + $rc_file_start = <<<EOF +/usr/local/sbin/ospfctl reload +if [ "$0" != "0" ]; then + /bin/pkill -x ospfd + /usr/local/sbin/ospfd -f /usr/local/etc/ospfd.conf +fi + +EOF; + write_rcfile(array( + "file" => "ospfd.sh", + "start" => $rc_file_start, + "stop" => $rc_file_stop + ) + ); + + // Ensure files have correct permissions exec("chmod a+rx /usr/local/etc/rc.d/ospfd.sh"); exec("chmod a-rw /usr/local/etc/ospfd.conf"); exec("chmod u+rw /usr/local/etc/ospfd.conf"); - - // ospfd process running? if so reload, elsewise start. - $oarray = array(); - $rval = 0; - exec("/usr/local/sbin/ospfctl reload", $oarray, $rval); - if ($rval != 0) { - /* - * ospfd isnt actually running as nothing accepted a connection - * on the /var/run/ospfd.sock unix socket by ospfctl, this is - * just to ensure a clean state. Killing a live ospfd would be bad. - */ - exec("/bin/pkill -x ospfd"); - // start ospfd - exec("/usr/local/sbin/ospfd -f /usr/local/etc/ospfd.conf"); - } - + + // Kick off newly created rc.d script + exec("/usr/local/etc/rc.d/ospfd.sh start"); + + // Back to RO mount for NanoBSD and friends conf_mount_ro(); } @@ -239,4 +240,5 @@ function ospfd_put_raw_config($conffile) { $config['installedpackages']['ospfd']['rawconfig'] = $conffile; } } -?> + +?>
\ No newline at end of file |