]> piware.de Git - bin.git/commitdiff
Add mockboot: initialize a mock tree (if not already) and nspawn it
authorMartin Pitt <martin@piware.de>
Wed, 11 Jan 2017 10:18:27 +0000 (11:18 +0100)
committerMartin Pitt <martin@piware.de>
Sun, 22 Jan 2017 11:18:55 +0000 (12:18 +0100)
mockboot [new file with mode: 0755]

diff --git a/mockboot b/mockboot
new file mode 100755 (executable)
index 0000000..830427d
--- /dev/null
+++ b/mockboot
@@ -0,0 +1,10 @@
+#!/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