summaryrefslogtreecommitdiff
path: root/passwort-tresor.in
blob: 9d6d3c6286e5ba997592e5bf8d04f1ede529612d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

. #ETCDIR#/passwort-tresor.konf

echo "Dienst: "
read dienst

tmpDir="$(mktemp -d)"

text="$(${passwortDateiBefehl} | gpg -o - -d - 2> "${tmpDir}/")"

if [ ! $(grep -c "Good signature from \"Erich Eckner \([^\"]*\)\?<erich@eckner.net>\"" ${tmpMsg}) -eq 1 ] || [ ! $(grep -c "Signature made .* using RSA key ID 0AEEC90755DA7B5A" ${tmpMsg}) -eq 1 ]
then
 dialog --textbox ${tmpMsg} 14 70
fi

rm -f ${tmpMsg}

[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="^${dienst}"
[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="${dienst}:\$"
[ $(echo -e "${text}" | grep -c "${dienst}") -eq 1 ] || exit 1

text="$(echo "${text}" | grep -2 "${dienst}" | tail -n2)"
echo "${text}" | head -n1 | xclip -i
echo -n "."
read dienst
echo "${text}" | tail -n1 | xclip -i
echo -n "."
read dienst