log_end_msg
fi
- mkdir -p /overlay
+ # tmpfs file systems
+ touch /etc/fstab
+ mkdir -p /live
+ mount -t tmpfs tmpfs /live
+ mkdir -p /live/overlay
# Looking for persistence devices or files
if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
if echo ${PERSISTENCE_METHOD} | grep -qe "\<overlay\>"
then
- overlays="${root_overlay_label} ${old_root_overlay_label} ${old_home_overlay_label} ${custom_overlay_label}"
+ overlays="${old_root_overlay_label} ${old_home_overlay_label} ${custom_overlay_label}"
fi
if echo ${PERSISTENCE_METHOD} | grep -qe "\<snapshot\>"
local root_snapdata=""
local home_snapshot_label=""
- local root_overlay_label=""
local overlay_devices=""
for media in $(find_persistence_media "${overlays}" "${snapshots}" "${whitelistdev}")
do
home_snapdata="${media#*=}"
fi
;;
- ${root_overlay_label}=*|${old_root_overlay_label}=*)
- if [ -z "${root_overlay_device}" ]
- then
- device="${media#*=}"
- root_overlay_device="${device}"
- fi
+ ${old_root_overlay_label}=*)
+ device="${media#*=}"
+ fix_backwards_compatibility ${device} / union
+ overlay_devices="${overlay_devices} ${device}"
;;
${old_home_overlay_label}=*)
device="${media#*=}"
- fix_home_rw_compatibility ${device}
+ fix_backwards_compatibility ${device} /home bind
overlay_devices="${overlay_devices} ${device}"
;;
${custom_overlay_label}=*)
;;
esac
done
-
- if [ -b "${root_overlay_device}" ]
- then
- PERSISTENCE_IS_ON="1"
- export PERSISTENCE_IS_ON
-
- cowdevice=${root_overlay_device}
- cow_fstype=$(get_fstype "${root_overlay_device}")
- if [ -z "${PERSISTENCE_READONLY}" ]
- then
- cow_mountopt="rw,noatime"
- else
- cow_mountopt="ro,noatime"
- fi
-
- if [ "${FORCEPERSISTENCEFSCK}" = "Yes" ]
- then
- fsck -y ${cowdevice}
- fi
- fi
elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENCE}" ]
then
# check if there are any nfs options
if [ "${UNIONTYPE}" != "unionmount" ]
then
- if [ -n "${PERSISTENCE_READONLY}" ]
+ if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
- mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/overlay"
- root_backing="${rootmnt}/live/persistence/$(basename ${cowdevice})-root"
+ mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
+ root_backing="/live/persistence/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
- root_backing="/overlay"
+ root_backing="/live/overlay"
fi
if [ "${cow_fstype}" = "nfs" ]
unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
mount_full $unionmountopts "${unionmountpoint}"
else
- cow_dir="/overlay${dir}"
+ cow_dir="/live/overlay${dir}"
rofs_dir="${rofs}${dir}"
mkdir -p ${cow_dir}
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
- #mount -t tmpfs -o rw,noatime,mode=755 tmpfs "${cow_dir}"
do_union ${unionmountpoint} ${cow_dir} ${root_backing} ${rofs_dir}
else
do_union ${unionmountpoint} ${cow_dir} ${rofs_dir}
# Correct the permissions of /:
chmod 0755 "${rootmnt}"
- # tmpfs file systems
- touch /etc/fstab
- mkdir -p "${rootmnt}/live"
- mount -t tmpfs tmpfs ${rootmnt}/live
-
live_rofs_list=""
# SHOWMOUNTS is necessary for custom mounts with the union option
# Since we may want to do custom mounts in user-space it's best to always enable SHOWMOUNTS
# XXX: is the for loop really necessary? rofslist can only contain one item (see above XXX about EXPOSEDROOT) and this is also assumed elsewhere above (see use of $rofs above).
for d in ${rofslist}
do
- live_rofs="${rootmnt}/live/rofs/${d##*/}"
+ live_rofs="/live/rofs/${d##*/}"
live_rofs_list="${live_rofs_list} ${live_rofs}"
mkdir -p "${live_rofs}"
case d in
# Gather information about custom mounts from devies detected as overlays
get_custom_mounts ${custom_mounts} ${overlay_devices}
- [ -n "${DEBUG}" ] && cp ${custom_mounts} "${rootmnt}/live/persistence"
+ [ -n "${DEBUG}" ] && cp ${custom_mounts} "/live/persistence"
# Now we do the actual mounting (and symlinking)
local used_overlays=""
try_snap "${home_snapdata}" "${rootmnt}" "HOME" "/home"
fi
+ mkdir -p "${rootmnt}/live"
+ mount -o move /live "${rootmnt}/live" >/dev/null 2>&1 || mount -o bind /live "${rootmnt}/live" || log_warning_msg "Unable to move or bind /live to ${rootmnt}/live"
+
# shows cow fs on /overlay for use by live-snapshot
mkdir -p "${rootmnt}/live/overlay"
- mount -o move /overlay "${rootmnt}/live/overlay" >/dev/null 2>&1 || mount -o bind /overlay "${rootmnt}/live/overlay" || log_warning_msg "Unable to move or bind /overlay to ${rootmnt}/live/overlay"
+ mount -o move /live/overlay "${rootmnt}/live/overlay" >/dev/null 2>&1 || mount -o bind /overlay "${rootmnt}/live/overlay" || log_warning_msg "Unable to move or bind /overlay to ${rootmnt}/live/overlay"
+
}
check_dev ()