Add support for in-initramfs live images with "root=live:/path/name.img"
This allows creation of initramfs images which contain a Live system. The primary use for this is keeping very large initramfs-based systems (e.g. anaconda, the Fedora installer) compressed in-memory, by using a compressed filesystem image like squashfs or btrfs. dmsquash-live-genrules.sh will initqueue dmsquash-live-root itself (rather than making udev rules) if the given live "device" is actually an existing, plain file. parse-dmsquash-live.sh will only accept paths that end in ".img". dmsquash-live-root will only handle images named "*squashfs.img", "*ext3fs.img", or "*btrfs.img".master
parent
533318113b
commit
0ddd68f7e6
|
@ -1,7 +1,8 @@
|
|||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if [ "${root%%:*}" = "live" ]; then
|
||||
case "$root" in
|
||||
live:/dev/*)
|
||||
{
|
||||
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
|
@ -15,4 +16,11 @@ if [ "${root%%:*}" = "live" ]; then
|
|||
${root#live:/dev/}
|
||||
} >> /etc/udev/rules.d/99-live-squash.rules
|
||||
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
|
||||
fi
|
||||
;;
|
||||
live:*)
|
||||
if [ -f "${root#live:}" ]; then
|
||||
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
|
||||
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -44,11 +44,19 @@ getarg rw && liverw=rw
|
|||
[ -z "$liverw" ] && liverw=ro
|
||||
# mount the backing of the live image first
|
||||
mkdir -p /dev/.initramfs/live
|
||||
mount -n -t $fstype -o $liverw $livedev /dev/.initramfs/live
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
if [ -f $livedev ]; then
|
||||
# no mount needed - we've already got the LiveOS image in initramfs
|
||||
case $livedev in
|
||||
*squashfs.img) SQUASHED=$livedev ;;
|
||||
*ext3fs.img|*btrfs.img) FSIMG=$livedev ;;
|
||||
esac
|
||||
else
|
||||
mount -n -t $fstype -o $liverw $livedev /dev/.initramfs/live
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# overlay setup helper function
|
||||
|
|
|
@ -38,6 +38,8 @@ case "$liveroot" in
|
|||
rootok=1 ;;
|
||||
live:/dev/*)
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
|
||||
[ -f "${root#live:}" ] && rootok=1 ;;
|
||||
esac
|
||||
info "root was $root, liveroot is now $liveroot"
|
||||
|
||||
|
|
Loading…
Reference in New Issue