summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-live.sh63
1 files changed, 56 insertions, 7 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index ca4135141f..890c56280a 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -137,15 +137,64 @@ do
137 sleep 1 137 sleep 1
138done 138done
139 139
140# Try to make a union mount of the root image.
141# If no unification filesystem is available, mount the image read-only.
142mount_and_boot() {
143 mkdir $ROOT_MOUNT
144 mknod /dev/loop0 b 7 0 2>/dev/null
145
146 # determine which unification filesystem to use
147 union_fs_type=""
148 if grep -q -w "overlayfs" /proc/filesystems; then
149 union_fs_type="overlayfs"
150 elif grep -q -w "aufs" /proc/filesystems; then
151 union_fs_type="aufs"
152 else
153 union_fs_type=""
154 fi
155
156 # make a union mount if possible
157 case $union_fs_type in
158 "overlayfs")
159 mkdir -p /rootfs.ro /rootfs.rw
160 if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
161 rm -rf /rootfs.ro /rootfs.rw
162 fatal "Could not mount rootfs image"
163 else
164 mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
165 mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
166 mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
167 mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
168 mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
169 fi
170 ;;
171 "aufs")
172 mkdir -p /rootfs.ro /rootfs.rw
173 if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
174 rm -rf /rootfs.ro /rootfs.rw
175 fatal "Could not mount rootfs image"
176 else
177 mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
178 mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT
179 mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
180 mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
181 mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
182 fi
183 ;;
184 "")
185 if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
186 fatal "Could not mount rootfs image"
187 fi
188 ;;
189 esac
190
191 # boot the image
192 boot_live_root
193}
194
140case $label in 195case $label in
141 boot) 196 boot)
142 mkdir $ROOT_MOUNT 197 mount_and_boot
143 mknod /dev/loop0 b 7 0 2>/dev/null
144 if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
145 fatal "Could not mount rootfs image"
146 else
147 boot_live_root
148 fi
149 ;; 198 ;;
150 install|install-efi) 199 install|install-efi)
151 if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then 200 if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then