+ if [ "${fstype}" = "unknown" ]
+ then
+ panic "Unknown file system type on ${backdev} (${image})"
+ fi
+
+ mkdir -p "${croot}/${imagename}"
+ echo "debug: Can not mount backdev ${backdev} (image = ${image}) on croot/imagename ${croot}/${imagename}"
+ mount -t "${fstype}" -o ro,noatime,nodiratime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
+ fi
+ done
+
+ rofsstring=${rofsstring%:}
+
+ mkdir -p /cow
+ cowdevice="tmpfs"
+ cow_fstype="tmpfs"
+
+ # Looking for "${root_persistence}" device or file
+ if [ -n "${PERSISTENT}" ]
+ then
+ cowprobe=$(find_cow_device "${root_persistence}")
+
+ if [ -b "${cowprobe}" ]
+ then
+ cowdevice=${cowprobe}
+ cow_fstype=$(get_fstype "${cowprobe}")
+ else
+ [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium"
+ fi
+ fi
+
+ mount ${cowdevice} -t ${cow_fstype} -o rw,noatime,nodiratime /cow || panic "Can not mount ${cowdevice} on /cow"
+
+ mount -t ${UNIONTYPE} -o noatime,nodiratime,dirs=/cow=rw:${rofsstring} ${UNIONTYPE} "${rootmnt}" || panic "${UNIONTYPE} mount failed"
+
+ # Adding other custom mounts
+ if [ -n "${PERSISTENT}" ]
+ then
+ # directly mount /home
+ # FIXME: add a custom mounts configurable system
+ homecow=$(find_cow_device "${home_persistence}" )
+
+ if [ -b "${homecow}" ]
+ then
+ mount -t $(get_fstype "${homecow}") -o rw,noatime,nodiratime "${homecow}" "${rootmnt}/home"
+ export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
+ else
+ [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium"
+ fi
+
+ # Look for other snapshots to copy in
+ try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
+ try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
+ fi
+
+ if [ -n "${SHOWMOUNTS}" ]
+ then
+ for d in ${rofslist}
+ do
+ mkdir -p "${rootmnt}/live/${d##*/}"
+
+ case d in
+ *.dir)
+ # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+
+ *)
+ mount --move "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+ esac
+ done
+ fi
+
+ # shows cow fs on /cow for use by live-snapshot
+ mkdir -p "${rootmnt}/live/cow"
+ mount -o move /cow "${rootmnt}/live/cow"