On 2011/11/21 09:42, Marc Espie wrote:
> CVSROOT:      /cvs
> Module name:  ports
> Changes by:   [email protected]   2011/11/21 09:42:53
> 
> Modified files:
>       infrastructure/mk: bsd.port.mk 
> 
> Log message:
> BASESYSCONFDIR points to /etc (global user settings), and SYSCONFDIR
> is derived from it.
> old march discussion, prodded by fgs@ about it.
> 

So something like this should be alright now. (There are other
ports that can be cleaned up too, but this one came to mind).

Kirill, can you check that apcupsd still works for you with
this diff please?

espie, OK with you? The addition to SUBST_VARS here is because
of MESSAGE-cgi.



Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile    20 Sep 2011 11:26:14 -0000      1.14
+++ Makefile    23 Nov 2011 00:09:46 -0000
@@ -8,6 +8,9 @@ DISTNAME =              apcupsd-3.14.10
 PKGNAME-main =         ${DISTNAME}
 PKGNAME-cgi =          ${DISTNAME:S/-/-cgi-/}
 PKGNAME-x11 =          ${DISTNAME:S/-/-x11-/}
+REVISION-main =                0
+REVISION-cgi =         0
+REVISION-x11 =         0
 
 CATEGORIES =           sysutils
 
@@ -27,17 +30,17 @@ WANTLIB-main =              c pthread
 
 MASTER_SITES =         ${MASTER_SITE_SOURCEFORGE:=apcupsd/}
 
-CONFIGURE_STYLE =      gnu old # old prevents overriding sysconfdir
+CONFIGURE_STYLE =      gnu
 USE_GMAKE =            Yes
 NO_REGRESS =           Yes
 MAKE_FLAGS =           VERBOSE=2
 
 WEB_ROOT =             /var/www
-SUBST_VARS +=          WEB_ROOT
+SUBST_VARS +=          WEB_ROOT ^BASESYSCONFDIR
+SYSCONFDIR =           ${BASESYSCONFDIR}/apcupsd
 
 CONFIGURE_ARGS =       --mandir=${PREFIX}/man \
                        --sbindir=${PREFIX}/sbin \
-                       --sysconfdir=${SYSCONFDIR}/apcupsd \
                        --enable-install-distdir \
                        --with-cgi-bin=${WEB_ROOT}/cgi-bin/apcupsd \
                        --with-lock-dir=/var/run \
@@ -77,9 +80,9 @@ WANTLIB-x11 += xcb-shm xcb z ${WANTLIB}
 FAKE_FLAGS =           sysconfdir=${TRUEPREFIX}/share/examples/apcupsd/etc
 
 pre-configure:
-       perl -pi -e 's,/etc/apcupsd,${SYSCONFDIR}/apcupsd,g' \
+       perl -pi -e 's,/etc/apcupsd,${SYSCONFDIR},g' \
                ${WRKSRC}/doc/apcupsd.8 ${WRKSRC}/doc/apcaccess.8
-       perl -pi -e 's,/usr/local/etc/apcupsd,${SYSCONFDIR}/apcupsd,g' \
+       perl -pi -e 's,/usr/local/etc/apcupsd,${SYSCONFDIR},g' \
                ${WRKSRC}/doc/apcupsd.conf.5
        perl -pi -e 's,/etc/rc.apcupsd,${PREFIX}/sbin/apcupsctl,' \
                ${WRKSRC}/platforms/openbsd/README
Index: pkg/MESSAGE-cgi
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/MESSAGE-cgi,v
retrieving revision 1.2
diff -u -p -r1.2 MESSAGE-cgi
--- pkg/MESSAGE-cgi     30 Aug 2011 09:59:30 -0000      1.2
+++ pkg/MESSAGE-cgi     23 Nov 2011 00:09:46 -0000
@@ -1,10 +1,10 @@
 Before using multimon and the other CGI programs, first ensure that
 apcupsd is configured to run the Network Information Server. This is
-done by setting NETSERVER on in ${SYSCONFDIR}/apcupsd/apcupsd.conf. 
+done by setting NETSERVER on in ${SYSCONFDIR}/apcupsd.conf. 
 This switch is on by default.
 To run scripts in chrooted apache (default behaviour), configuration
 files must be available to the webserver:
-# mv ${SYSCONFDIR}/apcupsd /var/www/${SYSCONFDIR}/apcupsd
-# ln -s /var/www/${SYSCONFDIR}/apcupsd ${SYSCONFDIR}/
+# mv ${SYSCONFDIR} /var/www/${SYSCONFDIR}
+# ln -s /var/www/${SYSCONFDIR} ${BASESYSCONFDIR}/
 And some libraries must be copied in:
 # ${WEB_ROOT}/cgi-bin/apcupsd/copy-libs.sh
Index: pkg/MESSAGE-main
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/MESSAGE-main,v
retrieving revision 1.4
diff -u -p -r1.4 MESSAGE-main
--- pkg/MESSAGE-main    30 Aug 2011 09:59:30 -0000      1.4
+++ pkg/MESSAGE-main    23 Nov 2011 00:09:46 -0000
@@ -1,7 +1,7 @@
 To allow the system to be fully powered down (in order to preserve
 UPS battery), add the following lines to /etc/rc.shutdown:
 
-if [ -f ${SYSCONFDIR}/apcupsd/powerfail ]; then
+if [ -f ${SYSCONFDIR}/powerfail ]; then
   echo
   echo "APCUPSD requested this system is powered down."
   echo
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/PLIST-main,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST-main
--- pkg/PLIST-main      30 Aug 2011 09:59:30 -0000      1.2
+++ pkg/PLIST-main      23 Nov 2011 00:09:46 -0000
@@ -20,38 +20,38 @@ share/doc/apcupsd/DISCLAIMER
 share/doc/apcupsd/README.openbsd
 share/examples/apcupsd/
 share/examples/apcupsd/etc/
-@sample ${SYSCONFDIR}/apcupsd/
+@sample ${SYSCONFDIR}/
 share/examples/apcupsd/etc/apccontrol
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/apccontrol
+@sample ${SYSCONFDIR}/apccontrol
 @mode
 share/examples/apcupsd/etc/apcupsd.conf
-@sample ${SYSCONFDIR}/apcupsd/apcupsd.conf
+@sample ${SYSCONFDIR}/apcupsd.conf
 share/examples/apcupsd/etc/apcupsd.css
-@sample ${SYSCONFDIR}/apcupsd/apcupsd.css
+@sample ${SYSCONFDIR}/apcupsd.css
 share/examples/apcupsd/etc/changeme
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/changeme
+@sample ${SYSCONFDIR}/changeme
 @mode
 share/examples/apcupsd/etc/commfailure
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/commfailure
+@sample ${SYSCONFDIR}/commfailure
 @mode
 share/examples/apcupsd/etc/commok
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/commok
+@sample ${SYSCONFDIR}/commok
 @mode
 share/examples/apcupsd/etc/hosts.conf
-@sample ${SYSCONFDIR}/apcupsd/hosts.conf
+@sample ${SYSCONFDIR}/hosts.conf
 share/examples/apcupsd/etc/multimon.conf
-@sample ${SYSCONFDIR}/apcupsd/multimon.conf
+@sample ${SYSCONFDIR}/multimon.conf
 share/examples/apcupsd/etc/offbattery
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/offbattery
+@sample ${SYSCONFDIR}/offbattery
 @mode
 share/examples/apcupsd/etc/onbattery
 @mode 744
-@sample ${SYSCONFDIR}/apcupsd/onbattery
+@sample ${SYSCONFDIR}/onbattery
 @mode
 share/examples/apcupsd/rpt/
 share/examples/apcupsd/rpt/Back-UPS-350-USB.rpt
Index: pkg/apcupsd.rc
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/pkg/apcupsd.rc,v
retrieving revision 1.1
diff -u -p -r1.1 apcupsd.rc
--- pkg/apcupsd.rc      30 Aug 2011 09:59:30 -0000      1.1
+++ pkg/apcupsd.rc      23 Nov 2011 00:09:46 -0000
@@ -10,8 +10,8 @@ daemon_flags="--kill-on-powerfail"
 rc_reload=NO
 
 rc_pre() {
-       if [ -f ${SYSCONFDIR}/apcupsd/powerfail ]; then
-               rm -f ${SYSCONFDIR}/apcupsd/powerfail
+       if [ -f ${SYSCONFDIR}/powerfail ]; then
+               rm -f ${SYSCONFDIR}/powerfail
        fi
 }

Reply via email to