#! /usr/bin/env bash # check root [ ! $UID -eq 0 ] && echo "PLEASE RUN AS ROOT." && exit 1 mkdir -p /ramdisk/sys mkdir -p /ramdisk/tmp mkdir -p /ramdisk/persist ln -sf "$(pwd)"/bin/ramdisk.sh /usr/sbin/ ln -sf "$(pwd)"/bin/mkvm.sh /usr/sbin/ ln -sf "$(pwd)"/bin/editvm.sh /usr/sbin/ ln -sf "$(pwd)"/bin/gitlab-runner.sh /usr/sbin/ ln -sf "$(pwd)"/bin/gitlab-runner-helper.sh /usr/sbin/ ln -sf "$(pwd)"/ramdisk.service /etc/systemd/system/ systemctl daemon-reload ln -sf "$(pwd)"/templates/archlinux.template /var/lib/lxc/ ln -sf "$(pwd)"/templates/bullseye.template /var/lib/lxc/ ln -sf "$(pwd)"/templates/gitlab-runner.template /var/lib/lxc/ setup_debian() { apt install lxc debootstrap if [ ! -d /ramdisk/persist/bullseye ]; then mkdir /ramdisk/persist/bullseye debootstrap bullseye /ramdisk/persist/bullseye http://deb.debian.org/debian fi } setup_arch() { pacman -S lxc arch-install-scripts if [ ! -d /ramdisk/persist/archlinux ]; then mkdir /ramdisk/persist/archlinux pacstrap /ramdisk/persist/archlinux base vim htop tmux fi } if grep 'NAME="Debian GNU/Linux"' /etc/os-release; then setup_debian elif grep 'NAME="Arch Linux"' /etc/os-release; then setup_arch fi systemctl enable --now ramdisk