# Directory used for rw changes in union mount filesystem
UNION=/union
MEMORY=/memory
- if [ -n "$UID" ]
+ if [ -z "$UID" ]
then
CHANGES=$MEMORY/unionfs_changes/default
else
bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based unionfs"
mount -t tmpfs tmpfs $MEMORY
fi
- if [ ! -f ${MEMORY}/livecd.unionfs ]
+ if [ "${CDROOT}" -eq '1' -a ! -f ${MEMORY}/livecd.unionfs ]
then
- umount $CHANGESDEV
+ umount $MEMORY
bad_msg "failed to find livecd.unionfs file on $CHANGESDEV"
bad_msg "create a livecd.unionfs file on this device if you wish to use it for unionfs"
bad_msg "falling back to ramdisk based unionfs for safety"
if [ "${USE_UNIONFS_NORMAL}" -eq '1' ]
then
- union_insert_dir $UNION /${NEW_ROOT}/${FS_LOCATION}
+ union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
# Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on unionfs dirs.
sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new
CDBOOT=1
[ "${DO_slowusb}" ] && sleep 10
else
- mkdir -p ${NEW_ROOT}/tmp/.initrd
+ if [ "${USE_UNIONFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}
+ mkdir -p ${UNION}/tmp/.initrd
+ else
+ mkdir -p ${NEW_ROOT}/tmp/.initrd
+ fi
fi
# Execute script on the cdrom just before boot to update things if necessary
verbose_kmsg
+# Move the /memory mount point to what will be the system root so that
+# init scripts will be able to unmount it properly at next reboot
+#
+# Eventually, all "unions over /" mounts should go in that /.unions/
+if [ "${USE_UNIONFS_NORMAL}" -eq '1' ]
+then
+ mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
+ mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move unionfs /memory into the system root!'
+fi
+
+
if [ "$0" = '/linuxrc' ]
then
[ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1