-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest-getuto.sh
executable file
·64 lines (47 loc) · 1.71 KB
/
test-getuto.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -x -e
whoami() {
# Bypass getuto's check for root as we're going to run in a fake tempdir.
echo root
}
export -f whoami
# Sanitize environment
export PORTAGE_GPG_DIR=
export PORTAGE_GPG_KEY=
# Keep the real root around before we override its value so we can grab a copy of
# gentoo-release.asc.
export REAL_ROOT="${ROOT%/}"
export ROOT="$(mktemp -d)"
mkdir -p "${ROOT}"/usr/share/openpgp-keys
ln -s "${REAL_ROOT}"/usr/share/openpgp-keys/gentoo-release.asc "${ROOT}"/usr/share/openpgp-keys/gentoo-release.asc
mkdir -p "${ROOT}"/tmp/binpkg
tar xvf libc-1-r1-1.gpkg.tar -C "${ROOT}"/tmp/binpkg
echo ==================================================================
echo Testing normal operation
echo
echo XXXXX Generate a keyring using getuto.
bash -x ./getuto
echo XXXXX Make sure the newly-generated keyring works.
for file in image.tar.xz metadata.tar.xz ; do
gpg --home "${ROOT%/}"/etc/portage/gnupg --verify "${ROOT}"/tmp/binpkg/libc-1-r1-1/${file}.sig
done
echo XXXXX Try to refresh an existing keyring.
bash -x ./getuto
# (no -x because we had a bug not found by tests which got confused by it)
echo XXXXX Try again to check too-soon logic.
bash ./getuto
echo XXXXX Clean up
rm -r "${ROOT%/}"/etc/portage/gnupg
echo ==================================================================
echo Testing verbose operation
echo
echo XXXXX Generate a keyring using getuto.
bash -x ./getuto -v
echo XXXXX Make sure the newly-generated keyring works.
for file in image.tar.xz metadata.tar.xz ; do
gpg --home "${ROOT%/}"/etc/portage/gnupg --verify "${ROOT}"/tmp/binpkg/libc-1-r1-1/${file}.sig
done
echo XXXXX Try to refresh an existing keyring.
bash -x ./getuto -v
echo XXXXX Clean up
rm -r "${ROOT%/}"/etc/portage/gnupg