From f0bf319823f9f8fb699d01f9e6df64483476224c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 9 Mar 2018 00:14:47 +0800 Subject: [PATCH] periodic: Remove already disabled monthly statistics report The up-to-date tool can be obtained from DPorts: sysutils/bsdstats To sync with FreeBSD --- Makefile_upgrade.inc | 1 + etc/defaults/periodic.conf | 4 - etc/periodic/monthly/300.statistics | 320 ---------------------------- etc/periodic/monthly/Makefile | 2 - 4 files changed, 1 insertion(+), 326 deletions(-) delete mode 100644 etc/periodic/monthly/300.statistics diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 5d8437c426..847cd7a336 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -3373,6 +3373,7 @@ TO_REMOVE+=/usr/share/man/man9/timeout.9.gz TO_REMOVE+=/usr/share/man/man9/untimeout.9.gz TO_REMOVE+=/usr/include/machine/apm_bios.h TO_REMOVE+=/usr/share/man/man2/expreadv.2.gz +TO_REMOVE+=/etc/periodic/monthly/300.statistics .if !defined(WANT_INSTALLER) TO_REMOVE+=/usr/sbin/dfuibe_installer diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 2b0f1e99e9..30c5e38763 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -232,10 +232,6 @@ monthly_show_badconfig="NO" # scripts returning 2 # 200.accounting monthly_accounting_enable="YES" # Login accounting -# 300.statistics - http://www.bsdstats.org -# (reports basic non-identifying OS info to BSD community site on internet) -#monthly_statistics_enable="YES" -#monthly_statistics_report_devices="YES" # 999.local monthly_local="/etc/monthly.local" # Local scripts diff --git a/etc/periodic/monthly/300.statistics b/etc/periodic/monthly/300.statistics deleted file mode 100644 index 4caa46ac09..0000000000 --- a/etc/periodic/monthly/300.statistics +++ /dev/null @@ -1,320 +0,0 @@ -#!/bin/sh - -# -# $FreeBSD: ports/sysutils/bsdstats/files/300.statistics,v 1.31 2006/10/03 01:33:11 scrappy Exp $ -# $DragonFly: src/etc/periodic/monthly/300.statistics,v 1.1 2006/10/04 21:39:23 dillon Exp $ - -# If there is a global system configuration file, suck it in. -# -if [ -r /etc/defaults/periodic.conf ] -then - . /etc/defaults/periodic.conf - source_periodic_confs - periodic_conf=/etc/periodic.conf -else - . /etc/rc.conf # For systems without periodic.conf, use rc.conf - if [ -r /etc/rc.conf.local ] - then - . /etc/rc.conf.local - fi - periodic_conf=/etc/rc.conf.local -fi - -oldmask=$(umask) -umask 066 - -version="4.7" -checkin_server=${monthly_statistics_checkin_server:-"bsdstats.org"} -bsdstats_log=${monthly_statistics_logfile:-"/var/log/bsdstats"} -id_token_file='/var/db/bsdstats' - -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin -export PATH - -unset HTTP_USER_AGENT - -IFS=" -" - -random () { - jot -r 1 0 900 -} - -# RFC 2396 -uri_escape () { - echo ${1+$@} | sed -e ' - s/%/%25/g - s/;/%3b/g - s,/,%2f,g - s/?/%3f/g - s/:/%3a/g - s/@/%40/g - s/&/%26/g - s/=/%3d/g - s/+/%2b/g - s/\$/%24/g - s/,/%2c/g - s/ /%20/g - ' -} - -do_fetch () { - url="http://$checkin_server/scripts/$1" - case $(uname) in - FreeBSD ) - /usr/bin/fetch -q -o - "$url" - ;; - * ) - /usr/bin/ftp -V -o - "$url" - ;; - esac -} - -check_dns () { - if [ `drill bsdstats.org txt | grep TXT | grep UP | wc -l` = 0 ] - then - echo "DNS not reachable, Network Down?" - exit - fi -} -send_devices () { - case $(uname) in - FreeBSD ) - for line in `/usr/sbin/pciconf -l | /usr/bin/grep -v none` - do - DRIVER=`echo $line | awk -F\@ '{print $1}'` - DEV=`echo $line | awk '{print $4}' | cut -c8-15` - CLASS=`echo $line | awk '{print $2}' | cut -c9-14` - query_string=$query_string`echo \&dev[]=$DRIVER:$DEV:$CLASS` - done - - report_devices - ;; - * ) - # Not supported - ;; - esac -} - -report_devices () { - do_fetch report_devices.php?token=$TOKEN\&key=$KEY$query_string | { - local IFS - IFS='= -' - - while read var val - do - case $var in - STATUS) - if [ $val = "OK" ] - then - echo "[`date`] System Devices reported" - else - echo "[`date`] System Devices not reported, exiting" - exit - fi - ;; - *) - echo "[`date`] Error with fetch to server" - exit - ;; - esac - done - } >> $bsdstats_log -} - -get_id_token () { - if [ -f $id_token_file ] - then - if [ `cat /var/db/bsdstats | wc -l` -lt 3 ] - then - rm $id_token_file - fi - fi - - if [ ! -f $id_token_file -o ! -s $id_token_file ] ; - then - IDTOKEN=$(uri_escape $( openssl rand -base64 32 ) ) - - idf=$( mktemp "$id_token_file.XXXXXX" ) && \ - chown root:wheel $idf && \ - chmod 600 $idf - - do_fetch getid.php?key=$IDTOKEN | { - local IFS - IFS='= -' - - while read var val - do - case $var in - KEY) - echo "KEY=$val" - ;; - TOKEN) - echo "TOKEN=$val" - ;; - *) - ;; - esac - done - echo "VERSION=$version" - } > $idf && \ - - mv $idf $id_token_file - if [ ! -s $id_token_file ] ; - then - echo "Nothing returned from $checkin_server" - exit 1 - fi - fi - . $id_token_file - KEY=$( uri_escape $KEY ) - TOKEN=$( uri_escape $TOKEN ) -} - - -enable_token () { - do_fetch enable_token.php?key=$TOKEN\&token=$KEY | { - local IFS - IFS='= -' - - while read var val - do - case $var in - STATUS) - if [ $val = "OK" ] - then - echo "[`date`] System enabled" - else - echo "[`date`] System not enabled, exiting" - exit - fi - ;; - *) - echo "[`date`] Error with fetch to server" - exit - ;; - esac - done - } >> $bsdstats_log -} - -disable_token () { - do_fetch disable_token.php?key=$TOKEN\&token=$KEY | { - local IFS - IFS='= -' - - while read var val - do - case $var in - STATUS) - if [ $val = "OK" ] - then - echo "[`date`] System disabled" - else - echo "[`date`] System not disabled, exiting" - exit - fi - ;; - *) - echo "[`date`] Error with fetch to server" - exit - ;; - esac - done - } >> $bsdstats_log -} - -report_system () { - do_fetch report_system.php?token=$TOKEN\&key=$KEY\&rel=$REL\&arch=$ARCH\&opsys=$OS | { - local IFS - IFS='= -' - - while read var val - do - case $var in - STATUS) - if [ $val = "OK" ] - then - echo "[`date`] System reported" - else - echo "[`date`] System report failed, exiting" - exit - fi - ;; - *) - echo "[`date`] Error with fetch to server" - exit - ;; - esac - done - } >> $bsdstats_log -} - -report_cpu () { - do_fetch report_cpu.php?token=$TOKEN\&key=$KEY\&cpus=$count\&vendor=$VEN\&cpu_type=$DEV | { - local IFS - IFS='= -' - - while read var val - do - case $var in - STATUS) - if [ $val = "OK" ] - then - echo "[`date`] System CPU reported" - else - echo "[`date`] System CPU report failed, exiting" - exit - fi - ;; - *) - echo "[`date`] Error with fetch to server" - exit - ;; - esac - done - } >> $bsdstats_log -} -case "$monthly_statistics_enable" in - [Yy][Ee][Ss]) - check_dns - HN=`/bin/hostname` - REL=`/usr/bin/uname -r` - ARCH=`/usr/bin/uname -m` - OS=`/usr/bin/uname -s` - get_id_token - sleep `random` - enable_token - report_system - echo "Posting monthly OS statistics to $checkin_server" - case "$monthly_statistics_report_devices" in - [Yy][Ee][Ss]) - send_devices - echo "Posting monthly device statistics to $checkin_server" - line=$( sysctl -n hw.model ) - VEN=$( echo $line | cut -d ' ' -f 1 ) - DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) ) - count=$( sysctl -n hw.ncpu ) - report_cpu - echo "Posting monthly CPU statistics to $checkin_server" - ;; - *) - echo "Posting monthly device/CPU statistics disabled" - echo " set monthly_statistics_report_devices=\"YES\" in $periodic_conf" - ;; - esac - disable_token - ;; - *) - echo "Posting monthly OS statistics disabled" - echo " set monthly_statistics_enable=\"YES\" in $periodic_conf" - ;; -esac - -umask $oldmask -exit $rc diff --git a/etc/periodic/monthly/Makefile b/etc/periodic/monthly/Makefile index da008d690d..ad7d870abf 100644 --- a/etc/periodic/monthly/Makefile +++ b/etc/periodic/monthly/Makefile @@ -1,8 +1,6 @@ # $FreeBSD: src/etc/periodic/monthly/Makefile,v 1.2.2.1 2002/07/18 12:36:07 ru Exp $ -# $DragonFly: src/etc/periodic/monthly/Makefile,v 1.3 2006/10/04 21:39:23 dillon Exp $ FILES= 200.accounting \ - 300.statistics \ 999.local .include -- 2.41.0