aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-02-13 18:57:30 +0000
committerCy Schubert <cy@FreeBSD.org>2023-02-14 18:40:00 +0000
commit6558c25069901328610d155bea362aeb7ab00f17 (patch)
tree8e0f9a8c87ec8da9b354bcbd5d6c6968621f7128
parent6beccad94e454e521402d9958bf03d665cb601ab (diff)
sysutils/nut*: Make nut file ownership fixes optional with default enabled
The nut file ownership fixups due to the UID/GID change from uucp/uucp to nut/nut may not be desireable for all users. Some users with custom file ownership may wish ownership to remain untouched. This revision to the nut family of ports/packages allows users to optionally disable automatic fixup of nut file ownership. While at it, rather than use a hardcoded string for user/group ownerships, use the set parameters in Makefile. PR: 269497 suggested by: dvl
-rw-r--r--UPDATING10
-rw-r--r--sysutils/nut-devel/Makefile4
-rw-r--r--sysutils/nut-devel/files/nut.in11
-rw-r--r--sysutils/nut/Makefile4
-rw-r--r--sysutils/nut/files/nut.in11
5 files changed, 28 insertions, 12 deletions
diff --git a/UPDATING b/UPDATING
index 97843ae46b90..29ea2165e7e7 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,16 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
+20230313:
+ Affects: users of sysutils/nut*
+ AUTHOR: cy@FreeBSD.org
+
+ The nut file ownership fixups due to the UID/GID change from uucp/uucp
+ to nut/nut may not be desireable for all users. Some users with custom
+ file ownership may wish ownership to remain untouched. This revision
+ to the nut family of ports/packages allows users to optionally disable
+ automatic fixup of nut file ownership.
+
20230213:
AFFECTS: users of security/logcheck
AUTHOR: yasu@FreeBSD.org
diff --git a/sysutils/nut-devel/Makefile b/sysutils/nut-devel/Makefile
index 225b9ff4d86f..897c6440da75 100644
--- a/sysutils/nut-devel/Makefile
+++ b/sysutils/nut-devel/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nut
PORTVERSION= ${NUT_COMMIT_DATE}
-PORTREVISION= 4
+PORTREVISION= 6
CATEGORIES= sysutils
PKGNAMESUFFIX= -devel
# MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/
@@ -60,7 +60,7 @@ IPMIPSU_DESC= Use nut-ipmipsu support (experimental)
SSL_OFF_DESC= No SSL support
USE_RC_SUBR= nut nut_upsmon nut_upslog
-SUB_LIST+= STATEDIR=${STATEDIR} NUT_GROUP=${NUT_GROUP}
+SUB_LIST+= STATEDIR=${STATEDIR} NUT_USER=${NUT_USER} NUT_GROUP=${NUT_GROUP}
PLIST_SUB+= STATEDIR=${STATEDIR}
PORTDOCS= *
diff --git a/sysutils/nut-devel/files/nut.in b/sysutils/nut-devel/files/nut.in
index ae9ee30f03f5..c9a86debbe32 100644
--- a/sysutils/nut-devel/files/nut.in
+++ b/sysutils/nut-devel/files/nut.in
@@ -31,17 +31,20 @@ pidfile="%%STATEDIR%%/upsd.pid"
start_precmd="nut_prestart"
stop_postcmd="nut_poststop"
+nut_file_fixup=${nut_file_fixup:-"YES"}
+
nut_prestart() {
#
# As of PR/268960 UID/GID uucp is no longer used by nut.
# Instead UID/GID nut is used. Make sure preexisting nut files
# and directories are owned by nut instead of uucp.
#
- if [ -f ${nut_prefix}/etc/nut/upsd.users ]; then
- chgrp %%NUT_GROUP%% ${nut_prefix}/etc/nut/upsd.users
+ if [ "${nut_file_fixup}" == "YES" ]
+ find ${nut_prefix}/etc/nut -user uucp -exec chown %%NUT_USER%% {} \;
+ find ${nut_prefix}/etc/nut -group uucp -exec chgrp %%NUT_GROUP%% {} \;
+ find %%STATEDIR%% -user uucp -exec chown %%NUT_USER%% {} \;
+ find %%STATEDIR%% -group uucp -exec chgrp %%NUT_GROUP%% {} \;
fi
- find %%STATEDIR%% -user uucp -exec chown nut {} \;
- find %%STATEDIR%% -group uucp -exec chgrp nut {} \;
${nut_prefix}/sbin/upsdrvctl start
}
diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile
index 9a45bc5d7d1e..e017bc4e69af 100644
--- a/sysutils/nut/Makefile
+++ b/sysutils/nut/Makefile
@@ -1,6 +1,6 @@
PORTNAME= nut
PORTVERSION= 2.8.0
-PORTREVISION= 19
+PORTREVISION= 21
CATEGORIES= sysutils
MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/
@@ -50,7 +50,7 @@ IPMIPSU_DESC= Use nut-ipmipsu support (experimental)
SSL_OFF_DESC= No SSL support
USE_RC_SUBR= nut nut_upsmon nut_upslog
-SUB_LIST+= STATEDIR=${STATEDIR} NUT_GROUP=${NUT_GROUP}
+SUB_LIST+= STATEDIR=${STATEDIR} NUT_USER=${NUT_USER} NUT_GROUP=${NUT_GROUP}
PLIST_SUB+= STATEDIR=${STATEDIR}
PORTDOCS= *
diff --git a/sysutils/nut/files/nut.in b/sysutils/nut/files/nut.in
index ae9ee30f03f5..c9a86debbe32 100644
--- a/sysutils/nut/files/nut.in
+++ b/sysutils/nut/files/nut.in
@@ -31,17 +31,20 @@ pidfile="%%STATEDIR%%/upsd.pid"
start_precmd="nut_prestart"
stop_postcmd="nut_poststop"
+nut_file_fixup=${nut_file_fixup:-"YES"}
+
nut_prestart() {
#
# As of PR/268960 UID/GID uucp is no longer used by nut.
# Instead UID/GID nut is used. Make sure preexisting nut files
# and directories are owned by nut instead of uucp.
#
- if [ -f ${nut_prefix}/etc/nut/upsd.users ]; then
- chgrp %%NUT_GROUP%% ${nut_prefix}/etc/nut/upsd.users
+ if [ "${nut_file_fixup}" == "YES" ]
+ find ${nut_prefix}/etc/nut -user uucp -exec chown %%NUT_USER%% {} \;
+ find ${nut_prefix}/etc/nut -group uucp -exec chgrp %%NUT_GROUP%% {} \;
+ find %%STATEDIR%% -user uucp -exec chown %%NUT_USER%% {} \;
+ find %%STATEDIR%% -group uucp -exec chgrp %%NUT_GROUP%% {} \;
fi
- find %%STATEDIR%% -user uucp -exec chown nut {} \;
- find %%STATEDIR%% -group uucp -exec chgrp nut {} \;
${nut_prefix}/sbin/upsdrvctl start
}