Debian Codegraph @

debian/tests/run-test

raw symbols SCIP
1 #!/bin/bash
2
3 # Exit immediately if a command exits with a non-zero status.
4 set -efu
5
6 cd "$AUTOPKGTEST_TMP"
7
8 # generate one gpg key
9
10 export GNUPGHOME=/root/
11 chmod 700 $GNUPGHOME
12
13 echo "Generating a GPG key (non-interactive)..."
14 cat > gpg.conf <<EOF
15 Key-Type: 1
16 Key-Length: 2048
17 Subkey-Type: 1
18 Subkey-Length: 2048
19 Name-Real: asd
20 Name-Email: [email protected]
21 Expire-Date: 0
22 %no-protection
23 %commit
24 EOF
25
26 gpg --batch --generate-key gpg.conf
27
28 GPG_ID=$(gpg --list-keys --with-colons | grep '^pub' | head -n 1 | cut -d: -f5)
29
30 echo "Initializing a temporary Password Store with GPG key $GPG_ID..."
31 TEMP_PASS_DIR=$(mktemp -d)
32 export PASSWORD_STORE_DIR="$TEMP_PASS_DIR"
33 pass init "$GPG_ID"
34
35 echo "Configuring keyring backend..."
36 mkdir -p /root/.config/python_keyring
37 cat > /root/.config/python_keyring/keyringrc.cfg <<EOL
38 [backend]
39 default-keyring = keyring_pass.PasswordStoreBackend
40 EOL
41
42 echo "Setup completed. Running test..."
43 python3 -m keyring_pass
44
45 echo "Cleaning up..."
46 rm -rf "$TEMP_PASS_DIR"
47 rm -f gpg.conf