File: run-test

package info (click to toggle)
keyring-pass 0.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: python: 186; sh: 33; makefile: 2
file content (47 lines) | stat: -rwxr-xr-x 1,004 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

# Exit immediately if a command exits with a non-zero status.
set -efu

cd "$AUTOPKGTEST_TMP"

# generate one gpg key 

export GNUPGHOME=/root/
chmod 700 $GNUPGHOME

echo "Generating a GPG key (non-interactive)..."
cat > gpg.conf <<EOF
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: asd
Name-Email: test@example.com
Expire-Date: 0
%no-protection
%commit
EOF

gpg --batch --generate-key gpg.conf

GPG_ID=$(gpg --list-keys --with-colons | grep '^pub' | head -n 1 | cut -d: -f5)

echo "Initializing a temporary Password Store with GPG key $GPG_ID..."
TEMP_PASS_DIR=$(mktemp -d)
export PASSWORD_STORE_DIR="$TEMP_PASS_DIR"
pass init "$GPG_ID"

echo "Configuring keyring backend..."
mkdir -p /root/.config/python_keyring
cat > /root/.config/python_keyring/keyringrc.cfg <<EOL
[backend]
default-keyring = keyring_pass.PasswordStoreBackend
EOL

echo "Setup completed. Running test..."
python3 -m keyring_pass

echo "Cleaning up..."
rm -rf "$TEMP_PASS_DIR"
rm -f gpg.conf