- Update to upstream version 6.0

- yuri@rawbw.com takes maintainership
- add LICENSE
- add TOR OPTION
- Favor PLIST_FILES over pkg-plist (only two entries at the moment)
- Pet portlint

PR:		198799
Submitted by:	yuri@rawbw.com (new maintainer)
Reviewed by:	bsdstats@nanoman.ca
Approved by:	bsdstats@nanoman.ca (previous maintainer)
This commit is contained in:
Thomas Zander 2015-05-05 16:48:14 +00:00
parent 307a428865
commit f1e4891483
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=385480
7 changed files with 618 additions and 531 deletions

View file

@ -2,30 +2,49 @@
# $FreeBSD$
PORTNAME= bsdstats
PORTVERSION= 5.5
PORTREVISION= 5
PORTVERSION= 6.0
CATEGORIES= sysutils
DISTFILES=
MAINTAINER= bsdstats@nanoman.ca
MAINTAINER= yuri@rawbw.com
COMMENT= Monthly script for reporting anonymous statistics about your machine
LICENSE= BSD4CLAUSE
NO_BUILD= yes
USE_RC_SUBR= bsdstats
SUB_FILES= 300.statistics pkg-message
SUB_LIST+= DIG=${DIG}
SUB_FILES= 300.statistics bsdstats-send pkg-message
SUB_LIST+= VERSION=${PORTVERSION}
NO_ARCH= YES
OPTIONS_DEFINE= TOR
TOR_DESC= Submit securely through TOR anonymity network
PLIST_FILES= bin/bsdstats-send \
etc/periodic/monthly/300.statistics
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 1000500
DIG= drill
.if ${PORT_OPTIONS:MTOR}
RUN_DEPENDS+= tor:${PORTSDIR}/security/tor
.endif
pre-install:
.if ${PORT_OPTIONS:MTOR}
@${REINPLACE_CMD} -e 's|USE_TOR=NO|USE_TOR=YES|' ${WRKDIR}/300.statistics
@${REINPLACE_CMD} -e 's|# REQUIRE: LOGIN|# REQUIRE: LOGIN tor|' ${WRKDIR}/bsdstats
@${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|Statistics will be submitted anonymously through the TOR network|' \
${WRKDIR}/pkg-message
.else
DIG= dig
@${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|You can build bsdstats with TOR port option to submit anonymously|' \
${WRKDIR}/pkg-message
.endif
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/monthly
${INSTALL_SCRIPT} ${WRKDIR}/300.statistics \
${STAGEDIR}${PREFIX}/etc/periodic/monthly
${INSTALL_SCRIPT} ${WRKDIR}/bsdstats-send \
${STAGEDIR}${PREFIX}/bin/bsdstats-send
.include <bsd.port.post.mk>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$(id -u)" != "0" ]; then
echo "Only root can run BSDstats update"
exit 1
fi
%%PREFIX%%/etc/periodic/monthly/300.statistics -nodelay

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh
#
# $FreeBSD$
#

View file

@ -1,15 +1,21 @@
********************
To enable monthly reporting, add these lines to /etc/periodic.conf:
monthly_statistics_enable="YES"
monthly_statistics_report_devices="YES"
monthly_statistics_report_ports="YES"
======================================================================
You installed BSDstats: script reporting statistics about your machine
To disable monthly reporting, add this line to /etc/periodic.conf:
monthly_statistics_enable="NO"
To disable parts of reporting, add these lines to /etc/periodic.conf:
monthly_statistics_report_devices="NO"
monthly_statistics_report_ports="NO"
To enable reporting on bootup, add this line to /etc/rc.conf:
bsdstats_enable="YES"
To run it manually the first time:
%%PREFIX%%/etc/periodic/monthly/300.statistics -nodelay
To run it manually any time:
bsdstats-send
To view current statistics, go to:
http://www.bsdstats.org/
********************
@@TOR_MESSAGE@@
======================================================================

View file

@ -1,27 +1,18 @@
#!/bin/sh
# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
# The default answer to each of the installation questions is "yes". You can
# override a questions's default by setting its environment variable to "no".
#
# The default answer to each of the installation questions is "yes". You can
# override a question's default by setting its environment variable to "no".
#
# Environment Variable | Question
# --------------------------+------------------------------------------------------------------
# BSDSTATS_MONTHLY_ENABLE | Would you like to enable monthly reporting in /etc/periodic.conf?
# BSDSTATS_MONTHLY_DEVICES | Would you like to send a list of installed hardware as well?
# BSDSTATS_MONTHLY_PORTS | Would you like to send a list of installed ports as well?
# BSDSTATS_MONTHLY_NOW | Would you like to run it now?
# BSDSTATS_REBOOT_REPORTING | Would you like to enable reporting on bootup in /etc/rc.conf?
if [ -n "$PACKAGE_BUILDING" ]; then
BSDSTATS_MONTHLY_ENABLE=${BSDSTATS_MONTHLY_ENABLE:=no}
BSDSTATS_MONTHLY_DEVICES=${BSDSTATS_MONTHLY_DEVICES:=no}
BSDSTATS_MONTHLY_PORTS=${BSDSTATS_MONTHLY_PORTS:=no}
BSDSTATS_MONTHLY_NOW=${BSDSTATS_MONTHLY_NOW:=no}
BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no}
else
BSDSTATS_MONTHLY_ENABLE=${BSDSTATS_MONTHLY_ENABLE:=yes}
BSDSTATS_MONTHLY_DEVICES=${BSDSTATS_MONTHLY_DEVICES:=yes}
BSDSTATS_MONTHLY_PORTS=${BSDSTATS_MONTHLY_PORTS:=yes}
BSDSTATS_MONTHLY_NOW=${BSDSTATS_MONTHLY_NOW:=yes}
BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=yes}
fi
@ -56,25 +47,23 @@ yesno() {
}
if [ "$2" = "POST-INSTALL" ]; then
if [ ! -f "/etc/periodic.conf" ] || [ -z "`grep monthly_statistics /etc/periodic.conf`" ]; then
if yesno "Would you like to enable monthly reporting in /etc/periodic.conf" $BSDSTATS_MONTHLY_ENABLE; then
echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf
if yesno "Would you like to send a list of installed hardware as well" $BSDSTATS_MONTHLY_DEVICES; then
echo "monthly_statistics_report_devices=\"YES\"" >> /etc/periodic.conf
fi
if yesno "Would you like to send a list of installed ports as well" $BSDSTATS_MONTHLY_PORTS; then
echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf
fi
if yesno "Would you like to run it now" $BSDSTATS_MONTHLY_NOW; then
${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
fi
log_file="${INSTALL_PREFIX}/var/log/bsdstats"
need_to_ask=0
if [ ! -e ${log_file} ]; then
need_to_ask=1
elif [ $(($(date +"%s")-$(stat -f %Sm -t %s ${log_file}))) -gt $((60*60*24*40)) ]; then
need_to_ask=1
fi
if [ $need_to_ask = 1 ]; then
if yesno "Would you like to run BSDstats now" $BSDSTATS_MONTHLY_NOW; then
${INSTALL_PREFIX}${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
fi
fi
if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
if [ ! -f "/etc/rc.conf" ] || [ -z $(grep bsdstats_enable /etc/rc.conf) ]; then
echo
echo "If you're installing BSDstats on a system that won't always be on, such as a"
echo "desktop or a laptop, it is recommended that you enable it in /etc/rc.conf so"
echo "that it will run on bootup. This will ensure that, even if your computer is"
echo "that it will run on bootup. This will ensure that, even if your computer is"
echo "off when \"monthly\" runs, your computer will be counted properly."
echo
if yesno "Would you like to enable reporting on bootup in /etc/rc.conf" $BSDSTATS_REBOOT_REPORTING; then

View file

@ -1 +0,0 @@
etc/periodic/monthly/300.statistics