From ec05936d2f76648abb3cd451470c9862831a0785 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Sat, 29 Aug 2026 21:04:35 +0200 Subject: [PATCH] Add Arch Linux example --- example/archlinux/Containerfile | 23 +++++++++++++++++++++++ example/archlinux/init | 30 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 example/archlinux/Containerfile create mode 100644 example/archlinux/init diff --git a/example/archlinux/Containerfile b/example/archlinux/Containerfile new file mode 100644 index 0000000..6d16cbf --- /dev/null +++ b/example/archlinux/Containerfile @@ -0,0 +1,23 @@ +# FROM archlinux:latest +FROM marvin + + +USER root + +# Update, install kernel, initramfs tools, and utilities +# 'linux' includes mkinitcpio hooks that auto-generate the initramfs +RUN pacman -Syu --noconfirm linux busybox util-linux dhcpcd; \ + pacman -Sc --noconfirm + +# Copy kernel and initramfs to root for VM extraction +RUN cp /boot/vmlinuz-linux /vmlinuz && \ + cp /boot/initramfs-linux.img /initrd.img + +# Allow root login without password +RUN passwd -d root + +# Set up timezone. Required to bypass archlinux's first-install setup. +RUN ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime + +COPY init /init +RUN chmod +x /init diff --git a/example/archlinux/init b/example/archlinux/init new file mode 100644 index 0000000..28c7a54 --- /dev/null +++ b/example/archlinux/init @@ -0,0 +1,30 @@ +#!/bin/sh + +# Mount special filesystems +mkdir -p /dev /proc /sys +[ -c /dev/console ] || mknod -m 600 /dev/console c 5 1 +mount -t proc proc /proc +mount -t sysfs sysfs /sys +mount -t devtmpfs dev /dev + +# Networking +echo slim > /proc/sys/kernel/hostname +modprobe virtio_net +ip link set lo up 2>/dev/null +ip link set eth0 up 2>/dev/null +# udhcpc -i eth0 -f -q # Get DHCP lease + +echo +echo 'Welcome to slim!' +echo + +# Start systemd +exec /sbin/init + +# Or, just run a shell +# /bin/sh /dev/console 2>&1 +# poweroff -f +# while true; do +# sleep 1 +# poweroff -f +# done