mirror of
https://git.FreeBSD.org/ports.git
synced 2024-10-18 19:49:40 +00:00
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
This commit is contained in:
parent
6beccad94e
commit
6558c25069
10
UPDATING
10
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
|
||||
|
@ -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= *
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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= *
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user