32 lines
515 B
Bash
32 lines
515 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
read mode
|
||
|
|
||
|
|
||
|
if [ "$mode" = "key" ] ; then
|
||
|
output="$( (exec gpg --import > /dev/null) 2>&1 )"
|
||
|
if [ "$?" = 0 ] ; then
|
||
|
echo recv ok > /dev/stderr
|
||
|
else
|
||
|
echo recv bad > /dev/stderr
|
||
|
exit 1
|
||
|
fi
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
if [ "$mode" = "data" ] ; then
|
||
|
|
||
|
id=$!
|
||
|
stderr="$( (exec gpg -d > /tmp/$id.msg) 2>&1 )"
|
||
|
if [ $? = 0 ] && ! grep "WARNING" <<< "$stderr" > /dev/null ; then
|
||
|
echo recv sig ok > /dev/stderr
|
||
|
else
|
||
|
echo recv sig bad > /dev/stderr
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
cat /tmp/$id.msg
|
||
|
|
||
|
exit
|
||
|
fi
|