summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfiles/90mgalive/mgalive-genrules.sh17
-rwxr-xr-xfiles/90mgalive/mgalive-parse.sh40
-rwxr-xr-xfiles/90mgalive/mgalive-root.sh169
-rwxr-xr-xfiles/90mgalive/mgaliveiso-genrules.sh9
-rwxr-xr-xfiles/90mgalive/module-setup.sh4
5 files changed, 30 insertions, 209 deletions
diff --git a/files/90mgalive/mgalive-genrules.sh b/files/90mgalive/mgalive-genrules.sh
index afbddd3..f450ebf 100755
--- a/files/90mgalive/mgalive-genrules.sh
+++ b/files/90mgalive/mgalive-genrules.sh
@@ -1,19 +1,18 @@
#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
+
case "$root" in
- live:/dev/*)
+ mgalive:/dev/*)
{
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mgalive-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
+ ${root#mgalive:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mgalive-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
+ ${root#mgalive:/dev/}
} >> /etc/udev/rules.d/99-mgalive.rules
- wait_for_dev "${root#live:}"
+ wait_for_dev "${root#mgalive:}"
;;
- live:*)
- if [ -f "${root#live:}" ]; then
- /sbin/initqueue --settled --onetime --unique /sbin/mgalive-root "${root#live:}"
+ mgalive:*)
+ if [ -f "${root#mgalive:}" ]; then
+ /sbin/initqueue --settled --onetime --unique /sbin/mgalive-root "${root#mgalive:}"
fi
;;
esac
diff --git a/files/90mgalive/mgalive-parse.sh b/files/90mgalive/mgalive-parse.sh
index cbe0a1b..7952957 100755
--- a/files/90mgalive/mgalive-parse.sh
+++ b/files/90mgalive/mgalive-parse.sh
@@ -1,51 +1,27 @@
#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
# live images are specified with
-# root=live:backingdev
+# root=mgalive:backingdev
[ -z "$root" ] && root=$(getarg root=)
-# support legacy syntax of passing liveimg and then just the base root
-if getargbool 0 rd.live.image -y liveimg; then
- liveroot="live:$root"
-fi
-
-if [ "${root%%:*}" = "live" ] ; then
+if [ "${root%%:*}" = "mgalive" ] ; then
liveroot=$root
fi
-[ "${liveroot%%:*}" = "live" ] || return
+[ "${liveroot%%:*}" = "mgalive" ] || return
modprobe -q loop
case "$liveroot" in
- live:LABEL=*|LABEL=*) \
- root="${root#live:}"
- root="$(echo $root | sed 's,/,\\x2f,g')"
- root="live:/dev/disk/by-label/${root#LABEL=}"
- rootok=1 ;;
- live:CDLABEL=*|CDLABEL=*) \
- root="${root#live:}"
+ mgalive:LABEL=*|LABEL=*) \
+ root="${root#mgalive:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
- root="live:/dev/disk/by-label/${root#CDLABEL=}"
- rootok=1 ;;
- live:UUID=*|UUID=*) \
- root="${root#live:}"
- root="live:/dev/disk/by-uuid/${root#UUID=}"
- rootok=1 ;;
- live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
- root="${root#live:}"
- root="liveiso:${root}"
- rootok=1 ;;
- live:/dev/*)
+ root="mgalive:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
- live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
- [ -f "${root#live:}" ] && rootok=1 ;;
esac
info "root was $liveroot, is now $root"
# make sure that init doesn't complain
-[ -z "$root" ] && root="live"
+[ -z "$root" ] && root="mgalive"
-#wait_for_dev /dev/mapper/live-rw
+wait_for_dev /live/union
diff --git a/files/90mgalive/mgalive-root.sh b/files/90mgalive/mgalive-root.sh
index 5c2a061..0d05e97 100755
--- a/files/90mgalive/mgalive-root.sh
+++ b/files/90mgalive/mgalive-root.sh
@@ -1,171 +1,30 @@
#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
[ -f /tmp/root.info ] && . /tmp/root.info
PATH=/usr/sbin:/usr/bin:/sbin:/bin
-if getargbool 0 rd.live.debug -y rdlivedebug; then
- exec > /tmp/liveroot.$$.out
- exec 2>> /tmp/liveroot.$$.out
- set -x
-fi
-
[ -z "$1" ] && exit 1
livedev="$1"
-# parse various live image specific options that make sense to be
-# specified as their own things
-live_dir=$(getarg rd.live.dir live_dir)
-[ -z "$live_dir" ] && live_dir="loopbacks"
-getargbool 0 rd.live.ram -y live_ram && live_ram="yes"
-getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
-getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
-overlay=$(getarg rd.live.overlay overlay)
-
-# CD/DVD media check
-[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
-if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
- check="yes"
-fi
-getarg rd.live.check check || check=""
-if [ -n "$check" ]; then
- [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
- checkisomd5 --verbose $livedev || :
- if [ $? -ne 0 ]; then
- die "CD check failed!"
- exit 1
- fi
- [ -x /bin/plymouth ] && /bin/plymouth --show-splash
-fi
-
-# determine filesystem type for a filesystem image
-det_img_fs() {
- blkid -s TYPE -u noraid -o value "$1"
-}
-
-for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
-# set up paths that we expect
-mkdir -m 0755 -p /live/{distrib,media,memory,union}
-if [ -f $livedev ]; then
- # no mount needed - we've already got the LiveOS image in initramfs
- # check filesystem type and handle accordingly
- fstype=$(det_img_fs $livedev)
- case $fstype in
- squashfs) SQUASHED=$livedev;;
- auto) die "cannot mount live image (unknown filesystem type)" ;;
- *) FSIMG=$livedev ;;
- esac
- [ -e /sys/fs/$fstype ] || modprobe $fstype
-else
- mount -n -t $fstype -o ${liverw:-ro} $livedev /live
- if [ "$?" != "0" ]; then
- die "Failed to mount block device of live image"
- exit 1
- fi
-fi
-
-# overlay setup helper function
-do_live_overlay() {
- # create a sparse file for the overlay
- # overlay: if non-ram overlay searching is desired, do it,
- # otherwise, create traditional overlay in ram
- OVERLAY_LOOPDEV=$( losetup -f )
-
- l=$(blkid -s LABEL -o value $livedev) || l=""
- u=$(blkid -s UUID -o value $livedev) || u=""
-
- if [ -z "$overlay" ]; then
- pathspec="/${live_dir}/overlay-$l-$u"
- elif ( echo $overlay | grep -q ":" ); then
- # pathspec specified, extract
- pathspec=$( echo $overlay | sed -e 's/^.*://' )
- fi
-
- if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
- pathspec="/${live_dir}/overlay-$l-$u"
- fi
- devspec=$( echo $overlay | sed -e 's/:.*$//' )
-
- # need to know where to look for the overlay
- setup=""
- if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
- mkdir -m 0755 /run/initramfs/overlayfs
- mount -n -t auto $devspec /run/initramfs/overlayfs || :
- if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
- losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
- if [ -n "$reset_overlay" ]; then
- dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
- fi
- setup="yes"
- fi
- umount -l /run/initramfs/overlayfs || :
- fi
-
- if [ -z "$setup" ]; then
- if [ -n "$devspec" -a -n "$pathspec" ]; then
- warn "Unable to find persistent overlay; using temporary"
- sleep 5
- fi
-
- dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
- losetup $OVERLAY_LOOPDEV /overlay
- fi
-
- # set up the snapshot
- echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
-}
-
-# live cd helper function
-do_live_from_base_loop() {
-# do_live_overlay
-}
+# create live tree
+mkdir -m 0755 -p /live/media
+mkdir -m 0755 -p /live/distrib
+mkdir -m 0755 -p /live/memory
+mkdir -m 0755 -p /live/union
-#### OLD NASH LOAD from Mga1 livecds
-# nash-mount -o ro -t iso9660 LABEL=Livecd-1-GNOME /live/media
-# /bin/losetup /dev/loop0 /live/media/loopbacks/distrib-lzma.sqfs
-# nash-mount -o ro -t squashfs /dev/loop0 /live/distrib
-# mount -t tmpfs -o mode=755 /live/memory /live/memory
-# sh -c 'mount -o dirs=/live/memory=rw:/live/distrib=ro -t unionfs unionfs /live/union'
-# plymouth --newroot=/live/union
-# echo 0x0100 > /proc/sys/kernel/real-root-dev
-# umount /sys
-# sh -c 'umount /proc/bus/usb 2>/dev/null'
-# umount /proc
-# pivot_root /live/union /live/union/initrd
-# sh -c 'rmdir /initrd/live/union'
-# sh -c 'cd /initrd/live; for i in `ls -1`; do [ -d $i ] || continue; mkdir -p /live/$i; mount -n --move $i /live/$i; rmdir $i; done'
-# rmdir /initrd/live
-# nash-mount -o mode=0755 -t tmpfs /dev /dev
-# sh -c 'rm -rf /dev/loop'
-# sh -c 'mv /initrd/dev/* /dev/'
-#
+# mount the livecd
+mount -n -t iso9660 -o ro $livedev /live/media
+LOOPDEV=$( losetup -f )
+losetup -r $LOOPDEV /live/media/loopbacks/distrib-lzma.sqfs
+mount -n -t squashfs -o ro $LOOPDEV /live/distrib
+mount -n -t tmpfs -o mode=755 /live/memory /live/memory
+mount -n -t unionfs -o dirs=/live/memory=rw:/live/distrib=ro unionfs /live/union
-### FIXME ### DONT HARDCODE MEDIA NAME
-mount -o ro -t iso9660 /dev/disk/by-label/LiveCD-2-KDE4 /live/media
-losetup /dev/loop0 /live/media/loopbacks/distrib-lzma.sqfs
-mount -o ro -t squashfs /dev/loop0 /live/distrib
-mount -t tmpfs -o mode=755 /live/memory /live/memory
-sh -c 'mount -o dirs=/live/memory=rw:/live/distrib=ro -t unionfs unionfs /live/union'
-plymouth --newroot=/live/union
-echo 0x0100 > /proc/sys/kernel/real-root-dev
-umount /sys
-sh -c 'umount /proc/bus/usb 2>/dev/null'
-umount /proc
-pivot_root /live/union /live/union/initrd
-sh -c 'rmdir /initrd/live/union'
-sh -c 'cd /initrd/live; for i in `ls -1`; do [ -d $i ] || continue; mkdir -p /live/$i; mount -n --move $i /live/$i; rmdir $i; done'
-rmdir /initrd/live
-#mount -o mode=0755 -t tmpfs /dev /dev
-# sh -c 'rm -rf /dev/loop'
-# sh -c 'mv /initrd/dev/* /dev/'
+ln -s /live/union /dev/root
-#printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
+printf '/bin/mount --move /live/union %s\n' "$NEWROOT" > $hookdir/mount/01-$$-live.sh
need_shutdown
diff --git a/files/90mgalive/mgaliveiso-genrules.sh b/files/90mgalive/mgaliveiso-genrules.sh
deleted file mode 100755
index 946047d..0000000
--- a/files/90mgalive/mgaliveiso-genrules.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/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%%:*}" = "liveiso" ]; then
- {
- printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mgalive-root `/sbin/losetup -f --show %s`"\n' \
- ${root#liveiso:}
- } >> /etc/udev/rules.d/99-mgaliveiso-mount.rules
-fi
diff --git a/files/90mgalive/module-setup.sh b/files/90mgalive/module-setup.sh
index 8a6a2f8..19eb0a6 100755
--- a/files/90mgalive/module-setup.sh
+++ b/files/90mgalive/module-setup.sh
@@ -1,6 +1,4 @@
#!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# a live host-only image doesn't really make a lot of sense
@@ -28,8 +26,6 @@ install() {
inst blockdev
inst_hook cmdline 30 "$moddir/mgalive-parse.sh"
inst_hook pre-udev 30 "$moddir/mgalive-genrules.sh"
- inst_hook pre-udev 30 "$moddir/mgaliveiso-genrules.sh"
- #inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst "$moddir/mgalive-root.sh" "/sbin/mgalive-root"
# should probably just be generally included
inst_rules 60-cdrom_id.rules