slitaz-tools rev 1013

sdt: check a disto is sent only once
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 12 00:04:41 2017 +0100 (2017-02-12)
parents 2e8f6a09785c
children 29dd24939396
files sdt/sdt
line diff
     1.1 --- a/sdt/sdt	Sat Feb 11 23:45:29 2017 +0100
     1.2 +++ b/sdt/sdt	Sun Feb 12 00:04:41 2017 +0100
     1.3 @@ -44,6 +44,10 @@
     1.4  		separator && newline ;;
     1.5  	send)
     1.6  		# Send stats to online DB
     1.7 +		if [ -f "${HOME}/.cache/slitaz/sdt.log" ]; then
     1.8 +			echo "It look like you alrady sended this distro to the DB"
     1.9 +			exit 0
    1.10 +		fi
    1.11  		user="$2"
    1.12  		[ "$user" ] || user="anonymous"
    1.13  		country=$(get_geoloc)
    1.14 @@ -71,7 +75,8 @@
    1.15  		wget -q --user-agent "SliTaz/SDT" \
    1.16  "${url}?sdt=add&user=${user}&country=${country}&release=${release}&kernel=${kernel}&mode=${mode}" \
    1.17  			-O ${tmp} && cat ${tmp} && rm ${tmp}
    1.18 -		;;
    1.19 +		mkdir -p ${HOME}/.cache/slitaz
    1.20 +		echo "sent" > ${HOME}/.cache/slitaz/sdt.log ;;
    1.21  	*)
    1.22  		newline
    1.23  		echo "$(boldify 'Usage:') $(basename $0) [get-stats|send] [username]"