annotate trac-digest.sh @ 0:b78e329514b8

Add utils proj.
author Oleksander Gavenko <gavenko_a@3g.ua>
date Thu, 17 Jan 2008 21:44:13 +0200
parents
children b73ad8a02942
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
1 #!/bin/sh
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
2 # -*- mode: utf8-unix -*-
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
3
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
4 # In Public Domain.
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
5 # mail:gavenko_a@3g.ua
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
6
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
7 user=
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
8 pass=
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
9 status=
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
10
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
11 while [ "$1" ]; do
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
12 case "$1" in
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
13 -h|-help|--help)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
14 echo "Usage:"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
15 echo " > $0 [--help] -u <user> -p <pass>"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
16 echo "or with long options:"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
17 echo " > $0 [--help] --user=<user> --password=<pass>"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
18 exit 0
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
19 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
20 -u)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
21 shift
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
22 if [ "$1" == "" ]; then
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
23 echo "Could not found username."
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
24 exit 1
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
25 else
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
26 user="$1"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
27 status=o${status}
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
28 fi
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
29 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
30 "--user="*)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
31 user=${1#--user=}
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
32 status=o${status}
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
33 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
34 -p)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
35 shift
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
36 if [ "$1" == "" ]; then
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
37 echo "Could not found password."
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
38 exit 1
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
39 else
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
40 pass="$1"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
41 status=${status}k
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
42 fi
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
43 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
44 "--password="*)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
45 pass=${1#--password=}
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
46 status=${status}k
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
47 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
48 *)
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
49 echo "$1 unsuported options."
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
50 exit 1
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
51 ;;
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
52 esac
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
53
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
54 shift
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
55 done
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
56
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
57 if [ "$status" == "ok" ]; then
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
58 md=`echo -e "${user}:trac:${pass}\c" | md5sum --binary -`
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
59 md=${md% *-}
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
60
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
61 echo "${user}:trac:${md}"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
62 exit 0
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
63 else
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
64 echo "You give duplicate options. Try"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
65 echo " > $0 --help"
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
66 exit 1
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
67 fi
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
68
b78e329514b8 Add utils proj.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
69