apply a workaround attempt (by using sleep) to systemd 240 event timing causing squash-live to fail [release 049-4mamba;Tue Feb 05 2019]

This commit is contained in:
Silvan Calarco 2024-01-05 21:56:17 +01:00
parent 616689dd5c
commit 4e6ff5a52f
3 changed files with 16 additions and 167 deletions

View File

@ -0,0 +1,11 @@
--- dracut-049.orig/modules.d/99squash-live/squash-liveiso-genrules.sh 2019-01-12 15:30:47.223331178 +0100
+++ dracut-049/modules.d/99squash-live/squash-liveiso-genrules.sh 2019-02-05 16:09:07.275266246 +0100
@@ -5,7 +5,7 @@
DEVLABEL=${root#liveiso:/}
DEVLABEL=${DEVLABEL%%/*}
{
- printf 'ENV{ID_FS_LABEL}=="%s", RUN+="/bin/mkdir /%s", RUN+="/bin/mount /dev/%%k /%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root `/sbin/losetup -f --show %s` /%s"\n' \
+ printf 'ENV{ID_FS_LABEL}=="%s", RUN+="/bin/sleep 2", RUN+="/bin/mkdir /%s", RUN+="/bin/mount /dev/%%k /%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root `/sbin/losetup -f --show %s` /%s"\n' \
${DEVLABEL} ${DEVLABEL} ${DEVLABEL} ${root#liveiso:} ${DEVLABEL}
# printf 'KERNEL=="loop-control", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/squash-live-root `/sbin/losetup -f --show %s` /%s"\n' \
# ${root#liveiso:} ${DEVLABEL}

View File

@ -1,165 +0,0 @@
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

View File

@ -1,6 +1,6 @@
Name: dracut
Version: 049
Release: 3mamba
Release: 4mamba
Summary: Generic, modular initramfs generation tool that can be used across various distributions
Group: System/Kernel and Hardware
Vendor: openmamba
@ -25,7 +25,7 @@ Patch20: dracut-040-fix-autofs4-ipv6-modules.patch
Patch21: dracut-040-dmsetup_fix_path.patch
Patch22: dracut-040-add_systemd_journald_socket.patch
Patch23: dracut-044-bash-4.4.patch
Patch24: dracut-049-squash-overlayfs-live-openmamba-2.patch
Patch24: dracut-049-squash-live-systemd-240.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
@ -397,6 +397,9 @@ fi
#%doc NEWS README README.generic README.kernel README.modules TODO
%changelog
* Tue Feb 05 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 049-4mamba
- apply a workaround attempt (by using sleep) to systemd 240 event timing causing squash-live to fail
* Sun Feb 03 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 049-3mamba
- require ntfs-3g