systemd-container1/machine-import.sh
2024-05-25 20:45:34 +02:00

23 lines
696 B
Bash

#!/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"