diff options
author | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-09-04 20:36:44 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-09-04 20:36:44 +0000 |
commit | 6aa511e0f0faf94b70914320f136d91765545f1c (patch) | |
tree | cae6b9e8893d6accf7a9e3602a58eb22bd1d602a /sysutils/bsdstats/files | |
parent | d4cf796b7a94824040b20e04853206075276cabe (diff) |
Several cleanups, and extensions to allow NetBSD to submit ...
- uri_escape IDTOKEN properly
- use ftp vs fetch
- use /etc/rc.conf instead of /etc/periodic.conf
Submitted by: David Brownlee <abs@absd.org>
Notes
Notes:
svn path=/head/; revision=172220
Diffstat (limited to 'sysutils/bsdstats/files')
-rw-r--r-- | sysutils/bsdstats/files/300.statistics | 27 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics.in | 27 |
2 files changed, 32 insertions, 22 deletions
diff --git a/sysutils/bsdstats/files/300.statistics b/sysutils/bsdstats/files/300.statistics index 72038babd0f0..b323e0f9732b 100644 --- a/sysutils/bsdstats/files/300.statistics +++ b/sysutils/bsdstats/files/300.statistics @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.15 2006-09-04 01:59:28 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.16 2006-09-04 20:36:44 scrappy Exp $ # # If there is a global system configuration file, suck it in. @@ -9,6 +9,8 @@ if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf source_periodic_confs +else + . /etc/rc.conf # For systems without periodic.conf, use rc.conf fi oldmask=$(umask) @@ -36,21 +38,19 @@ send_devices () { } get_id_token () { - local IFS - - IFS='= -' - - if [ ! -f $id_token_file ] ; + if [ ! -f $id_token_file -o ! -s $id_token_file ] ; then - IDTOKEN=$( openssl rand -base64 16 ) + IDTOKEN=$(uri_escape $( openssl rand -base64 16 ) ) idf=$( mktemp "$id_token_file.XXXXXX" ) && \ /usr/sbin/chown root:wheel $idf && \ /bin/chmod 600 $idf - /usr/bin/fetch -qo - \ - "http://$checkin_server/scripts/getid.php?key=$IDTOKEN" | { + do_fetch getid.php?key=$IDTOKEN | { + local IFS + IFS='= +' + while read var val do case $var in @@ -105,7 +105,12 @@ uri_escape () { } do_fetch () { - /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" + case $(uname) in + NetBSD) + /usr/bin/ftp -V -o /dev/null "http://$checkin_server/scripts/$1" ;; + FreeBSD | *) + /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" ;; + esac } diff --git a/sysutils/bsdstats/files/300.statistics.in b/sysutils/bsdstats/files/300.statistics.in index 31bab01dd778..442d74363558 100644 --- a/sysutils/bsdstats/files/300.statistics.in +++ b/sysutils/bsdstats/files/300.statistics.in @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.15 2006-09-04 01:59:28 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.16 2006-09-04 20:36:44 scrappy Exp $ # # If there is a global system configuration file, suck it in. @@ -9,6 +9,8 @@ if [ -r /etc/defaults/periodic.conf ] then . /etc/defaults/periodic.conf source_periodic_confs +else + . /etc/rc.conf # For systems without periodic.conf, use rc.conf fi oldmask=$(umask) @@ -36,21 +38,19 @@ send_devices () { } get_id_token () { - local IFS - - IFS='= -' - - if [ ! -f $id_token_file ] ; + if [ ! -f $id_token_file -o ! -s $id_token_file ] ; then - IDTOKEN=$( openssl rand -base64 16 ) + IDTOKEN=$(uri_escape $( openssl rand -base64 16 ) ) idf=$( mktemp "$id_token_file.XXXXXX" ) && \ /usr/sbin/chown root:wheel $idf && \ /bin/chmod 600 $idf - /usr/bin/fetch -qo - \ - "http://$checkin_server/scripts/getid.php?key=$IDTOKEN" | { + do_fetch getid.php?key=$IDTOKEN | { + local IFS + IFS='= +' + while read var val do case $var in @@ -105,7 +105,12 @@ uri_escape () { } do_fetch () { - /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" + case $(uname) in + NetBSD) + /usr/bin/ftp -V -o /dev/null "http://$checkin_server/scripts/$1" ;; + FreeBSD | *) + /usr/bin/fetch -qo /dev/null "http://$checkin_server/scripts/$1" ;; + esac } |