diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-12-24 09:08:40 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-12-24 09:08:40 -0200 |
commit | 63881e2114fc597d2f940d630d902c4801b6b9e0 (patch) | |
tree | a82d30dd52fa70d36e87528cf3e2835b360b9d4a /config | |
parent | d0ec034cd9260656f7bc3506b68c78c9ee1b6235 (diff) | |
download | pfsense-packages-63881e2114fc597d2f940d630d902c4801b6b9e0.tar.gz pfsense-packages-63881e2114fc597d2f940d630d902c4801b6b9e0.tar.bz2 pfsense-packages-63881e2114fc597d2f940d630d902c4801b6b9e0.zip |
Use proper binary on 2.2, based on patch submitted by Denny Page. Fixes #4118
Diffstat (limited to 'config')
-rw-r--r-- | config/nut/nut.inc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/config/nut/nut.inc b/config/nut/nut.inc index 11fb4b26..5a61d41a 100644 --- a/config/nut/nut.inc +++ b/config/nut/nut.inc @@ -35,7 +35,8 @@ define('NUT_RCFILE', '/usr/local/etc/rc.d/nut.sh'); - if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") { + $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); + if ($pfs_version == "2.0") { define('NUT_DIR','/usr/local/etc/nut'); } else { define('NUT_DIR', '/usr/pbi/nut-' . php_uname("m") . '/etc/nut'); @@ -222,6 +223,8 @@ EOD; } function sync_package_nut_local() { + global $pfs_version; + $name = nut_config('name'); $driver = nut_config_sub('driver', 2); $port = nut_config('port'); @@ -278,6 +281,11 @@ EOD; $upsd_users .= "upsmon master\n"; } + if ($pfs_version == "2.1") + $upsdrvctl = "/usr/local/libexec/nut/upsdrvctl"; + else + $upsdrvctl = "/usr/local/sbin/upsdrvctl"; + /* upsmon.conf */ $upsmon_conf = <<<EOD MONITOR {$name}@localhost 1 monuser {$password} master @@ -300,7 +308,7 @@ EOD; fi if [ `pgrep {$driver} | wc -l` != 0 ]; then echo stopping {$driver} - /usr/local/libexec/nut/upsdrvctl stop + {$upsdrvctl} stop fi sleep 1 if [ `pgrep {$driver} | wc -l` != 0 ]; then @@ -319,7 +327,7 @@ if [ `pgrep {$driver} | wc -l` != 0 ]; then fi {$port_set} echo starting {$driver} - if /usr/local/libexec/nut/upsdrvctl start; then + if {$upsdrvctl} start; then echo starting upsd /usr/local/sbin/upsd {$ovr_user} echo starting upsmon @@ -394,6 +402,11 @@ EOD; $upsd_users .= "upsmon master\n"; } + if ($pfs_version == "2.1") + $upsdrvctl = "/usr/local/libexec/nut/upsdrvctl"; + else + $upsdrvctl = "/usr/local/sbin/upsdrvctl"; + /* upsmon.conf */ $upsmon_conf = <<<EOD MONITOR {$name}@localhost 1 monuser {$password} master @@ -416,7 +429,7 @@ EOD; fi if [ `pgrep {$driver} | wc -l` != 0 ]; then echo stopping {$driver} - /usr/local/libexec/nut/upsdrvctl stop + {$upsdrvctl} stop fi sleep 1 if [ `pgrep {$driver} | wc -l` != 0 ]; then @@ -435,7 +448,7 @@ if [ `pgrep {$driver} | wc -l` != 0 ]; then fi {$port_set} echo starting {$driver} - if /usr/local/libexec/nut/upsdrvctl start; then + if {$upsdrvctl} start; then echo starting upsd /usr/local/sbin/upsd {$ovr_user} echo starting upsmon |