aboutsummaryrefslogtreecommitdiffstats
path: root/packages/nut
diff options
context:
space:
mode:
authorRyan Wagoner <rsw686@pfsense.org>2007-03-17 22:49:11 +0000
committerRyan Wagoner <rsw686@pfsense.org>2007-03-17 22:49:11 +0000
commit3ea39b9914e3410d524e323f7ba9338de5d9a599 (patch)
tree2a96d16b6b1f17444a2109fb8ef0d22cdb234db8 /packages/nut
parentabe04fa30307b2d659364d477d2ae9637334ab43 (diff)
downloadpfsense-packages-3ea39b9914e3410d524e323f7ba9338de5d9a599.tar.gz
pfsense-packages-3ea39b9914e3410d524e323f7ba9338de5d9a599.tar.bz2
pfsense-packages-3ea39b9914e3410d524e323f7ba9338de5d9a599.zip
-set serial port permissions in rc file so nut will start upon reboot
Diffstat (limited to 'packages/nut')
-rw-r--r--packages/nut/nut.inc27
1 files changed, 8 insertions, 19 deletions
diff --git a/packages/nut/nut.inc b/packages/nut/nut.inc
index d9097788..5050e9e0 100644
--- a/packages/nut/nut.inc
+++ b/packages/nut/nut.inc
@@ -153,20 +153,6 @@
if($post['allowaddr'] && !nut_validate_ip($post['allowaddr'],true))
$input_errors[] = 'You must specify a valid address \'Local Remote Access Address\' field';
}
-
- /* this is run before the config file changed */
- /* so we can unassign the existing port */
- if(nut_config('monitor') == 'local' && count($input_errors) == 0) {
- $port = nut_config('port');
- $driver = nut_config_sub('driver', 2);
-
- if($port && $driver) {
- nut_action('stop');
-
- if($port != 'auto')
- chown($port, 'root');
- }
- }
}
function deinstall_package_nut() {
@@ -179,9 +165,6 @@
@unlink(NUT_DIR.'/upsd.users');
exec('rm -rf /var/db/nut');
-
- /*exec("pkg_delete nut-usb-2.0.5");
- exec("pkg_delete nut-2.0.5");*/
}
function sync_package_nut_remote() {
@@ -247,10 +230,14 @@ EOD;
chgrp('/var/spool/lock', 'dialer');
}
- if($port != 'auto')
- chown($port, 'uucp');
+ /* determine permissions for port */
+ if($port != 'auto') {
+ $port_rel = "chown root {$port}";
+ $port_set = "chown uucp {$port}";
+ }
/* ups.conf */
+ /* for usb ups run as root */
if($port == 'auto') {
$ups_conf = "user=root\n";
$ovr_user = '-u root';
@@ -317,12 +304,14 @@ EOD;
sleep 1
done
fi
+ {$port_rel}
EOD;
$start = <<<EOD
if [ `pgrep {$driver} | wc -l` != 0 ]; then
{$stop}
fi
+ {$port_set}
echo starting {$driver}
if /usr/local/libexec/nut/upsdrvctl start; then
echo starting upsd