Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nut upgrade 8.0 #1175

Merged
merged 4 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions sysutils/pfSense-pkg-nut/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-nut
PORTVERSION= 2.7.4
PORTREVISION= 10
PORTVERSION= 2.8.0
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
5 changes: 1 addition & 4 deletions sysutils/pfSense-pkg-nut/files/usr/local/pkg/nut.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
]]>
</copyright>
<name>nut</name>
<version>2.7.4_1</version>
<version>2.8.0_4</version>
<title>Services: UPS</title>
<savetext>Change</savetext>
<include_file>/usr/local/pkg/nut/nut.inc</include_file>
Expand All @@ -47,9 +47,6 @@
<custom_php_resync_config_command>
nut_sync_config();
</custom_php_resync_config_command>
<custom_php_install_command>
nut_install_command();
</custom_php_install_command>
<custom_php_pre_deinstall_command>
nut_deinstall_command();
</custom_php_pre_deinstall_command>
Expand Down
24 changes: 4 additions & 20 deletions sysutils/pfSense-pkg-nut/files/usr/local/pkg/nut/nut.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function nut_sync_config() {
stop_service('nut');
}

$nut_config = &$config['installedpackages']['nut']['config'][0];
if (isset($nut_config['type'])) {
$nut_config = config_get_path('installedpackages/nut/config/0', []);
if (!empty($nut_config) && isset($nut_config['type'])) {
$type = $nut_config['type'];
} else {
$type = 'disabled';
Expand Down Expand Up @@ -303,8 +303,8 @@ function nut_ups_status()
global $config;
$status = array();

$nut_config = &$config['installedpackages']['nut']['config'][0];
if (isset($nut_config['type'])) {
$nut_config = config_get_path('installedpackages/nut/config/0', []);
if (!empty($nut_config) && isset($nut_config['type'])) {
$type = $nut_config['type'];
} else {
$type = 'disabled';
Expand Down Expand Up @@ -449,22 +449,6 @@ function nut_ups_status()
}


function nut_install_command() {
global $config;

/* Remove obsolete menu entry */
$menus =& $config['installedpackages']['menu'];
if (is_array($config['installedpackages']['menu'])) {
foreach ($menus as $key => $menu) {
if ($menu['name'] == 'NUT') {
unset($menus[$key]);
break;
}
}
}
}


function nut_deinstall_command() {
if (is_service_running('nut')) {
log_error("Stopping service nut");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@
$message .= "\n\n";
$message .= implode(' ', array_slice($argv, 1));

send_smtp_message($message, $subject);

@notify_all_remote($subject . " - " . $message);
9 changes: 3 additions & 6 deletions sysutils/pfSense-pkg-nut/files/usr/local/www/nut_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
require("guiconfig.inc");
require("/usr/local/pkg/nut/nut.inc");

if (!is_array($config['installedpackages']['nut']['config'])) {
$config['installedpackages']['nut']['config'] = array();
}
$a_nut = &$config['installedpackages']['nut']['config'][0];
$a_nut = config_get_path('installedpackages/nut/config/0', []);

if (isset($a_nut)) {
if (!empty($a_nut)) {
if (isset($a_nut['type'])) {
$pconfig = $a_nut;
$pconfig['extra_args'] = base64_decode($pconfig['extra_args']);
Expand Down Expand Up @@ -251,7 +248,7 @@
$nut['upsd_users'] = base64_encode(trim(str_replace("\r\n", "\n", $pconfig['upsd_users'])));
}

$a_nut = $nut;
config_set_path('installedpackages/nut/config/0', $nut);
write_config("Updated UPS settings");

nut_sync_config();
Expand Down