#!/bin/sh
# Mount the clean live image for Calamares' unpackfs at /run/das-installer/root.
#
# Dracut runs the live root as a device-mapper snapshot (live-rw) that also
# holds the live user and boot-time tweaks. Its origin, live-base, is the
# untouched LiveOS/rootfs.img; mount it read-only without journal replay.
set -eu

root=/run/das-installer/root
mountpoint -q "$root" && exit 0

if [ ! -b /dev/mapper/live-base ]; then
	echo "mount-source: /dev/mapper/live-base not found, is this the live system?" >&2
	exit 1
fi
mkdir -p "$root"
mount -o ro,noload /dev/mapper/live-base "$root"
