-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgpro-repo-add.sh
513 lines (492 loc) · 18 KB
/
pgpro-repo-add.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#!/bin/sh
# This script finds out which Postgresql for 1C 16 package repository is
# best suited for your linux distribution and adds it to your
# package manager. If repository is password protected, it would ask
# for your username and password and record them into package manager
# configuration.
REPO="http://repo.postgrespro.ru/1c/1c-16"
PRODUCT_NAME="Postgresql for 1C 16"
LISTNAME="postgresql-1c-16"
REPOUSER=
PASSWORD=
if [ "$(id -u)" -ne 0 ]; then
echo "This script should be run as root, because it updates "
echo "your package manager configuration"
exit 1
fi
if [ ! -f "/etc/os-release" ]; then
echo "/etc/os-release not found. It is either very all or misconfigured distribution" >&2
exit 1
fi
. /etc/os-release
case "$ID" in
debian|ubuntu)
PKGMGR=apt
top="$REPO/$ID"
# Some older version of Debian don't have version codename in
# /etc/os-release
if [ -z "$VERSION_CODENAME" ]; then
VERSION_CODENAME="$(echo "$VERSION"|sed -e 's/^.*(//' -e 's/).*$//')"
fi
distr="$VERSION_CODENAME"
;;
astra)
PKGMGR=apt
case "$VERSION_ID" in
*.*.*) distver="${VERSION_ID%.*}"
;;
*.*_*) distver="${VERSION_ID%_*}"
;;
*.*) distver="${VERSION_ID}"
;;
esac
if [ -z "$VARIANT_ID" ]; then
case "$VERSION_ID" in
*_arm)
VARIANT_ID="novorossijsk"
;;
*_x86-64)
VARIANT_ID="smolensk"
;;
*)
:
;;
esac
fi
top="$REPO/$ID-${VARIANT_ID:-smolensk}/$distver"
distr="${VERSION_CODENAME:-$VARIANT_ID}"
;;
osnova)
PKGMGR=apt
top=$REPO/$ID
distr=$VARIANT_ID
;;
altlinux)
PKGMGR=apt
# Determine architecture. We cannot get architecture neither from kernel
# (uname -m), nor from rpmbuild %{_arch} macro, because it doesn't
# properly distinguish between subparch on e2k when they are running
# in LXC containers. So we are trying to install packages for same
# archtecture as rpm package.
ARCH=$(rpm -q --qf="%{arch}" rpm)
if [ "$ARCH" = "e2kv5" ]||[ "$ARCH" = "e2kv6" ]; then
ARCH=e2kv4
fi
# Determine repository - we use different repositories for sp/spt and
# generic releases
case "$CPE_NAME" in
*:sp*:*)
DISTR=altlinux-spt
case "$VERSION_ID" in
7.*) DISTVERSION=7
;;
8.[01]) case "$ARCH" in
e2k*) DISTVERSION=8.2
;;
*) DISTVERSION=8
;;
esac
;;
8.*) DISTVERSION=8.2
;;
10)
DISTVERSION=10
;;
*) echo "Unknown version of Alt SP: $VERSION_ID";
exit 1;
;;
esac
;;
*) DISTR=altlinux
verid=${VERSION_ID#p}
DISTVERSION=${verid%%.*}
;;
esac
CHECK_URL=$REPO/$DISTR/$DISTVERSION/$ARCH/base/release
;;
alteros|goslinux|rhel|rosa)
DISTR=$ID
PKGMGR=yum
;;
redos)
DISTR=$ID
PKGMGR=yum
# We build different package for redos 7.2 and redos 7.3
case "$VERSION_ID" in
7.[012]*)
:
;;
*) FORCE_RELEASEVER=7.3
;;
esac
;;
centos|rocky|ol|almalinux|msvsphere)
DISTR=rhel
PKGMGR=yum
;;
rels)
PKGMGR=yum
case $VERSION in
*Helium*)
DISTR=rosa-el
;;
*Cobalt*)
DISTR=rosa-sx
;;
*)
echo "Unsupported distribution $PRETTY_NAME" >&2
exit 1
;;
esac
;;
sles|*suse*) PKGMGR=zypper
DISTR=sles
;;
*) echo "Unsupported distribution '$NAME'" 1>&2
exit 1
;;
esac
if [ "$PKGMGR" = "apt" ]; then
[ -z "$ARCH" ] && ARCH="$(dpkg --print-architecture)"
[ -z "$CHECK_URL" ] && CHECK_URL="$top/dists/$distr/main/binary-${ARCH}/Release"
repofile="/etc/apt/sources.list.d/${LISTNAME}.list"
elif [ "$PKGMGR" = "yum" ]; then
# We need to find out yum/dnf variables releasever and basearch
if [ -x /usr/bin/dnf ]; then
# Different distributions use different location for sysem python
# which execute dnf, so get right one from dnf itself
python=$(head -1 /usr/bin/dnf|sed 's/^#! *//')
yumvars=$(${python} -c 'import dnf; db = dnf.dnf.Base(); print(db.conf.substitutions["releasever"]+"/os/"+db.conf.substitutions["basearch"])')
else
yumvars=$(python -c 'import yum; yb = yum.YumBase(); print yb.conf.yumvar["releasever"]+"/os/"+yb.conf.yumvar["basearch"]'|tail -1)
fi
ARCH=${yumvars##*/}
if [ -n "$FORCE_RELEASEVER" ]; then
yumvars="$FORCE_RELEASEVER/os/$ARCH"
fi
CHECK_URL=$REPO/$DISTR/$yumvars/rpms/repodata/repomd.xml
repofile=/etc/yum.repos.d/${LISTNAME}.repo
else
CHECK_URL=$REPO/$DISTR/${VERSION_ID%%.*}/repodata/repomd.xml
repofile=/etc/zypp/repos.d/${LISTNAME}.repo
ARCH=$(rpm --eval '%{_arch}')
fi
if [ -f "$repofile" ]; then
echo "You have already added repository for $PRODUCT_NAME to your system."
echo "To upgrade your $PRODUCT_NAME packages use $PKGMGR install or"
echo "$PKGMGR upgrade command."
echo "If you are sure that you want to replace repository configuration,"
echo "remove ${repofile} and run this script again."
exit 1
fi
if [ "$ARCH" = "i386" ]; then
echo "Version ${VERSION_ID} of ${NAME} distribution is not supported" \
"for archtecture ${ARCH}" >&2
exit 1
fi
# Determine how to handle apt passwords
if [ "$PKGMGR" = "apt" ]; then
if [ -d /etc/apt/auth.conf.d ]; then
APT_AUTH_CONF=yes
else
APT_AUTH_CONF=no
fi
fi
if [ -x /usr/bin/wget ]; then
# Checking existence of repository
exitcode=99
while [ "$exitcode" -ne 0 ]; do
# We intend word splitting here - we subsituting 2 wget args when
# shell var REPOUSER is not empty.
wget -O - ${REPOUSER:+--user="$REPOUSER" --password="$PASSWORD"} "$CHECK_URL" >/dev/null
exitcode=$?
case "$exitcode" in
5) echo "SSL certificate verification error. Please check that you " >&2
echo "have up to date CA certificate bundle installed." >&2
if [ "$PKGMGR" = "apt" ]; then
echo "it is in the ca-certificates package." >&2
fi
exit 5
;;
8)
echo "Version ${VERSION_ID} of ${NAME} distribution is not supported" \
"for architecture ${ARCH}" >&2
exit 1
;;
6) echo "Repository $REPO is password protected" >&2
read -p "Please enter username ${REPOUSER:+(Press enter for $REPOUSER)}: " -r newuser
if [ -n "$newuser" ]; then
REPOUSER="$newuser"
fi
stty -echo
read -p "Please enter your password (wouldn't be echoed): " -r PASSWORD
echo ""
stty echo
;;
0) # repository testing is successful
:
esac
done
else
echo "WARNING: wget program not found. Cannot check repository access."
echo "If you have login/password to access repository, please write them"
if [ "$PKGMGR" = "apt" ]; then
if [ "$APT_AUTH_CONF" = "yes" ]; then
echo "into /etc/apt/auth.conf by hand. See apt_auth.conf(5)"
else
echo "into /etc/apt/sources.list.d/$LISTNAME.list by hand"
fi
else
echo "into repository configuration file"
fi
echo "Press ENTER to continue, Ctrl-C to abort"
read -r _
fi
if [ -d /etc/pki/rpm-gpg ]; then
keyfile=/etc/pki/rpm-gpg/RPM-GPG-KEY-POSTGRESPRO
else
keyfile=${HOME}/GPG-KEY-POSTGRESPRO
fi
cat > "$keyfile" << KEY-PGPRO
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFWdEjABCAC6QeLt0UJUQlDI2Z+R/y1OyOMU+5Te176I0+/Xpc2v5NsucW2M
kLTdOif0iW+q5h1djL+Pc5yu1fojZCvcihhbURnWECF52BmRnOC9jI0eTHq3fcPZ
IE3gqMJSn5sx2kJZ7n8XE0RbQ/hr51BLI+lzeqR3JAKBIqpVDKRrdP9Y1xVR/7Ne
q4FNR+osm6W4sM9G+TA/YADrWX3/TPXA4AN+2uNCNY0wK7em8V0oSZJVpEzvu5EP
djC6GX08XSvhPNo52o3u3tpFWH7ICw2BEYe672bJTjmi8wFgPW04pw49Jpvw4i1R
RhkpQqQ/b9bSveoNpvN32ElAJSaize76+q/TABEBAAG0KlJvYm90IChTaWduaW5n
IHJlcG9zKSA8ZGJhQHBvc3RncmVzcHJvLnJ1PokBOAQTAQIAIgUCVZ0SMAIbAwYL
CQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQf5rlpi0t8LQpKQgAuJkOKNdnCSCt
GbNTwAbk414UPYa2B1M1DD6MfcSd6NnJNBVtRoaSWWISQB6gP+/w1jmD8XZbj/oH
5HAHjOyh9Lb3z1xeMIQnBnfGtcqmU5QrF55Yi0H9G0s+fn9oodfNXqAa/zARpBw6
q3LRSBCjT50/XA5G3AzUr7fIDb68FmEOCQukzs0uWBr5fkrRC21b1DcuhzbBay8X
pnlpB+Ma1PTIFgRdRl/KwYTzO80TWFMCeYfXQRh8StuQxRcVCqnv4F6seHqmbL7A
vOZ7GMymsz/IRHGVk4eVC6/94Y3vkV/0eQ+Yom+NtAFnep6G4OhxIeviZ697eFYF
+j4YsyDD+g==
=Q7MS
-----END PGP PUBLIC KEY BLOCK-----
KEY-PGPRO
if [ -d /etc/apt/trusted.gpg.d ]; then
# /etc/apt/trusted.gpg.d should contain binary keys, not # ascii-armored
sed -n '/^$/,/=$/p' "$keyfile" | base64 -d > "/etc/apt/trusted.gpg.d/postgrespro.gpg"
rm -f "$keyfile"
fi
if [ "$ID" = "altlinux" ]; then
# Altlinux apt-rpm
# Check for apt-https which might be not installed
if [ ${REPO%%://} = "https" ] && ! rpm -q apt-https > /dev/null; then
echo "Package apt-https is required to access this pepository"
apt-get install -y apt-https || exit 1
fi
echo "# Repositiory for '$PRODUCT_NAME'" > "$repofile"
# Alt linux doesn't support apt auth.conf`x, so password should be
# into URL directly and list file itself protected from
# nonauthorized readers
if [ -n "$REPOUSER" ]; then
proto="${REPO%%://*}"
host="${REPO#*://}"
top="$proto://$REPOUSER:$PASSWORD@$host/$DISTR/$DISTVERSION"
chmod 0600 "/etc/apt/sources.list.d/$LISTNAME.list"
else
top="$REPO/$DISTR/$DISTVERSION"
fi
echo "rpm $top $ARCH pgpro" >> "${repofile}"
echo "rpm $top noarch pgpro" >> "${repofile}"
apt-get update
elif [ "$PKGMGR" = "apt" ]; then
# Check for apt-transport-https which might be not installed
if [ ${REPO%%://} = "https" ] && ! dpkg-query -W apt-transport-https > /dev/null; then
echo "Package apt-transport-https is required to access this pepository"
apt-get install -y apt-transport-https || exit 1
fi
echo "# Repositiory for '$PRODUCT_NAME'" > "$repofile"
echo "deb $top $distr main" >> "${repofile}"
if [ -n "$REPOUSER" ]; then
if [ "$APT_AUTH_CONF" = "yes" ]; then
repohost=${REPO#*://}
repohost=${repohost%%/*}
cat > "/etc/apt/auth.conf.d/${repohost}.conf" <<EOF
machine ${repohost}
login $REPOUSER
password $PASSWORD
EOF
chmod 0600 "/etc/apt/auth.conf.d/${repohost}.conf"
echo "Your username/password are saved to /etc/apt/auth.conf.d/${repohost}.conf"
else
sed -i "s!://!://$REPOUSER:$PASSWORD@!" "${repofile}"
chmod 0600 "${repofile}"
echo "Your username and password are saved in ${repofile}"
fi
fi
apt-get update
elif [ "$PKGMGR" = "yum" ]; then
# write epel public keys
# pgpro repository might contain packages copied from EPEL with their
# signatures, so we are adding EPEL keys to our gpg key file
cat >> "$keyfile" << KEYS-EPEL
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1
JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B
M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn
XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6
pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngUXGXW7Qzoefe+fV
QqJSm7Tq2q9oqVZ46J964waCRItRySpuW5dxZO34WM6wsw2BP2MlACbH4l3luqtp
Xo3Bvfnk+HAFH3HcMuwdaulxv7zYKXCfNoSfgrpEfo2Ex4Im/I3WdtwME/Gbnwdq
3VJzgAxLVFhczDHwNkjmIdPAlNJ9/ixRjip4dgZtW8VcBCrNoL+LhDrIfjvnLdRu
vBHy9P3sCF7FZycaHlMWP6RiLtHnEM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ycedH8iWyYgP/mF0W35BIn7NuuZwWhgR00n/VG
4nbKPOzTWbsP45awcmivdrS74P6mL84WfkghipdmcoyVb1B8ZP4Y/Ke0RXOnLhNe
CfrXXvuW+Pvg2RTfwRDtehGQPAgXbmLmz2ZkV69RGIr54HJv84NDbqZovRTMr7gL
9k3ciCzXCiYQgM8yAyGHV0KEhFSQ1HV7gMnt9UmxbxBE2pGU7vu3CwjYga5DpwU7
w5wu1TmM5KgZtZvuWOTDnqDLf0cKoIbW8FeeCOn24elcj32bnQDuF9DPey1mqcvT
/yEo/Ushyz6CVYxN8DGgcy2M9JOsnmjDx02h6qgWGWDuKgb9jZrvRedpAQCeemEd
fhEs6ihqVxRFl16HxC4EVijybhAL76SsM2nbtIqW1apBQJQpXWtQwwdvgTVpdEtE
r4ArVJYX5LrswnWEQMOelugUG6S3ZjMfcyOa/O0364iY73vyVgaYK+2XtT2usMux
VL469Kj5m13T6w==
=Mjs/
-----END PGP PUBLIC KEY BLOCK-----
KEYS-EPEL
#generate repo file
if [ -n "$FORCE_RELEASEVER" ]; then
RELEASEVER="$FORCE_RELEASEVER"
else
RELEASEVER="\$releasever"
fi
cat > "$repofile" << REPOFILE
[$LISTNAME]
name=$PRODUCT_NAME for $DISTR
baseurl=$REPO/$DISTR/$RELEASEVER/os/\$basearch/rpms
enabled=1
gpgcheck=1
gpgkey=file://$keyfile
REPOFILE
if [ -n "$REPOUSER" ]; then
chmod 0600 "$repofile"
echo "username=$REPOUSER" >> "$repofile"
echo "password=$PASSWORD" >> "$repofile"
fi
else
#write opensuse public key
#pgpro repository for SLES might contain packages from OpenSUSE
#So we are adding OpenSUSE keys to our GPG key file
cat >> "$keyfile" << KEYS-OPENSUSE
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.14.1 (NSS-3)
mQENBEkUTD8BCADWLy5d5IpJedHQQSXkC1VK/oAZlJEeBVpSZjMCn8LiHaI9Wq3G
3Vp6wvsP1b3kssJGzVFNctdXt5tjvOLxvrEfRJuGfqHTKILByqLzkeyWawbFNfSQ
93/8OunfSTXC1Sx3hgsNXQuOrNVKrDAQUqT620/jj94xNIg09bLSxsjN6EeTvyiO
mtE9H1J03o9tY6meNL/gcQhxBvwuo205np0JojYBP0pOfN8l9hnIOLkA0yu4ZXig
oKOVmf4iTjX4NImIWldT+UaWTO18NWcCrujtgHueytwYLBNV5N0oJIP2VYuLZfSD
VYuPllv7c6O2UEOXJsdbQaVuzU1HLocDyipnABEBAAG0NG9wZW5TVVNFIFByb2pl
Y3QgU2lnbmluZyBLZXkgPG9wZW5zdXNlQG9wZW5zdXNlLm9yZz6JATwEEwECACYC
GwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCU2dN1AUJHR8ElQAKCRC4iy/UPb3C
hGQrB/9teCZ3Nt8vHE0SC5NmYMAE1Spcjkzx6M4r4C70AVTMEQh/8BvgmwkKP/qI
CWo2vC1hMXRgLg/TnTtFDq7kW+mHsCXmf5OLh2qOWCKi55Vitlf6bmH7n+h34Sha
Ei8gAObSpZSF8BzPGl6v0QmEaGKM3O1oUbbB3Z8i6w21CTg7dbU5vGR8Yhi9rNtr
hqrPS+q2yftjNbsODagaOUb85ESfQGx/LqoMePD+7MqGpAXjKMZqsEDP0TbxTwSk
4UKnF4zFCYHPLK3y/hSH5SEJwwPY11l6JGdC1Ue8Zzaj7f//axUs/hTC0UZaEE+a
5v4gbqOcigKaFs9Lc3Bj8b/lE10Y
=i2TA
-----END PGP PUBLIC KEY BLOCK-----
KEYS-OPENSUSE
# add zypper repository
if [ -n "$REPOUSER" ]; then
proto=${REPO%://}
host=${REPO#://}
REPO=$proto://$REPOUSER:$PASSWORD@$host
fi
rpm --import "$keyfile" && rm -f "$keyfile"
zypper --gpg-auto-import-keys addrepo -f "$REPO/$DISTR/${VERSION_ID%%.*}" "$LISTNAME"
zypper --gpg-auto-import-keys refresh
fi