Page MenuHomeSoftware Heritage
Paste P217

(An Untitled Masterwork)
ActivePublic

Authored by seirl on Jan 26 2018, 3:48 PM.
root@swh-test:~# cat setup_container.sh
#!/bin/bash
set -e
CONTAINER_NAME=orangeriedev
cd /var/lib/machines
apt install debootstrap systemd-container
if [ ! -d "$CONTAINER_NAME" ]; then
debootstrap stable "$CONTAINER_NAME" http://deb.debian.org/debian/
systemd-nspawn -D "$CONTAINER_NAME" /usr/bin/passwd
systemd-nspawn -D "$CONTAINER_NAME" apt install dbus
echo "$CONTAINER_NAME" >"$CONTAINER_NAME/etc/hostname"
fi
mkdir -p /etc/systemd/nspawn
cat >/etc/systemd/nspawn/"$CONTAINER_NAME".nspawn <<EOF
[Exec]
Boot=yes
[Files]
Bind=/mnt/$CONTAINER_NAME:/srv/softwareheritage
[Network]
Private=off
#VirtualEthernet=on
#Port=5005
EOF
systemctl daemon-reload
systemctl enable --now systemd-nspawn@"$CONTAINER_NAME".service
systemctl enable machines.target