slitaz-forge view usbkey/helper.sh @ rev 314

en: typo
author Paul Issott <paul@slitaz.org>
date Sun Jul 08 13:32:40 2012 +0100 (2012-07-08)
parents cce1cb7393b6
children 87d4ccc604d7
line source
1 #!/bin/sh
3 if [ "$1" == "--stats" ]; then
4 dir=$(dirname $0)/$2
5 if [ -n "$3" ]; then
6 sed 's/.*"\([0-9]* Gb\)".*/\1/' $dir/?/* | sort | awk '{
7 if ($0 != last && last != "") {
8 print last " : " n
9 n = 0
10 }
11 last = $0
12 n++
13 }
14 END {
15 print last " : " n
16 }'
17 else
18 ls $dir/?/* 2> /dev/null | wc -l
19 fi
20 exit
21 fi
23 DOMAIN="slitaz.org"
24 SERVER="127.0.0.1"
25 SUBJECT="usbkey.slitaz.org confirmation"
26 BCC="pascal.bellard@slitaz.org"
28 SENDTO="$1"
29 SURNAME="$2"
30 KEYSIZE="$3"
31 HASH="$4"
33 body()
34 {
35 cat <<EOT
36 From: usbkey-preorder@$DOMAIN
37 Reply-To: no-reply@$DOMAIN
38 To: $SENDTO
39 Date: $(date '+%a, %d %b %Y %H:%M:%S %z')
40 Subject: $SUBJECT
42 Hello $SURNAME,
44 A $KEYSIZE SliTaz USB key will be reserved for you.
45 Would you mind confirming the pre-ordering with the following link
46 http://usbkey.slitaz.org/?confirm=$HASH
48 Or cancel the registration with the following link
49 http://usbkey.slitaz.org/?cancel=$HASH
51 Thanks,
52 The SliTaz team.
53 EOT
54 }
56 send()
57 {
58 if [ -x /usr/sbin/sendmail ]; then
59 body | /usr/sbin/sendmail $SENDTO
60 else
61 /usr/bin/nc $SERVER 25 <<EOT
62 HELO $SERVER
63 MAIL FROM:<usbkey-preorder@$DOMAIN>
64 RCPT TO:$SENDTO
65 DATA
66 $(body)
68 .
69 QUIT
70 EOT
71 fi
72 }
74 send
75 SUBJECT="[bcc of $SENDTO] $SUBJECT"
76 for SENDTO in $BCC ; do
77 send
78 done