-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-web-root.sh
235 lines (211 loc) · 9.14 KB
/
setup-web-root.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/bin/sh
# Exit on first error
set -e
# Create a directory to hold the web server files
mkdir -p /srv/www
# Change to the web root directory
cd /srv/www
#####################################################################
# Create all of the directories and simlinks
#####################################################################
# Loop through a list of directories to create
while read -r dir; do
mkdir -p "$dir"
done <<-EOF
internal
rclone
zoom
rstudio
shiftkey-desktop
termux
zotero
EOF
# Loop through a list of simlinks to create
# shellcheck disable=SC2086
while read -r link; do
ln -s $link
done <<-EOF
/mirror/tex-archive ./ctan
/mirror/rclone/deb ./rclone/deb
/mirror/rclone/rpm ./rclone/rpm
/mirror/zoom/deb ./zoom/deb
/mirror/zoom/rpm ./zoom/rpm
/mirror/rstudio/deb ./rstudio/deb
/mirror/rstudio/rpm ./rstudio/rpm
/mirror/apt-mirror/mirror/apt.packages.shiftkey.dev/ubuntu ./shiftkey-desktop/deb
/mirror/dnf-reposync/shiftkey ./shiftkey-desktop/rpm
/mirror/termux/termux-main ./termux/main
/mirror/termux/termux-root ./termux/root
/mirror/termux/termux-x11 ./termux/x11
/mirror/apt-mirror/mirror/zotero.retorque.re/file/apt-package-archive ./zotero/deb
EOF
#####################################################################
# Install all of the universal installation stubs
#####################################################################
# Define a function that returns the stub for a given package
get_stub() {
# Header of the stub should generally be the same
cat <<-'EOF'
#!/bin/sh
<!--#set var="repo_base_url" value="https://$host/$inc_foldername" -->
APP_NAME="<!--# echo var='inc_foldername' -->"
BASE_URL="<!--# echo var='repo_base_url' -->"
GPG_KEY="<!--# include file='./gpgkey' -->"
EOF
# If the first argument is nonempty, define DEB_REPO
if [ -n "$1" ]; then
echo "DEB_REPO=\"$1\""
fi
# If the second argument is nonempty, define RPM_REPO
if [ -n "$2" ]; then
echo "RPM_REPO=\"$2\""
fi
# Footer of the stub should generally be the same
cat <<-'EOF'
<!--# include file="/internal/universal-install.sh" -->
EOF
}
# Generate the stub for rclone
# shellcheck disable=SC2016
get_stub '$BASE_URL/deb any main' '[$APP_NAME]
name=$APP_NAME
baseurl=$BASE_URL/rpm/\$basearch
enabled=1
gpgcheck=0
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/$APP_NAME.asc' >./rclone/install.sh
# Generate the stub for zoom
# shellcheck disable=SC2016
get_stub '$BASE_URL/deb any main' '[$APP_NAME]
name=$APP_NAME
baseurl=$BASE_URL/rpm/\$basearch
enabled=1
gpgcheck=0
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/$APP_NAME.asc' >./zoom/install.sh
# Generate the stub for rstudio
# shellcheck disable=SC2016
get_stub '$BASE_URL/deb/jammy jammy main' '[$APP_NAME]
name=$APP_NAME
baseurl=$BASE_URL/rpm/el9/\$basearch
enabled=1
gpgcheck=0
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/$APP_NAME.asc' >./rstudio/install.sh
# Generate the stub for shiftkey-desktop
# shellcheck disable=SC2016
get_stub '$BASE_URL/deb any main' '[$APP_NAME]
name=GitHub Desktop
baseurl=$BASE_URL/rpm
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/$APP_NAME.asc' >./shiftkey-desktop/install.sh
# Generate the stub for zotero
# shellcheck disable=SC2016
get_stub '$BASE_URL/deb/ ./' >./zotero/install.sh
#####################################################################
# Create all of the keyfiles
#####################################################################
# Create the keyfiles for my self-signed repositories
tee ./rclone/gpgkey ./zoom/gpgkey ./rstudio/gpgkey >/dev/null <<-'EOF'
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGISxKwBEAC+EyYLsKTvF63M+y5YGdSjwo5CWQMaTXMGIXcTuIiWi2qN8um5
J1eQ8V8EpDPWWBya2/gxfsW21sjIBrTqdWlY7efEqoy0R7Tj/2H05mbfaigOZ0zJ
6umVDzsHegvWxAwoHX6HjPgk9YhPLrTeE7vsukWczIABJjHCeHT7k3H9fDQgSsfN
t4mL8vbdtkHhJ0ShhvLFZRjKtZgtoqisJ+DtfR+ga0c4U+x0YYnfBshGi8la2WQO
ZDtdD3uIbSlj8gKKV+M33RPYkY0fy6b+7c+BoHSLWpxPNiVUSUrKATLmUnjernzM
SND6sBIiLh7tAlpZxdCmv4k4s2lztVDbQzLOU/N0/46qnMP0eoiyq8zgjng+vFE/
5g391M1m5jPA0WpQdy6TgVTuDf/6usbOkYfMBYHfcCp+64qc5gEuypvV+eEj8uw2
XnH8L9Qlrb+jVYdtd9t35vgGlqknzzwWDOMBxF3XlH+/s+y6NZwgLnklTS6swhAL
lvuwPn9g/9Gb/vzYePp7jawE3Naqpcx7DwLu9U3XiSxO/GNM+5z886e0pmzzjNba
10g0KVQCESFUoMPY3xzgZXNTanvlnPQoVb5F5dsYgqnAu3i/TN58ZomFp3VwD11N
xeXJqiQnwMkh24Ynl5jrkB+61REnNxDo3Jo+EB64gZh/2GRUGN4hLy3eAQARAQAB
tC5NYXR0aGV3IFdpbGRyaWNrIFRob21hcyAocmVwbykgPG1pcnJvckBtd3QubWU+
iQJOBBMBCgA4FiEEGIZ+I4kzXcYUee2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kc3IW4hzXogE9lsn7HNlaadJXJdT+
gQo+UmLTZRwcf4Uy1DsK5VvMaR5WLVtdAOBj/yeXkLMpLxIs32lW85DpYO8vYW9i
6NgcvtS2QJSTKA==
=GSyU
-----END PGP PUBLIC KEY BLOCK-----
EOF
# Create the keyfiles for shiftkey-desktop
tee ./shiftkey-desktop/gpgkey >/dev/null <<-'EOF'
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEY/JlqBYJKwYBBAHaRw8BAQdAVplbujSODiiIcIxhg+xK7YGyK4nIpY/ZdnqL
yi8SHVO0LUJyZW5kYW4gRm9yc3RlciA8cGFja2FnZXNAYnJlbmRhbmZvcnN0ZXIu
Y29tPoiWBBMWCgA+FiEETgKjVqGDFLAKSB8Gf8l5AosZl8EFAmPyZagCGwMFCQlm
AYAFCwkIBwMFFQoJCAsFFgMCAQACHgECF4AACgkQf8l5AosZl8EbYAEAouvPKHOb
zmvBIC9ONp3Zu69+Tx8JoKrfKm+zIfuTCXsBAMKEIXP9UyxF191LLU7aOrXVRJ2y
8uqXsG/vu4BpKy8DuDgEY/JlqBIKKwYBBAGXVQEFAQEHQFbHIiBMgeWt9/3UlhAE
IZS+aVIRCS73Nr+Io8mDjZUkAwEIB4h+BBgWCgAmFiEETgKjVqGDFLAKSB8Gf8l5
AosZl8EFAmPyZagCGwwFCQlmAYAACgkQf8l5AosZl8HHogEArWvwl3DRFr9NiPL1
wv/zC0KaZ2Rg0heEwACmGtg0e9cBAJhm7kV0Cvg7CU4w8sfabNXiXWelOyRnLPR1
pX8lwGQE
=Hv1H
-----END PGP PUBLIC KEY BLOCK-----
EOF
# Create the keyfiles for zotero
tee ./zotero/gpgkey >/dev/null <<-'EOF'
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFvK3/gBEACv/NhVuY9Ozwb5/vytXR4fzaJgZB/lmWF0A8mZocYiGHcRoXbT
6dPs923hjuESdVSIA8YmU7HIgWHml3HwqwOOGp+PiATX1wXeCUjsgWTvFXD5IBMF
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