2006-09-04 06:57:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2007-04-30 18:49:08 +00:00
|
|
|
# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
|
2006-09-04 06:57:49 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
ask() {
|
|
|
|
local question default answer
|
|
|
|
|
|
|
|
question=$1
|
|
|
|
default=$2
|
|
|
|
if [ -z "${PACKAGE_BUILDING}" ]; then
|
|
|
|
read -p "${question} [${default}]? " answer
|
|
|
|
fi
|
|
|
|
if [ -z "${answer}" ]; then
|
|
|
|
answer=${default}
|
|
|
|
fi
|
|
|
|
echo ${answer}
|
|
|
|
}
|
|
|
|
|
|
|
|
yesno() {
|
|
|
|
local question default answer
|
|
|
|
|
|
|
|
question=$1
|
|
|
|
default=$2
|
|
|
|
while :; do
|
|
|
|
answer=$(ask "${question}" "${default}")
|
|
|
|
case "${answer}" in
|
|
|
|
[Yy]*) return 0;;
|
|
|
|
[Nn]*) return 1;;
|
|
|
|
esac
|
|
|
|
echo "Please answer yes or no."
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ ":$2" = ":POST-INSTALL" ]; then
|
2006-11-05 18:56:10 +00:00
|
|
|
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
|
2007-04-28 19:23:40 +00:00
|
|
|
echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
|
2006-11-05 18:56:10 +00:00
|
|
|
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
|
2006-12-01 13:30:45 +00:00
|
|
|
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
|
2006-11-05 18:56:10 +00:00
|
|
|
if yesno "Would you like to run it now" y; then
|
2007-04-30 18:49:08 +00:00
|
|
|
${LOCALBASE}/etc/periodic/monthly/300.statistics -nodelay
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ `grep 'monthly_statistics_enable="YES"' /etc/periodic.conf | wc -l` = 1 ]; then
|
|
|
|
if [ `grep 'bsdstats_enable="YES"' /etc/rc.conf | wc -l` = 0 ]; then
|
|
|
|
echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
|
2006-11-05 18:56:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif [ ! -f "/etc/periodic.conf" ]; then
|
2006-10-08 00:39:29 +00:00
|
|
|
if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" n; then
|
|
|
|
echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf
|
2007-04-28 19:23:40 +00:00
|
|
|
echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
|
2006-10-08 00:39:29 +00:00
|
|
|
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
|
2006-12-01 13:30:45 +00:00
|
|
|
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
|
2006-10-08 00:39:29 +00:00
|
|
|
if yesno "Would you like to run it now" y; then
|
2007-04-30 18:49:08 +00:00
|
|
|
${LOCALBASE}/etc/periodic/monthly/300.statistics -nodelay
|
2006-10-08 00:39:29 +00:00
|
|
|
fi
|
2006-09-04 06:57:49 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|