View difference between Paste ID: iM25urRw and fQ0tx8ix
SHOW: | | - or go back to the newest paste.
1
#!/bin/sh
2
3
####
4
## Little script to trust developer and TU keys from arch team. Needed for pacman 4
5
## Usefull if you plan to use that feature.
6
##
7
## Aitor ATuin
8
##
9-
## Use at your risk :)
9+
## Use at your own risk :)
10
###
11
12-
echo "Trusting developers keys"
12+
13-
for key in `curl https://www.archlinux.org/developers/ 2>/dev/null| awk -F'<' '$0 ~ />0x/ {sub(/^.+>0x/,"",$3);print($3)}'`; do
13+
function trust () {
14-
    echo Importing $key
14+
    url=$1
15-
    /usr/bin/pacman-key --recv-keys $key
15+
    for key in `curl $url 2>/dev/null| awk -F'<' '$0 ~ />0x/ {sub(/^.+>0x/,"",$3);print($3)}'`; do
16-
    /usr/bin/pacman-key --lsign-key $key
16+
        /usr/bin/pacman-key --recv-keys $key
17-
    printf 'trust\n3\nquit\n' | gpg --homedir /etc/pacman.d/gnupg --no-permission-warning --command-fd 0 --edit-key $key
17+
        /usr/bin/pacman-key --lsign-key $key
18-
done
18+
        printf 'trust\n3\nquit\n' | gpg --homedir /etc/pacman.d/gnupg --no-permission-warning --command-fd 0 --edit-key $key
19
    done
20-
echo "Trusting TU keys"
20+
21-
for key in `curl https://www.archlinux.org/trustedusers/ 2>/dev/null| awk -F'<' '$0 ~ />0x/ {sub(/^.+>0x/,"",$3);print($3)}'`; do
21+
}
22-
    echo Importing $key
22+
23-
    /usr/bin/pacman-key --recv-keys $key
23+
BASEURL="https://www.archlinux.org"
24-
    /usr/bin/pacman-key --lsign-key $key
24+
for url in `echo developers trustedusers`; do
25-
    printf 'trust\n3\nquit\n' | gpg --homedir /etc/pacman.d/gnupg/ --no-permission-warning --command-fd 0 --edit-key $key
25+
    trust ${BASEURL}/${url}/
26
done