2024-11-05 16:47:45 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
set -l dir (status dirname)
|
|
|
|
set -l container valhalla-test
|
|
|
|
set -l containerDir "/var/lib/lxc/$container"
|
|
|
|
set -l valhallaRoot "opt/PortValhalla"
|
|
|
|
sudo lxc-stop "$container"
|
|
|
|
sudo lxc-destroy "$container"
|
|
|
|
sudo lxc-create "$container" -t download -- --dist archlinux --release current --arch amd64
|
|
|
|
sudo mkdir -p "$containerDir/rootfs/$valhallaRoot"
|
|
|
|
|
|
|
|
begin
|
|
|
|
printf "%s\n" \
|
2024-11-10 11:56:34 +00:00
|
|
|
"" \
|
|
|
|
"# Docker" \
|
2024-11-05 16:47:45 +00:00
|
|
|
"lxc.apparmor.profile = unconfined" \
|
|
|
|
"" \
|
|
|
|
"# Shared Folder" \
|
2024-11-10 11:56:48 +00:00
|
|
|
"lxc.mount.entry = $(realpath "$dir/../..") $valhallaRoot none bind 0 0" \
|
|
|
|
"" \
|
|
|
|
"# VPN" \
|
|
|
|
"lxc.cgroup.devices.allow = c 10:200 rwm" \
|
|
|
|
"lxc.mount.entry = /dev/net dev/net none bind,create=dir 0 0"
|
2024-11-05 16:47:45 +00:00
|
|
|
end | sudo tee -a "$containerDir/config" > /dev/null
|
|
|
|
|
|
|
|
sudo lxc-start "$container"
|
|
|
|
|
|
|
|
while not sudo lxc-attach "$container" -- ping -q -c1 5.9.164.112 &>/dev/null
|
|
|
|
sleep .1
|
|
|
|
end
|
|
|
|
|
|
|
|
sudo lxc-attach "$container" -- systemctl start systemd-networkd-wait-online.service
|
2024-11-06 02:33:01 +00:00
|
|
|
sudo lxc-attach "$container" -- ln -s (readlink /etc/localtime) /etc/localtime
|
2024-11-05 16:47:45 +00:00
|
|
|
sudo lxc-attach "$container" -- pacman --noconfirm -Syu fish
|
|
|
|
sudo lxc-attach "$container" -- "/$valhallaRoot/scripts/arch-install.fish"
|