Debian Codegraph @

debian/scripts/decrypt_gnupg-sc

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 if [scip-shell system . . `[`. -d "/cryptroot/gnupghomescip-shell filesystem . . `/cryptroot/gnupghome`." ]; then
4 export GNUPGHOME="/cryptroot/gnupghomescip-shell filesystem . . `/cryptroot/gnupghome`."
5 fi
6
7 run_gpgscip-shell shell shell-project 0.0.0 run_gpg().() {
8 gpgscip-shell system . . gpg. --no-options --trust-model=always "$@"
9 }
10 decrypt_gpgscip-shell shell shell-project 0.0.0 decrypt_gpg(). () {
11 local console _
12 if ! GPG_TTY="$(ttyscip-shell system . . tty.)"; then
13 read console _ </proc/consolesscip-shell filesystem . . `/proc/consoles`.
14 GPG_TTY="/dev/$console"
15 fi
16 export GPG_TTY
17
18 if ! run_gpgscip-shell shell shell-project 0.0.0 run_gpg(). --decrypt -- "$1"; then
19 return 1
20 fi
21 return 0
22 }
23
24 # `gpg-connect-agent LEARN /bye` is another (lighter) way, but it's
25 # harder to retrieve the return code
26 if ! run_gpgscip-shell shell shell-project 0.0.0 run_gpg(). --batch --quiet --no-tty --card-status >/dev/nullscip-shell filesystem . . `/dev/null`.; then
27 echoscip-shell system . . echo. "Please insert OpenPGP SmartCard..." >&2
28 until run_gpgscip-shell shell shell-project 0.0.0 run_gpg(). --batch --quiet --no-tty --card-status; do
29 sleepscip-shell system . . sleep. 1
30 done >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
31 fi
32
33 if [scip-shell system . . `[`. ! -x /usr/bin/gpgscip-shell filesystem . . `/usr/bin/gpg`. ]; then
34 echoscip-shell system . . echo. "$0: /usr/bin/gpg is not available" >&2
35 exit 1
36 fi
37
38 if [scip-shell system . . `[`. -z "$1" ] || [scip-shell system . . `[`. ! -f "$1" ]; then
39 echoscip-shell system . . echo. "$0: missing key as argument" >&2
40 exit 1
41 fi
42
43 decrypt_gpgscip-shell shell shell-project 0.0.0 decrypt_gpg(). "$1"
44 exit $?