dracut/dracut-049-squash-overlayfs-live-openmamba-2.patch

166 lines
6.2 KiB
Diff
Raw Permalink Normal View History

diff -Nru dracut-049.orig/modules.d/99squash-live/module-setup.sh dracut-049/modules.d/99squash-live/module-setup.sh
--- dracut-049.orig/modules.d/99squash-live/module-setup.sh 2019-01-12 15:30:47.223331178 +0100
+++ dracut-049/modules.d/99squash-live/module-setup.sh 2019-01-12 17:07:25.742047276 +0100
@@ -25,6 +25,7 @@
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst_script "$moddir/squash-live-root.sh" "/sbin/squash-live-root"
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
+ inst_script "$moddir/squash-generator.sh" $systemdutildir/system-generators/dracut-squash-generator
# should probably just be generally included
inst_rules 60-cdrom_id.rules
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
diff -Nru dracut-049.orig/modules.d/99squash-live/parse-squash-live.sh dracut-049/modules.d/99squash-live/parse-squash-live.sh
--- dracut-049.orig/modules.d/99squash-live/parse-squash-live.sh 2019-01-12 15:30:47.223331178 +0100
+++ dracut-049/modules.d/99squash-live/parse-squash-live.sh 2019-01-12 18:52:41.335714197 +0100
@@ -15,7 +15,7 @@
liveroot=$root
fi
-[ "${liveroot%%:*}" = "live" ] || return
+[ "${liveroot%%:*}" = "live" ] || return 1
modprobe -q loop
@@ -51,7 +51,13 @@
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
[ -f "${root#live:}" ] && rootok=1 ;;
esac
+[ "$rootok" = "1" ] || return 1
+
info "root was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"
+
+wait_for_dev -n /dev/root
+
+return 0
diff -Nru dracut-049.orig/modules.d/99squash-live/squash-generator.sh dracut-049/modules.d/99squash-live/squash-generator.sh
--- dracut-049.orig/modules.d/99squash-live/squash-generator.sh 1970-01-01 01:00:00.000000000 +0100
+++ dracut-049/modules.d/99squash-live/squash-generator.sh 2019-01-12 17:08:06.813220403 +0100
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+[ -z "$root" ] && root=$(getarg root=)
+
+# support legacy syntax of passing liveimg and then just the base root
+if getargbool 0 rd.live.image -d -y liveimg; then
+ liveroot="live:$root"
+fi
+
+if [ "${root%%:*}" = "live" ] ; then
+ liveroot=$root
+fi
+
+[ "${liveroot%%:*}" = "live" ] || exit 0
+
+case "$liveroot" in
+ live:LABEL=*|LABEL=*) \
+ root="${root#live:}"
+ root="${root//\//\\x2f}"
+ root="live:/dev/disk/by-label/${root#LABEL=}"
+ rootok=1 ;;
+ live:CDLABEL=*|CDLABEL=*) \
+ root="${root#live:}"
+ root="${root//\//\\x2f}"
+ 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:PARTUUID=*|PARTUUID=*) \
+ root="${root#live:}"
+ root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
+ rootok=1 ;;
+ live:PARTLABEL=*|PARTLABEL=*) \
+ root="${root#live:}"
+ root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
+ rootok=1 ;;
+ live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
+ root="${root#live:}"
+ root="liveiso:${root}"
+ rootok=1 ;;
+ live:/dev/*)
+ rootok=1 ;;
+ live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
+ [ -f "${root#live:}" ] && rootok=1 ;;
+esac
+
+[ "$rootok" != "1" ] && exit 0
+
+GENERATOR_DIR="$2"
+[ -z "$GENERATOR_DIR" ] && exit 1
+[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
+
+getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
+[ -e /xor_overlayfs ] && xor_overlayfs="yes"
+[ -e /xor_readonly ] && xor_readonly="--readonly"
+ROOTFLAGS="$(getarg rootflags)"
+{
+ echo "[Unit]"
+ echo "Before=initrd-root-fs.target"
+ echo "[Mount]"
+ echo "Where=/sysroot"
+ if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
+ echo "What=LiveOS_rootfs"
+ if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
+ ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
+ else
+ ovlfs=lowerdir=/run/rootfsbase
+ fi
+ echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
+ echo "Type=overlay"
+ _dev=LiveOS_rootfs
+ else
+ echo "What=/dev/mapper/live-rw"
+ [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
+ _dev=$'dev-mapper-live\\x2drw'
+ fi
+} > "$GENERATOR_DIR"/sysroot.mount
+
+mkdir -p "$GENERATOR_DIR/$_dev.device.d"
+{
+ echo "[Unit]"
+ echo "JobTimeoutSec=3000"
+ echo "JobRunningTimeoutSec=3000"
+} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"
diff -Nru dracut-049.orig/modules.d/99squash-live/squash-live-genrules.sh dracut-049/modules.d/99squash-live/squash-live-genrules.sh
--- dracut-049.orig/modules.d/99squash-live/squash-live-genrules.sh 2019-01-12 15:30:47.223331178 +0100
+++ dracut-049/modules.d/99squash-live/squash-live-genrules.sh 2019-01-12 18:57:20.519965163 +0100
@@ -1,16 +1,18 @@
#!/bin/sh
-if [ "${root%%:*}" = "live" ]; then
+
+case "$root" in
+ live:/dev/*)
{
- printf 'KERNEL=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
- printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
- } >> /etc/udev/rules.d/99-live-mount.rules
- {
- printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
- printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root $env{DEVNAME}"\n' \
- ${root#live:/dev/}
+ printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root %s"\n' \
+ "${root#live:/dev/}" "${root#live:}"
+ printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root %s"\n' \
+ "${root#live:/dev/}" "${root#live:}"
} >> /etc/udev/rules.d/99-live-squash.rules
- echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/squash.sh
-fi
+ wait_for_dev -n "${root#live:}"
+ ;;
+ live:*)
+ if [ -f "${root#live:}" ]; then
+ /sbin/initqueue --settled --onetime --unique /sbin/squash-live-root "${root#live:}"
+ fi
+ ;;
+esac