summaryrefslogtreecommitdiff
path: root/README
blob: 8173f9af9c9eece3ce57b5d092841c60535b6913 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

####################################
#                                  #
# to be run as root ...            #
# or executed step by step as root #
#                                  #
####################################

set -e

################
#              #
# import keys: #
#              #
################

tmpFile="$(mktemp)"
curl -o "${tmpFile}" "https://arch.eckner.net/archlinuxewe/masterkeys.gpg"
pacman-key --add "${tmpFile}"
rm -f "${tmpFile}"

############################
#                          #
# locally sign package-key #
#                          #
############################

pacman-key --lsign-key 5FDCA472AB93292BC678FD59255A76DB9A12601A

###############################
#                             #
# locally sign repository-key #
#                             #
###############################

pacman-key --lsign-key F8028D351891AE15970A2B3B3CFB0AD8F60030F8

##############################
#                            #
# setup mirror in mirrorlist #
#                            #
##############################

if ! grep -q "^Server = https://arch\.eckner\.net" /etc/pacman.d/mirrorlist
then
  ml="$(
    curl "https://arch.eckner.net/archlinuxewe/os/any/" 2> /dev/null | \
      tr "<>" "\n\n" | \
      grep "^pacman-mirrorlist-.*\.pkg\.tar\.zst\$" | \
      tail -n1
  )"
  curl "https://arch.eckner.net/archlinuxewe/os/any/${ml}" 2> /dev/null | \
    tar -Ox --zstd etc/pacman.d/mirrorlist > \
    /etc/pacman.d/mirrorlist
fi

###################################
#                                 #
# setup repository in pacman.conf #
#                                 #
###################################

if ! grep -q "^\[archlinuxewe\]\$" /etc/pacman.conf
then
  tmpFile="$(mktemp)"
  cat /etc/pacman.conf | \
    (
      while read s
      do
        if [[ "$s" = "# The testing repositories"* ]]
        then
          echo '[archlinuxewe]'
          echo 'SigLevel = Required'
          echo 'Include = /etc/pacman.d/mirrorlist'
          echo ''
        fi
        echo "${s}"
      done
    ) > "${tmpFile}"
  cat "${tmpFile}" > /etc/pacman.conf
  rm -f "${tmpFile}"
fi