ports/146257: [patch][repocopy] sysutils/bsdstats: improper use of LOCALBASE
Anonymous
swell.k at gmail.com
Sun May 2 22:50:10 UTC 2010
>Number: 146257
>Category: ports
>Synopsis: [patch][repocopy] sysutils/bsdstats: improper use of LOCALBASE
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun May 02 22:50:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Anonymous
>Release: FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
LOCALBASE=/usr/pkg
PREFIX=$HOME/aaa
>Description:
It fails to run here spouting:
# /usr/pkg/etc/rc.d/bsdstats.sh onestart
/usr/pkg/etc/rc.d/bsdstats.sh: WARNING: run_rc_command: cannot run /usr/local/etc/periodic/monthly/300.statistics
I don't have /usr/local directory. So, after a brief look at the port:
- make LOCALBASE that is not /usr/local actually work
- don't install outside of PREFIX, including LOCALBASE
- move 300.statistics bsdstats pkg-message to ${FILESDIR}, requires repocopy
$ find files
files
files/bsdstats.in
files/pkg-message.in
files/300.statistics.in
- drop .sh suffix, nowadays rc.d scripts don't need it
- be consistent about creating etc/periodic/monthly
- silence cat(1) invocation
>How-To-Repeat:
>Fix:
--- a.diff begins here ---
Index: sysutils/bsdstats/Makefile
===================================================================
RCS file: /a/.cvsup/ports/sysutils/bsdstats/Makefile,v
retrieving revision 1.59
diff -u -p -r1.59 Makefile
--- sysutils/bsdstats/Makefile 18 Sep 2009 21:19:34 -0000 1.59
+++ sysutils/bsdstats/Makefile 2 May 2010 22:28:20 -0000
@@ -14,14 +14,14 @@ MAINTAINER= ports at FreeBSD.org
COMMENT= Monthly script for reporting anonymous statistics about your machine
NO_BUILD= yes
+SUB_FILES= 300.statistics bsdstats pkg-message
do-install:
- ${MKDIR} ${LOCALBASE}/etc/periodic/monthly
- ${CP} ${FILESDIR}/300.statistics ${LOCALBASE}/etc/periodic/monthly
- ${CP} ${FILESDIR}/bsdstats.sh ${LOCALBASE}/etc/rc.d
- ${CHMOD} 0755 ${LOCALBASE}/etc/rc.d/bsdstats.sh
+ ${MKDIR} ${PREFIX}/etc/periodic/monthly
+ ${INSTALL_SCRIPT} ${WRKDIR}/300.statistics ${PREFIX}/etc/periodic/monthly
+ ${INSTALL_SCRIPT} ${WRKDIR}/bsdstats ${PREFIX}/etc/rc.d
post-install:
- ${CAT} ${PKGMESSAGE}
+ @${CAT} ${PKGMESSAGE}
.if defined(BATCH) || defined(PACKAGE_BUILDING)
@${ECHO_MSG} " To activate monthly statistics reporting in /etc/periodic.conf,"
@${ECHO_MSG} " execute the following as root user:"
Index: sysutils/bsdstats/files/pkg-message.in
===================================================================
RCS file: /a/.cvsup/ports/sysutils/bsdstats/files/pkg-message.in,v
retrieving revision 1.9
diff -u -p -r1.9 pkg-message
--- sysutils/bsdstats/files/pkg-message.in 30 Apr 2007 18:49:08 -0000 1.9
+++ sysutils/bsdstats/files/pkg-message.in 2 May 2010 22:20:57 -0000
@@ -23,7 +23,7 @@ To enable ports reporting, add this line
monthly_statistics_report_ports="YES"
To run it manually the first time, just run it as:
- ${LOCALBASE}/etc/periodic/monthly/300.statistics -nodelay
+ %%PREFIX%%/etc/periodic/monthly/300.statistics -nodelay
To view current statistics, go to:
http://www.bsdstats.org
Index: sysutils/bsdstats/pkg-plist
===================================================================
RCS file: /a/.cvsup/ports/sysutils/bsdstats/pkg-plist,v
retrieving revision 1.1
diff -u -p -r1.1 pkg-plist
--- sysutils/bsdstats/pkg-plist 19 Aug 2008 10:25:05 -0000 1.1
+++ sysutils/bsdstats/pkg-plist 2 May 2010 22:17:34 -0000
@@ -1,4 +1,5 @@
+ at exec mkdir -p %D/etc/periodic/monthly/
etc/periodic/monthly/300.statistics
-etc/rc.d/bsdstats.sh
+etc/rc.d/bsdstats
@dirrmtry etc/periodic/monthly
@dirrmtry etc/periodic
Index: sysutils/bsdstats/files/300.statistics.in
===================================================================
RCS file: /a/.cvsup/ports/sysutils/bsdstats/files/300.statistics.in,v
retrieving revision 1.42
diff -u -p -r1.42 300.statistics
--- sysutils/bsdstats/files/300.statistics.in 18 Sep 2009 21:19:34 -0000 1.42
+++ sysutils/bsdstats/files/300.statistics.in 2 May 2010 22:05:41 -0000
@@ -28,7 +28,7 @@ checkin_server=${monthly_statistics_chec
bsdstats_log=${monthly_statistics_logfile:-"/var/log/bsdstats"}
id_token_file='/var/db/bsdstats'
-PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin
export PATH
unset HTTP_USER_AGENT
Index: sysutils/bsdstats/files/bsdstats.in
===================================================================
RCS file: /a/.cvsup/ports/sysutils/bsdstats/files/bsdstats.in,v
retrieving revision 1.1
diff -u -p -r1.1 bsdstats.sh
--- sysutils/bsdstats/files/bsdstats.in 28 Apr 2007 23:54:03 -0000 1.1
+++ sysutils/bsdstats/files/bsdstats.in 2 May 2010 22:04:45 -0000
@@ -21,7 +21,7 @@ load_rc_config bsdstats
name=bsdstats
rcvar=`set_rcvar`
-command=/usr/local/etc/periodic/monthly/300.statistics
+command=%%PREFIX%%/etc/periodic/monthly/300.statistics
# default to disable
bsdstats_enable=${bsdstats_enable:-"NO"}
--- a.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list