]> piware.de Git - bin.git/blob - build-debian-toolbox
build-debian-toolbox: Fix slow sudo
[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 podman pull docker.io/$DISTRO:$RELEASE
9 toolbox -y create -c $RELEASE --image docker.io/$DISTRO:$RELEASE
10
11 # can't do that with toolbox run yet, as we need to install sudo first
12 podman start $RELEASE
13 podman exec -it $RELEASE sh -exc '
14 # go-faster apt/dpkg
15 echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/unsafe-io
16
17 # otherwise installing systemd fails
18 umount /var/log/journal
19
20 # enable sources
21 if [ -e /etc/apt/sources.list.d/debian.sources ]; then
22     sed -i "/^Types:/ s/deb$/deb deb-src/" /etc/apt/sources.list.d/debian.sources
23 fi
24
25 apt-get update
26 apt-get install -y libnss-myhostname sudo eatmydata libcap2-bin
27
28 # allow sudo with empty password
29 sed -i "s/nullok_secure/nullok/" /etc/pam.d/common-auth
30
31 # unbreak slow host name resolution
32 sed -i "/^hosts:/ s/files dns myhostname/files myhostname dns/" /etc/nsswitch.conf
33 '
34
35 toolbox run --container $RELEASE sh -exc '
36 # useful hostname
37 . /etc/os-release
38 echo "${ID}-${VERSION_ID:-sid}" | sudo tee /etc/hostname
39 sudo hostname -F /etc/hostname
40
41 sudo eatmydata apt-get -y dist-upgrade
42
43 # development tools
44 sudo eatmydata apt-get install -y --no-install-recommends build-essential 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 openssh-client
45
46 # autopkgtest
47 sudo eatmydata apt-get install -y --no-install-recommends autopkgtest qemu-system-x86 qemu-utils genisoimage
48 '
49
50 toolbox enter --container $RELEASE