#!/bin/sh # initialize a mock tree (if not already) and nspawn it set -eu ROOT=$(mock --print-root-path) [ -d "$ROOT" ] || mock --quiet --init mock --offline --install dnf less sudo mock --quiet --chroot -- sh -ec 'echo root:root | chpasswd; echo mockbuild:a | chpasswd; usermod -aG wheel mockbuild' sudo systemd-nspawn --boot --directory="$ROOT" --bind-ro="$HOME" --bind=/tmp