--- Makefile (revision 558267) +++ Makefile (working copy) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= bsdstats -PORTVERSION= 7.0 +PORTVERSION= 7.1 CATEGORIES= sysutils DISTFILES= @@ -42,4 +42,9 @@ ${INSTALL_SCRIPT} ${WRKDIR}/bsdstats-send \ ${STAGEDIR}${PREFIX}/bin/bsdstats-send +post-install: +.if ! defined(BATCH) && ! defined(PACKAGE_BUILDING) + @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL ${STAGEDIR}${PREFIX} +.endif + .include --- files/300.statistics.in (revision 558267) +++ files/300.statistics.in (working copy) @@ -392,7 +392,7 @@ ;; *) report_uri="/scripts/report_ports_v2.php" - if [ -f %%PREFIX%%/etc/bsdstats.conf -a "0" = "0`grep ^all-ports /usr/local/etc/bsdstats.conf`" ]; then + if [ -f %%PREFIX%%/etc/bsdstats.conf ] && [ -z $(grep ^all-ports /usr/local/etc/bsdstats.conf) ]; then query_string=$( pkg query %n:%v:%o | fgrep -f %%PREFIX%%/etc/bsdstats.conf | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' ) else query_string=$( pkg query %n:%v:%o | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' ) --- pkg-install (revision 558267) +++ pkg-install (working copy) @@ -6,13 +6,22 @@ # # 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 @@ -47,16 +56,22 @@ } if [ "$2" = "POST-INSTALL" ]; then - 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 + 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 + if [ -z "$PACKAGE_BUILDING" ]; then + ${3}/etc/periodic/monthly/300.statistics -nodelay + else + ${INSTALL_PREFIX}${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay + fi + fi fi fi if [ ! -f "/etc/rc.conf" ] || [ -z $(grep bsdstats_enable /etc/rc.conf) ]; then