- image_string="`echo ${image_string} | sed -e 's/ /\n/g' | sort `"
- fi
-
- mkdir -p "${croot}"
- for image in ${image_string}; do
- imagename=$(basename "${image}")
- if [ -d "${image}" ]; then
- # it is a plain directory: do nothing
- rofsstring="${image}=${roopt}:${rofsstring}"
- rofslist="${image} ${rofslist}"
- elif [ -f "${image}" ]; then
- backdev=$(get_backing_device "$image")
- fstype=$(get_fstype "${backdev}")
- if [ "${fstype}" = "unknown" ]; then
- panic "Unknown file system type on ${backdev} (${image})"
- fi
- mkdir -p "${croot}/${imagename}"
- mount -t "${fstype}" -o ro "${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 /cow || panic "Can not mount $cowdevice on /cow"
-
- mount -t ${UNIONTYPE} -o 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 "${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 bind /cow "${rootmnt}/live/cow"
+ image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
+ fi
+
+ [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
+
+ mkdir -p "${croot}"
+
+ for image in ${image_string}
+ do
+ imagename=$(basename "${image}")
+
+ if [ -d "${image}" ]
+ then
+ # it is a plain directory: do nothing
+ rofsstring="${image}=${roopt}:${rofsstring}"
+ rofslist="${image} ${rofslist}"
+ elif [ -f "${image}" ]
+ then
+ backdev=$(get_backing_device "${image}")
+ fstype=$(get_fstype "${backdev}")
+
+ 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 "${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 /cow || panic "Can not mount ${cowdevice} on /cow"
+
+ mount -t ${UNIONTYPE} -o noatime,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 "${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"