# is non-empty, remove mask from all source paths when
# creating links (will be necessary if we change root, which
# live-boot normally does (into $rootmnt)).
# is non-empty, remove mask from all source paths when
# creating links (will be necessary if we change root, which
# live-boot normally does (into $rootmnt)).
# remove multiple /:s and ensure ending on /
src_dir="$(trim_path ${1})/"
dest_dir="$(trim_path ${2})/"
# remove multiple /:s and ensure ending on /
src_dir="$(trim_path ${1})/"
dest_dir="$(trim_path ${2})/"
# This check can only trigger on the inital, non-recursive call since
# we create the destination before recursive calls
# This check can only trigger on the inital, non-recursive call since
# we create the destination before recursive calls
elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
then
mkdir -p ${rootmnt}/lib/live/mount/persistence
elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
then
mkdir -p ${rootmnt}/lib/live/mount/persistence
chown_ref "${source}" "${cow_dir}"
chmod_ref "${source}" "${cow_dir}"
do_union ${links_source} ${cow_dir} ${source} ${rootfs_dest_backing}
chown_ref "${source}" "${cow_dir}"
chmod_ref "${source}" "${cow_dir}"
do_union ${links_source} ${cow_dir} ${source} ${rootfs_dest_backing}
elif [ -n "${opt_union}" ] && [ -z "${PERSISTENCE_READONLY}" ]
then
do_union ${dest} ${source} ${rootfs_dest_backing}
elif [ -n "${opt_union}" ] && [ -z "${PERSISTENCE_READONLY}" ]
then
do_union ${dest} ${source} ${rootfs_dest_backing}