mirror of
https://github.com/archlinux-jerry/archlinux-jerry-keyring
synced 2024-11-23 14:30:40 +08:00
78 lines
2.3 KiB
Bash
78 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
export LANG=C
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
trap "rm -rf '${TMPDIR}'" EXIT
|
|
|
|
#KEYSERVER='hkp://pool.sks-keyservers.net'
|
|
KEYSERVER='hkp://keyserver.ubuntu.com'
|
|
GPG="gpg --quiet --batch --no-tty --no-permission-warning --keyserver "${KEYSERVER}" --homedir ${TMPDIR}"
|
|
|
|
pushd "$(dirname "$0")" >/dev/null
|
|
|
|
$GPG --gen-key <<EOF
|
|
%echo Generating JerryXiao Keyring keychain master key...
|
|
Key-Type: RSA
|
|
Key-Length: 4096
|
|
Key-Usage: sign
|
|
Name-Real: JerryXiao Keyring Keychain Master Key
|
|
Name-Email: jerryxiao-keyring@localhost
|
|
Expire-Date: 0
|
|
%no-protection
|
|
%commit
|
|
%echo Done
|
|
EOF
|
|
|
|
rm -rf master packager packager-revoked jerryxiao-trusted jerryxiao-revoked
|
|
mkdir master packager packager-revoked
|
|
|
|
while read -ra data; do
|
|
keyid="${data[0]}"
|
|
username="${data[@]:1}"
|
|
${GPG} --recv-keys ${keyid} &>/dev/null
|
|
printf 'minimize\nquit\ny\n' | \
|
|
${GPG} --command-fd 0 --edit-key ${keyid}
|
|
${GPG} --yes --lsign-key ${keyid} &>/dev/null
|
|
${GPG} --armor --no-emit-version --export ${keyid} >> master/${username}.asc
|
|
echo "${keyid}:4:" >> jerryxiao-trusted
|
|
done < master-keyids
|
|
${GPG} --import-ownertrust < jerryxiao-trusted 2>/dev/null
|
|
|
|
while read -ra data; do
|
|
keyid="${data[0]}"
|
|
printf "Receive ${keyid}"
|
|
${GPG} --recv-keys ${keyid} &>/dev/null
|
|
done < packager-keyids
|
|
while read -ra data; do
|
|
keyid="${data[0]}"
|
|
username="${data[@]:1}"
|
|
printf 'clean\nquit\ny\n' | \
|
|
${GPG} --command-fd 0 --edit-key ${keyid}
|
|
${GPG} --list-keys --with-colons ${keyid}
|
|
if ! ${GPG} --list-keys --with-colons ${keyid} 2>/dev/null | grep -q '^pub:f:'; then
|
|
echo "key is not fully trusted: ${keyid} ${username}"
|
|
else
|
|
${GPG} --armor --no-emit-version --export ${keyid} >> packager/${username}.asc
|
|
fi
|
|
done < packager-keyids
|
|
|
|
while read -ra data; do
|
|
keyid="${data[0]}"
|
|
username="${data[1]}"
|
|
${GPG} --recv-keys ${keyid} &>/dev/null
|
|
printf 'clean\nquit\ny\n' | \
|
|
${GPG} --command-fd 0 --edit-key ${keyid}
|
|
if ! ${GPG} --list-keys --with-colons ${keyid} 2>/dev/null | grep -q '^pub:f:'; then
|
|
${GPG} --armor --no-emit-version --export ${keyid} >> packager-revoked/${username}.asc
|
|
echo "${keyid}" >> jerryxiao-revoked
|
|
else
|
|
echo "key is still fully trusted: ${keyid} ${username}"
|
|
fi
|
|
done < packager-revoked-keyids
|
|
|
|
touch jerryxiao-trusted jerryxiao-revoked
|
|
|
|
cat master/*.asc packager/*.asc packager-revoked/*.asc > jerryxiao.gpg
|
|
|
|
popd >/dev/null
|