comparison support/general/pgpshow.sh @ 0:bce86c4163a3

Initial revision
author kono
date Mon, 18 Apr 2005 23:46:02 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bce86c4163a3
1 #! /bin/sh
2
3 CMD=$1 SHOW=more REFILE=N
4
5 X=$2.tmp Y=$2.out Z=$2
6 trap "rm -f $X $Y" 0 1 2 3 13 15
7
8 shift; shift
9 for A in $*; do
10 A="`echo $A | tr A-Z a-z`"
11 case "$A" in
12 format=*)
13 if [ "$A" = "format=mime" ]; then
14 SHOW="show -file"
15 REFILE=T
16 fi
17 ;;
18
19 x-*)
20 ;;
21
22 *) echo "usage: pgpshow -store/-show file"
23 exit 1
24 ;;
25 esac
26 done
27
28 case "$CMD" in
29 -show) rm -f $X $Y
30 if pgp $Z -o $X | tee $Y; then
31 PGP_SIGNATURE=`grep "^Good signature from user " $Y | sed -e 's%^Good signature from user "\(.*\)".$%\1%'`
32 export PGP_SIGNATURE
33 $SHOW $X
34 else
35 exit 1
36 fi
37 ;;
38
39 -store) cat > $X
40 pgp $X -o $Z
41 if [ "$REFILE" = "T" ]; then
42 refile -file $Z +inbox
43 fi
44 ;;
45
46 *) echo "usage: pgpshow -store/-show file"
47 exit 1
48 ;;
49 esac
50
51 exit 0