---
name: bsdstats
version: 5.5_3
origin: sysutils/bsdstats
comment: Monthly script for reporting anonymous statistics about your machine
arch: freebsd:9:x86:64
www: http://www.bsdstats.org/
maintainer: bsdstats@nanoman.ca
prefix: /usr/local
licenselogic: single
flatsize: 13699
desc: |
  BSDstats is an attempt to produce reasonably accurate statistics on
  deployments of BSD operating systems.  This is useful for marketing,
  project advocacy, hardware vendors and purchasers, device driver
  maintainers, and port maintainers.

  The major problem that we are trying to address is vendors who do not
  feel that BSD operating systems present enough of a market to bother
  supporting.

  Meant to be run monthly or during bootup, this script submits
  statistics anonymously to a central server (http://bsdstats.org).
  Potentially sensitive details like IP addresses and hostnames are not
  stored by or relayed through the BSDstats server.

  WWW: http://www.bsdstats.org/
categories: [sysutils]
files:
  /usr/local/etc/periodic/monthly/300.statistics: 5cfcf8ccceae04b3253e2e22d790c9ac2a6a43156b4390c4d26f383c2b55a5d1
  /usr/local/etc/rc.d/bsdstats: 126c222017ec05700b3e85c69a13721f0897e1f28314a2831da734982425b1d0
directories:
  /usr/local/etc/periodic/monthly/: y
  /usr/local/etc/periodic/: y
scripts:
  post-install: |
    cd /usr/local
  pre-deinstall: |
    cd /usr/local
  post-deinstall: |
    cd /usr/local
  install: "#!/bin/sh\n#\n# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in\n#\n\n#
    The default answer to \"Would you like to enable monthly reporting in\n# /etc/periodic.conf?\"
    is \"yes\", which you can override by setting the\n# BSDSTATS_MONTHLY_ENABLE environment
    variable to \"no\".\n#\n# The default answer to \"Would you like to send a list
    of installed hardware\n# as well?\" is \"yes\", which you can override by setting
    the\n# BSDSTATS_MONTHLY_DEVICES environment variable to \"no\".\n#\n# The default
    answer to \"Would you like to send a list of installed ports as\n# well?\" is
    \"yes\", which you can override by setting the BSDSTATS_MONTHLY_PORTS\n# environment
    variable to \"no\".\n#\n# The default answer to \"Would you like to run it now?\"
    is \"yes\", which you can\n# override by setting the BSDSTATS_MONTHLY_NOW environment
    variable to \"no\".\n#\n# The default answer to \"Would you like to enable reporting
    on bootup in\n# /etc/rc.conf?\" is \"yes\", which you can override by setting
    the\n# BSDSTATS_REBOOT_REPORTING environment variable to \"no\".\n\nBSDSTATS_MONTHLY_ENABLE=${BSDSTATS_MONTHLY_ENABLE:=yes}\nBSDSTATS_MONTHLY_DEVICES=${BSDSTATS_MONTHLY_DEVICES:=yes}\nBSDSTATS_MONTHLY_PORTS=${BSDSTATS_MONTHLY_PORTS:=yes}\nBSDSTATS_MONTHLY_NOW=${BSDSTATS_MONTHLY_NOW:=yes}\nBSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=yes}\n\nask()
    {\n    local question default answer\n\n    question=$1\n    default=$2\n    if
    [ -z \"${PACKAGE_BUILDING}\" ]; then\n        read -p \"${question} [${default}]?
    \" answer\n    fi\n    if [ -z \"${answer}\" ]; then\n        answer=${default}\n
    \   fi\n    echo ${answer}\n}\n\nyesno() {\n    local question default answer\n\n
    \   question=$1\n    default=$2\n    while :; do\n        answer=$(ask \"${question}\"
    \"${default}\")\n        case \"${answer}\" in\n        [Yy]*)\treturn 0;;\n        [Nn]*)\treturn
    1;;\n        esac\n        echo \"Please answer yes or no.\"\n    done\n}\n\nif
    [ \"$2\" = \"POST-INSTALL\" ]; then\n    if [ ! -f \"/etc/periodic.conf\" ] ||
    [ -z \"`grep monthly_statistics /etc/periodic.conf`\" ]; then\n        if yesno
    \"Would you like to enable monthly reporting in /etc/periodic.conf\" ${BSDSTATS_MONTHLY_ENABLE};
    then\n            echo \"monthly_statistics_enable=\\\"YES\\\"\" >> /etc/periodic.conf\n
    \           if yesno \"Would you like to send a list of installed hardware as
    well\" ${BSDSTATS_MONTHLY_DEVICES}; then\n                echo \"monthly_statistics_report_devices=\\\"YES\\\"\"
    >> /etc/periodic.conf\n            fi\n            if yesno \"Would you like to
    send a list of installed ports as well\" ${BSDSTATS_MONTHLY_PORTS}; then\n                echo
    \"monthly_statistics_report_ports=\\\"YES\\\"\" >> /etc/periodic.conf\n            fi\n
    \           if yesno \"Would you like to run it now\" ${BSDSTATS_MONTHLY_NOW};
    then\n               ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay\n
    \           fi\n        fi\n    fi\n    if [ ! -f \"/etc/rc.conf\" ] || [ -z \"`grep
    bsdstats_enable /etc/rc.conf`\" ]; then\n        echo \"\"\n        echo \"If
    you're installing BSDstats on a system that won't always be on, such as a\"\n
    \       echo \"desktop or a laptop, it is recommended that you enable it in /etc/rc.conf
    so\"\n        echo \"that it will run on bootup.  This will ensure that, even
    if your computer is\"\n        echo \"off when \\\"monthly\\\" runs, your computer
    will be counted properly.\"\n        echo \"\"\n        if yesno \"Would you like
    to enable reporting on bootup in /etc/rc.conf\" ${BSDSTATS_REBOOT_REPORTING};
    then\n            echo \"bsdstats_enable=\\\"YES\\\"\" >> /etc/rc.conf\n        fi\n
    \   fi\nfi\n"
message: "********************\nTo enable monthly reporting, add these lines to /etc/periodic.conf:\n\tmonthly_statistics_enable=\"YES\"\n\tmonthly_statistics_report_devices=\"YES\"\n\tmonthly_statistics_report_ports=\"YES\"\n\nTo
  enable reporting on bootup, add this line to /etc/rc.conf:\n\tbsdstats_enable=\"YES\"\n\nTo
  run it manually the first time:\n\t/usr/local/etc/periodic/monthly/300.statistics
  -nodelay\n\nTo view current statistics, go to:\n\thttp://www.bsdstats.org/\n********************\n"
