aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2022-03-11 19:49:26 -0500
committertdro <tdro@users.noreply.github.com>2022-03-11 19:49:26 -0500
commita257c143b10a7ff42a4e4cc6610b85698669fcbb (patch)
tree3c13fdd7d6b908b7eb291a7388300c5d87e00c01
parent5bffa79831a25b59ee6d9424e9ac5c3380b62d06 (diff)
downloaddotfiles-a257c143b10a7ff42a4e4cc6610b85698669fcbb.tar.gz
dotfiles-a257c143b10a7ff42a4e4cc6610b85698669fcbb.tar.bz2
dotfiles-a257c143b10a7ff42a4e4cc6610b85698669fcbb.zip
.config/lxc: Add build files
-rw-r--r--.bashrc2
-rw-r--r--.config/lxc/builds/almalinux8.dockerfile22
-rw-r--r--.config/lxc/builds/alpine3.15.dockerfile20
-rw-r--r--.config/lxc/builds/archlinux.dockerfile64
-rw-r--r--.config/lxc/builds/debian-bullseye11.dockerfile19
-rw-r--r--.config/lxc/builds/fedora35.dockerfile21
-rw-r--r--.config/lxc/builds/oracle8.dockerfile19
-rw-r--r--.config/lxc/builds/rockylinux8.dockerfile24
-rw-r--r--.config/lxc/builds/ubuntu-impish21.10.dockerfile19
-rw-r--r--.config/lxc/builds/void.dockerfile25
-rw-r--r--.config/lxc/default.conf8
-rwxr-xr-x.local/bin/lxc-build95
12 files changed, 337 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index 13654f0..66a7d8c 100644
--- a/.bashrc
+++ b/.bashrc
@@ -110,7 +110,7 @@ nix-which() { readlink "$(type -P "$1")"; }
# lxc helpers
lxc-copy() { A=$1 && B=$2 && shift 2 && $(type -P lxc-copy) --allowrunning --name "$A" -N "$B" "$@"; }
-lxc-shell() { lxc-attach "$1" -- /bin/sh -c 'export HOME="/root" && . /etc/profile && /bin/sh'; }
+lxc-shell() { lxc-start "$1" > /dev/null 2>&1 && lxc-attach "$1" -- /bin/sh -c 'export HOME="/root" && . /etc/profile && /bin/sh'; }
lxc-restart() { $(type -P lxc-stop) --kill --name "$1"; $(type -P lxc-start) -n "$1"; }
lxc-start() { for container in "$@"; do $(type -P lxc-start) --name "$container"; done }
lxc-stop() { for container in "$@"; do $(type -P lxc-stop) --kill --name "$container"; done }
diff --git a/.config/lxc/builds/almalinux8.dockerfile b/.config/lxc/builds/almalinux8.dockerfile
new file mode 100644
index 0000000..4b2532b
--- /dev/null
+++ b/.config/lxc/builds/almalinux8.dockerfile
@@ -0,0 +1,22 @@
+FROM docker.io/library/almalinux:8.5-20220306@sha256:cd49d7250ed7bb194d502d8a3e50bd775055ca275d1d9c2785aea72b890afe6a
+
+RUN dnf install --assumeyes --setopt=install_weak_deps=False epel-release \
+ && dnf --assumeyes update
+
+RUN dnf install --assumeyes --setopt=install_weak_deps=False \
+ openssh-server dhcp-client xauth vim htop
+
+RUN systemctl enable sshd
+
+RUN curl --silent https://raw.githubusercontent.com/dylanaraps/neofetch/ccd5d9f52609bbdcd5d8fa78c4fdb0f12954125f/neofetch \
+ --output /usr/bin/neofetch && chmod +x /usr/bin/neofetch
+
+RUN printf 'neofetch\n' >> /etc/profile
+RUN printf 'export TERM=linux\n' >> /etc/profile
+RUN printf 'dhclient\n' >> /etc/rc.d/rc.local && chmod +x /etc/rc.d/rc.local
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(alma) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(alma) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --groups wheel --create-home --user-group --password "$(uuidgen)" && printf ". /etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/alpine3.15.dockerfile b/.config/lxc/builds/alpine3.15.dockerfile
new file mode 100644
index 0000000..bcdf390
--- /dev/null
+++ b/.config/lxc/builds/alpine3.15.dockerfile
@@ -0,0 +1,20 @@
+FROM docker.io/library/alpine:3.15@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3
+
+RUN apk update
+
+RUN apk add openrc neofetch xauth openssh vim htop
+
+RUN rc-update add networking
+RUN rc-update add sshd
+
+RUN printf 'auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet dhcp\n' > /etc/network/interfaces
+
+RUN printf 'export TERM=xterm-256color\n' >> /etc/profile
+RUN printf 'id -u user > /dev/null 2>&1 || { adduser -u 1000 -g user user -D; }\n' >> /etc/profile
+
+RUN printf '. /etc/profile && neofetch\n' > /etc/profile.d/neofetch
+
+RUN printf "export ENV='/etc/profile.d/neofetch'\n" >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(alpine) \[\\e[0;31m\]\w\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(alpine) \[\\e[0;32m\]\w\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
diff --git a/.config/lxc/builds/archlinux.dockerfile b/.config/lxc/builds/archlinux.dockerfile
new file mode 100644
index 0000000..48d5fc8
--- /dev/null
+++ b/.config/lxc/builds/archlinux.dockerfile
@@ -0,0 +1,64 @@
+FROM docker.io/library/archlinux:base-devel-20220306.0.49442@sha256:bd9ac4ed9caf9a7e61ae1981d009d5b67fc419027f9cb87f7b2f45af737f44d6
+
+RUN pacman --noconfirm -Syu wget
+
+RUN printf '\
+[options] \n\
+ParallelDownloads = 5 \n\
+Architecture = auto \n\
+HoldPkg = pacman glibc \n\
+XferCommand = /usr/bin/wget --quiet --passive-ftp --show-progress --tries=1 --waitretry=1 --read-timeout=1 --continue --output-document %%o %%u \n\
+ \n\
+Color \n\
+VerbosePkgLists \n\
+LocalFileSigLevel = Optional \n\
+SigLevel = Required DatabaseOptional \n\
+ \n\
+[core] \n\
+Include = /etc/pacman.d/mirrorlist \n\
+ \n\
+[extra] \n\
+Include = /etc/pacman.d/mirrorlist \n\
+ \n\
+[community] \n\
+Include = /etc/pacman.d/mirrorlist \n\
+ \n\
+[options] \n\
+NoExtract = usr/share/help/* !usr/share/help/en* \n\
+NoExtract = usr/share/gtk-doc/html/* usr/share/doc/* \n\
+NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/* \n\
+NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.* \n\
+NoExtract = !usr/share/*locales/en_?? !usr/share/*locales/i18n* !usr/share/*locales/iso* \n\
+NoExtract = !usr/share/*locales/trans* \n\
+NoExtract = usr/share/man/* usr/share/info/* \n\
+NoExtract = usr/share/vim/vim*/lang/* \n\
+' > /etc/pacman.conf
+
+RUN pacman --noconfirm -Syu neofetch vim htop dhcpcd git go
+
+RUN cd /tmp \
+ && curl --remote-name https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz \
+ && tar --extract --file yay.tar.gz \
+ && chmod o+w yay
+
+RUN su -s /bin/sh -c 'cd /tmp/yay && export GOCACHE=/tmp/yay && makepkg --syncdeps --noconfirm --skippgpcheck' - nobody \
+ && pacman --noconfirm -U /tmp/yay/*.zst
+
+RUN pacman --noconfirm -Rns go gcc sudo
+
+RUN rm --recursive --force /tmp/yay /tmp/yay.tar.gz /var/cache/pacman/pkg
+
+RUN systemctl enable dhcpcd
+RUN systemctl mask sys-kernel-config.mount sys-kernel-debug.mount systemd-journald-audit.socket systemd-firstboot.service
+
+RUN printf 'permit :wheel\npermit nopass keepenv root\n' > /etc/doas.conf && chmod 400 /etc/doas.conf
+
+RUN printf 'export TERM=linux\n' >> /etc/profile
+RUN printf 'neofetch\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(arch) \[\\e[0;31m\]\w\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(arch) \[\\e[0;32m\]\w\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { useradd --uid 1000 --groups wheel --create-home --comment user user && printf ". ./etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/debian-bullseye11.dockerfile b/.config/lxc/builds/debian-bullseye11.dockerfile
new file mode 100644
index 0000000..ea106fb
--- /dev/null
+++ b/.config/lxc/builds/debian-bullseye11.dockerfile
@@ -0,0 +1,19 @@
+FROM docker.io/library/debian:bullseye-slim@sha256:7c78fedca85eec82669ff06969250175edac0750cb883628dfe7be18cb906928
+
+RUN apt update
+
+RUN apt install --no-install-recommends --assume-yes \
+ init uuid-runtime neofetch vim-tiny iproute2 dhcpcd5 xauth htop
+
+RUN systemctl mask sys-kernel-config.mount sys-kernel-debug.mount systemd-journald-audit.socket
+
+RUN ln --symbolic --force bash /bin/sh
+
+RUN printf 'export TERM=linux\n' >> /etc/profile
+RUN printf 'neofetch\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(debian) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(debian) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --gecos user --disabled-password && printf ". ./etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/fedora35.dockerfile b/.config/lxc/builds/fedora35.dockerfile
new file mode 100644
index 0000000..2b732c9
--- /dev/null
+++ b/.config/lxc/builds/fedora35.dockerfile
@@ -0,0 +1,21 @@
+FROM docker.io/library/fedora@sha256:762d7c5766839057fd9f96a0f2cedf143e2b818feb7767dc1bb70c00c4c3890a
+
+RUN dnf --assumeyes update
+
+RUN dnf install --assumeyes --setopt=install_weak_deps=False \
+ openssh-server iproute neofetch dhcp-client xauth htop
+
+RUN systemctl enable sshd
+RUN systemctl mask sys-kernel-config.mount sys-kernel-debug.mount systemd-journald-audit.socket
+
+RUN mkdir --parents /etc/rc.d
+RUN printf '#!/bin/sh -eu\ndhclient\n' > /etc/rc.d/rc.local && chmod +x /etc/rc.d/rc.local
+
+RUN printf 'neofetch\n' >> /etc/profile
+RUN printf 'export TERM=linux\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(fedora) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(fedora) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --groups wheel --create-home --user-group --password "$(uuidgen)" && printf ". ./etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/oracle8.dockerfile b/.config/lxc/builds/oracle8.dockerfile
new file mode 100644
index 0000000..2a440e0
--- /dev/null
+++ b/.config/lxc/builds/oracle8.dockerfile
@@ -0,0 +1,19 @@
+FROM docker.io/library/oraclelinux:8-slim@sha256:9c3ca322d552af7f20c3b80eea42e854487bcc5983b0ad66928c00e16c49d5e8
+
+RUN microdnf install epel-release && microdnf --assumeyes update
+
+RUN microdnf install --assumeyes openssh-server network-scripts dhcp-client neofetch htop
+
+RUN systemctl enable sshd
+
+RUN systemctl mask sys-kernel-config.mount sys-kernel-debug.mount rdisc.service
+
+RUN printf 'neofetch\n' >> /etc/profile
+RUN printf 'export TERM=linux\n' >> /etc/profile
+RUN printf 'dhclient\n' >> /etc/rc.d/rc.local && chmod +x /etc/rc.d/rc.local
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(oracle) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(oracle) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --groups wheel --create-home --user-group --password "$(uuidgen)" && printf ". /etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/rockylinux8.dockerfile b/.config/lxc/builds/rockylinux8.dockerfile
new file mode 100644
index 0000000..a220fbf
--- /dev/null
+++ b/.config/lxc/builds/rockylinux8.dockerfile
@@ -0,0 +1,24 @@
+FROM docker.io/library/rockylinux:8.5@sha256:8a94380717b7e6b21c56f8333e0e8242e89a020c0c861d6346f59f179f096240
+
+RUN dnf install --assumeyes --setopt=install_weak_deps=False epel-release \
+ && dnf --assumeyes update
+
+RUN dnf install --assumeyes --setopt=install_weak_deps=False \
+ openssh-server network-scripts dhcp-client xauth vim htop
+
+RUN systemctl enable network sshd
+
+RUN sed --in-place 's/ens3/eth0/' /etc/sysconfig/network-scripts/ifcfg-ens3
+
+RUN systemctl mask sys-kernel-config.mount sys-kernel-debug.mount
+
+RUN curl --silent https://raw.githubusercontent.com/dylanaraps/neofetch/ccd5d9f52609bbdcd5d8fa78c4fdb0f12954125f/neofetch \
+ --output /usr/bin/neofetch && chmod +x /usr/bin/neofetch
+RUN printf 'neofetch\n' >> /etc/profile
+RUN printf 'export TERM=linux\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(rocky) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(rocky) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --groups wheel --create-home --user-group --password "$(uuidgen)" && printf ". /etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/ubuntu-impish21.10.dockerfile b/.config/lxc/builds/ubuntu-impish21.10.dockerfile
new file mode 100644
index 0000000..1bd8b27
--- /dev/null
+++ b/.config/lxc/builds/ubuntu-impish21.10.dockerfile
@@ -0,0 +1,19 @@
+FROM docker.io/library/ubuntu:impish@sha256:4e4222975b1673cbbff799934fa00dc0b3191d0c9a7711f5b1d0b81fdcbfe6aa
+
+RUN apt update
+
+RUN apt install --no-install-recommends --assume-yes \
+ init uuid-runtime neofetch vim-tiny iproute2 dhcpcd5 xauth htop
+
+RUN systemctl mask sys-kernel-debug.mount
+
+RUN ln --symbolic --force bash /bin/sh
+
+RUN printf 'export TERM=linux\n' >> /etc/profile
+RUN printf 'neofetch\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(ubuntu) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(ubuntu) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { adduser user --uid 1000 --gecos user --disabled-password && printf ". ./etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
diff --git a/.config/lxc/builds/void.dockerfile b/.config/lxc/builds/void.dockerfile
new file mode 100644
index 0000000..07a74f0
--- /dev/null
+++ b/.config/lxc/builds/void.dockerfile
@@ -0,0 +1,25 @@
+FROM docker.io/voidlinux/voidlinux:latest@sha256:26ba972f0c06beadcec4796ec3037e0bec32af4d255edb68a528bd98304c74f4
+
+RUN xbps-install -Syu
+
+RUN xbps-install -y openssh dhcpcd iputils iproute2 socklog-void neofetch htop
+
+RUN mkdir --parents /run/runit/runsvdir
+
+RUN ln --symbolic --force bash /bin/sh
+RUN ln --symbolic /etc/runit/runsvdir/current /run/runit/runsvdir/current
+RUN ln --symbolic /etc/sv/sshd /var/service/
+RUN ln --symbolic /etc/sv/dhcpcd-eth0 /var/service/
+RUN ln --symbolic /etc/sv/socklog-unix /var/service/
+
+RUN printf 'neofetch\n' >> /etc/profile
+RUN printf 'export TERM=linux\n' >> /etc/profile
+
+RUN printf '{ [ "$(whoami)" = "root" ] && export PS1='\''(void) \[\\e[0;31m\]\W\[\\e[0m\] \[\\e[0;31m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+RUN printf '{ [ "$(whoami)" = "user" ] && export PS1='\''(void) \[\\e[0;32m\]\W\[\\e[0m\] \[\\e[0;32m\]\$\[\\e[0m\] '\''; } || true\n' >> /etc/profile
+
+RUN printf 'id --user 1000 > /dev/null 2>&1 || { useradd --uid 1000 --groups wheel --create-home --comment user user && printf ". ./etc/profile\n" >> /home/user/.bashrc; }\n' >> /etc/profile
+
+RUN usermod --password "$(uuidgen)" root
+
+
diff --git a/.config/lxc/default.conf b/.config/lxc/default.conf
index c6641f8..9bc4192 100644
--- a/.config/lxc/default.conf
+++ b/.config/lxc/default.conf
@@ -11,3 +11,11 @@ lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
+
+# Xorg configuration
+lxc.environment = DISPLAY=:1.0
+lxc.environment = XAUTHORITY=/home/user/.config/X11/Xauthority
+lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
+lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
+lxc.mount.entry = /dev/shm dev/shm none bind,optional,create=dir
+lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir,ro
diff --git a/.local/bin/lxc-build b/.local/bin/lxc-build
new file mode 100755
index 0000000..c9e41f5
--- /dev/null
+++ b/.local/bin/lxc-build
@@ -0,0 +1,95 @@
+#!/usr/bin/env runhaskell
+
+import System.Console.GetOpt
+import System.Environment
+import System.Exit
+import System.Process
+
+version :: Fractional p => p
+version = 0.01
+
+help :: [Char]
+help = unlines
+ [ ""
+ , "NAME"
+ , ""
+ , " lxc-build"
+ , ""
+ , "SYNOPSIS"
+ , ""
+ , " Create an lxc container named rockylinux with the specified Dockerfile"
+ , ""
+ , " lxc-build --name rockylinux rockylinux8.dockerfile"
+ , ""
+ , " Start the container after building"
+ , ""
+ , " lxc-build --start --name rockylinux rockylinux8.dockerfile"
+ , ""
+ , " Replace a container of the same name with the new build"
+ , ""
+ , " lxc-build --replace --name rockylinux rockylinux8.dockerfile"
+ , ""
+ , "DESCRIPTION"
+ , ""
+ , " Builds a lxc container from a Dockerfile"
+ , ""
+ , "COMMANDS"
+ , ""
+ , " -n, -name, --name The container name"
+ , " -c, -create, --create Create the container"
+ , " -h, -help, --help Shows this help menu"
+ , " -u, -user-map, --user-map User mapping id"
+ , " -g, -group-map, --group-map Group mapping id"
+ , " -r, -replace, --replace Replace container with new build"
+ , " -v, -version, --version Prints program version"
+ ]
+
+display = putStrLn
+
+main = do
+ arguments <- getArgs
+ case arguments of
+ ["--replace", "--name", name, dockerfile] -> do
+ callCommand ("\\lxc-destroy --force --name " ++ name ++ " |& \\true")
+ callCommand
+ ( "\\lxc-create --name "
+ ++ name
+ ++ " --template=none && \\mkdir ~/.local/share/lxc/"
+ ++ name
+ ++ "/rootfs"
+ )
+ callCommand ("\\docker build --file " ++ dockerfile)
+ callCommand
+ ( "id=$(\\docker run --detach \"$(\\docker build --file "
+ ++ dockerfile
+ ++ " | tail --lines=1)\" /bin/true) && \\docker export \"$id\" | \\tar --extract --directory ~/.local/share/lxc/"
+ ++ name
+ ++ "/rootfs && \\docker container rm \"$id\""
+ )
+ callCommand
+ ( "\\printf 'doas chown --recursive 200000:200000 ~/.local/share/lxc/"
+ ++ name
+ ++ "/rootfs\n'"
+ )
+ callCommand
+ ( "\\doas chown --recursive 200000:200000 ~/.local/share/lxc/"
+ ++ name
+ ++ "/rootfs"
+ )
+ callCommand
+ ( "\\printf 'lxc.uts.name = "
+ ++ name
+ ++ "\n' >> ~/.local/share/lxc/"
+ ++ name
+ ++ "/config"
+ )
+ callCommand
+ ( "\\printf \"lxc.rootfs.path = dir:$HOME/.local/share/lxc/"
+ ++ name
+ ++ "/rootfs\n\" >> ~/.local/share/lxc/"
+ ++ name
+ ++ "/config"
+ )
+ callCommand ("\\lxc-start --name " ++ name)
+ _ -> do
+ die help