aboutsummaryrefslogtreecommitdiff
path: root/sysutils/bsdstats
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/bsdstats')
-rw-r--r--sysutils/bsdstats/pkg-install70
1 files changed, 33 insertions, 37 deletions
diff --git a/sysutils/bsdstats/pkg-install b/sysutils/bsdstats/pkg-install
index 39014b69f187..31792cfbdf38 100644
--- a/sysutils/bsdstats/pkg-install
+++ b/sysutils/bsdstats/pkg-install
@@ -2,7 +2,31 @@
#
# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
#
-LOCALBASE=${LOCALBASE:=/usr/local}
+
+# The default answer to "Would you like to activate monthly reporting in
+# /etc/periodic.conf?" is "no", which you can override by setting the
+# BSDSTATS_MONTHLY_ENABLE environment variable to "yes".
+#
+# The default answer to "Would you like to send a list of installed hardware
+# as well?" is "no", which you can override by setting the
+# BSDSTATS_MONTHLY_DEVICES environment variable to "yes".
+#
+# The default answer to "Would you like to send a list of installed ports as
+# well?" is "no", which you can override by setting the BSDSTATS_MONTHLY_PORTS
+# environment variable to "yes".
+#
+# The default answer to "Would you like to run it now?" is "yes", which you can
+# override by setting the BSDSTATS_MONTHLY_NOW environment variable to "no".
+#
+# The default answer to "Would you like to activate reporting on reboot in
+# /etc/rc.conf?" is "no", which you can override by setting the
+# BSDSTATS_REBOOT_REPORTING environment variable to "yes".
+
+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:=yes}
+BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no}
ask() {
local question default answer
@@ -33,50 +57,22 @@ yesno() {
done
}
-if [ ":$2" = ":POST-INSTALL" ]; then
- if [ -f "/etc/periodic.conf" ]; then
- if [ `grep monthly_statistics /etc/periodic.conf | wc -l` = 0 ]; then
- if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" n; then
- echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf
- if yesno "Would you like to send a list of installed hardware as well" n; 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" n; then
- echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf
- fi
- if yesno "Would you like to run it now" y; then
- ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
- fi
- fi
- fi
- elif [ ! -f "/etc/periodic.conf" ]; then
- if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" n; then
+if [ "$2" = "POST-INSTALL" ]; then
+ if [ -f "/etc/periodic.conf" -a -z "`grep monthly_statistics /etc/periodic.conf`" ] || [ ! -f "/etc/periodic.conf" ]; then
+ if yesno "Would you like to activate 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" n; then
+ 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" n; then
+ 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" y; then
+ if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then
${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
fi
fi
fi
- if [ -f "/etc/rc.conf" ]; then
- if [ `grep bsdstats_enable /etc/rc.conf | wc -l` = 0 ]; then
- echo ""
- echo "If running as a desktop, or on a laptop, it is recommended that you"
- echo "enable bsdstats within /etc/rc.conf, so that it will run on reboot."
- echo ""
- echo "This will ensure that even if your computer is off when monthly runs,"
- echo "your computer will be properly counted."
- echo ""
- if yesno "Would you like to activate reporting on reboot in /etc/rc.conf" n; then
- echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
- fi
- fi
- elif [ ! -f "/etc/rc.conf" ]; then
+ if [ -f "/etc/rc.conf" -a -z "`grep bsdstats_enable /etc/rc.conf`" ] || [ ! -f "/etc/rc.conf" ]; then
echo ""
echo "If running as a desktop, or on a laptop, it is recommended that you"
echo "enable bsdstats within /etc/rc.conf, so that it will run on reboot."
@@ -84,7 +80,7 @@ if [ ":$2" = ":POST-INSTALL" ]; then
echo "This will ensure that even if your computer is off when monthly runs,"
echo "your computer will be properly counted."
echo ""
- if yesno "Would you like to activate reporting on reboot in /etc/rc.conf" n; then
+ if yesno "Would you like to activate reporting on reboot in /etc/rc.conf" ${BSDSTATS_REBOOT_REPORTING}; then
echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
fi
fi