build-debian-toolbox: Avoid deb.debian.org
[bin.git] / build-debian-toolbox
1 #!/bin/sh
2 set -eux
3
4 RELEASE=${1:-sid}
5 DISTRO=${2:-debian}
6
7 toolbox rm -f $RELEASE || true
8 toolbox -y create -c $RELEASE --image docker.io/$DISTRO:$RELEASE
9
10 # can't do that with toolbox run yet, as we need to install sudo first
11 podman start $RELEASE
12 podman exec -it $RELEASE sh -exc '
13 # https://bugzilla.redhat.com/show_bug.cgi?id=1785244, https://github.com/containers/toolbox/pull/380
14 if [ ! -e /etc/resolv.conf ]; then
15     ln -sfn /run/host/monitor/resolv.conf /etc/resolv.conf
16 fi
17
18 # go-faster apt/dpkg
19 echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/unsafe-io
20
21 # location based redirector gets it wrong with company VPN
22 sed -i "s/deb.debian.org/ftp.de.debian.org/" /etc/apt/sources.list
23
24 apt-get update
25 apt-get install -y libnss-myhostname sudo eatmydata libcap2-bin
26
27 # allow sudo with empty password
28 sed -i "s/nullok_secure/nullok/" /etc/pam.d/common-auth
29 '
30
31 toolbox run --container $RELEASE sh -exc '
32 # otherwise installing systemd fails
33 sudo umount /var/log/journal
34
35 # useful hostname
36 . /etc/os-release
37 echo "${ID}-${VERSION_ID:-sid}" | sudo tee /etc/hostname
38 sudo hostname -F /etc/hostname
39
40 sudo eatmydata apt-get -y dist-upgrade
41
42 # development tools
43 sudo eatmydata apt-get install -y --no-install-recommends git-buildpackage libwww-perl less vim lintian debhelper manpages-dev git dput pristine-tar bash-completion wget gnupg ubuntu-dev-tools python3-debian fakeroot libdistro-info-perl
44 '
45
46 toolbox enter --container $RELEASE