#!/bin/bash -e # vim: set ts=4 sw=4 sts=4 et : ### 04_install_qubes.sh : Prepare chroot instance as a Qubes template echo "--> Alpine linux 04_install_qubes.sh" DIST_NAME="alpinelinux" DIST_VER="v${DIST#alpine}" DIST_VER="${DIST_VER/3/3.}" if [ -z "${DIST_NAME}" ]; then error "Please provide DIST_NAME in environment." fi if [ -z "${DIST_VER}" ]; then error "Please provide DIST_VER in environment." fi APKTOOLS_CACHE_DIR="${CACHEDIR}/apk_cache" ALPINELINUX_VERSION=${DIST_VER:-latest-stable} QUBESALPINE_MIRROR="${QUBESALPINE_MIRROR:-https://lab.ilot.io/ayakael/repo-apk/-/raw}" QUBESALPINE_KEYFILE="${QUBESALPINE_KEYFILE:-antoine.martin@protonmail.com-5b3109ad.rsa.pub}" QUBES_REL="${QUBES_REL:-r4.1}" export APK_CACHE_DIR set -e if [ "$VERBOSE" -ge 2 ] || [ "$DEBUG" -gt 0 ]; then set -x fi echo " --> Adding Qubes custom repository..." su -c "echo '$QUBESALPINE_MIRROR/$ALPINELINUX_VERSION/qubes/$QUBES_REL' >> $INSTALLDIR/etc/apk/repositories" wget "$QUBESALPINE_MIRROR/$ALPINELINUX_VERSION/$QUBESALPINE_KEYFILE" -P "$INSTALLDIR"/etc/apk/keys echo " --> Synchronize resolv.conf..." cp /etc/resolv.conf "${INSTALLDIR}/etc/resolv.conf" echo " --> Updating apk repos..." "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \ "apk update; apk upgrade" echo " --> Installing mandatory qubes packages..." "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \ "apk add qubes-vm-dependencies" echo " --> Installing recommended qubes apps" "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \ "apk add qubes-vm-recommended qubes-vm-passwordless-root" echo " --> Updating template fstab file..." cat > "${INSTALLDIR}/etc/fstab" < Configuring system to our preferences..." # add hcv0 to inittab echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt220" >> "$INSTALLDIR"/etc/inittab # user and groups "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" addgroup qubes "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" addgroup user "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" adduser -D user -G user -s /bin/bash "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" addgroup user qubes # create /lib/modules for qubes-kernel module mount "${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" mkdir /lib/modules # lo device cat > "${INSTALLDIR}/etc/network/interfaces" <