git: 6558c2506990 - main - sysutils/nut*: Make nut file ownership fixes optional with default enabled
Date: Tue, 14 Feb 2023 18:40:30 UTC
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=6558c25069901328610d155bea362aeb7ab00f17 commit 6558c25069901328610d155bea362aeb7ab00f17 Author: Cy Schubert <cy@FreeBSD.org> AuthorDate: 2023-02-13 18:57:30 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-02-14 18:40:00 +0000 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 --- UPDATING | 10 ++++++++++ sysutils/nut-devel/Makefile | 4 ++-- sysutils/nut-devel/files/nut.in | 11 +++++++---- sysutils/nut/Makefile | 4 ++-- sysutils/nut/files/nut.in | 11 +++++++---- 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 }