machine-import.sh

This commit is contained in:
holger 2024-05-25 20:45:34 +02:00
parent 2e191f4ab3
commit d20037b252

22
machine-import.sh Normal file

@ -0,0 +1,22 @@
#!/bin/sh
# import machine as tar.gz
_container="minimal"
#echo 'kernel.unprivileged_userns_clone=1' >/etc/sysctl.d/nspawn.conf
#systemctl restart systemd-sysctl.service
# enable host networking and set resolv.conf
mkdir -p /etc/systemd/nspawn
echo "[Exec]" >/etc/systemd/nspawn/"$_container".nspawn
echo "ResolvConf=off" >>/etc/systemd/nspawn/"$_container".nspawn
echo "" >>/etc/systemd/nspawn/"$_container".nspawn
echo "[Network]" >>/etc/systemd/nspawn/"$_container".nspawn
echo "VirtualEthernet=no" >>/etc/systemd/nspawn/"$_container".nspawn
machinectl import-tar $_container.tar.gz $_container
# TODO
echo "nameserver 8.8.8.8" >/var/lib/machines/$_container/etc/resolv.conf
echo "done"