-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-deb.sh
executable file
·56 lines (45 loc) · 1.61 KB
/
install-deb.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
#!/bin/bash
set -x
set -euo pipefail
arch="${1}"
shift
# need to install certain local dependencies
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --assume-yes --no-install-recommends \
ca-certificates \
curl \
cpio \
sharutils \
gnupg
# get our debian sources
debsource="deb http://http.debian.net/debian/ buster main"
debsource="${debsource}\ndeb http://security.debian.org/ buster/updates main"
# temporarily use debian sources rather than ubuntu.
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "${debsource}" > /etc/apt/sources.list
dpkg --add-architecture "${arch}" || echo "foreign-architecture ${arch}" \
> /etc/dpkg/dpkg.cfg.d/multiarch
# Add Debian keys.
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{7.0,8,9,10}.asc' -O
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10}-security.asc' -O
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10}.asc' -O
curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2020,2021,2022}.key' -O
for key in *.asc *.key; do
apt-key add "${key}"
rm "${key}"
done
# allow apt-get to retry downloads
echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
apt-get update
for dep in $@; do
apt-get install "${dep}:${arch}" --assume-yes
done
# restore our old sources list
mv -f /etc/apt/sources.list.bak /etc/apt/sources.list
if [ -f /etc/dpkg/dpkg.cfg.d/multiarch.bak ]; then
mv /etc/dpkg/dpkg.cfg.d/multiarch.bak /etc/dpkg/dpkg.cfg.d/multiarch
fi
# can fail if arch is used (amd64 and/or i386)
dpkg --remove-architecture "${arch}" || true
apt-get update