dracut/0006-Write-rules-for-symlinks-to-dev-.udev-rules.d-for-la.patch

100 lines
4.5 KiB
Diff
Raw Normal View History

From ae5ec68355f580ca4b86aa35fbbcbb0ed0900bb6 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jun 2010 10:30:39 +0200
Subject: [PATCH 6/8] Write rules for symlinks to /dev/.udev/rules.d for later usage
We want some symlinks to persist in the real root, so we write them to
/dev/.udev/rules.d, that they survive a retrigger.
---
.../90dmsquash-live/dmsquash-live-genrules.sh | 8 +++++---
.../90dmsquash-live/dmsquash-liveiso-genrules.sh | 4 ++--
modules.d/95resume/resume-genrules.sh | 12 ++++++++----
modules.d/95rootfs-block/block-genrules.sh | 5 +++--
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
index 56199d5..1057c8c 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
@@ -1,14 +1,16 @@
if [ "${root%%:*}" = "live" ]; then
- (
+ [ -d /dev/.udev/rules.d ] || mkdir -p /dev/.udev/rules.d
+ {
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
+ } >> /dev/.udev/rules.d/99-live-mount.rules
+ {
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
-
- ) >> /etc/udev/rules.d/99-live-mount.rules
+ } >> /etc/udev/rules.d/99-live-mount.rules
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
fi
diff --git a/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh b/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
index a196202..fa771f8 100755
--- a/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
@@ -1,7 +1,7 @@
if [ "${root%%:*}" = "liveiso" ]; then
- (
+ {
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
${root#liveiso:}
- ) >> /etc/udev/rules.d/99-liveiso-mount.rules
+ } >> /etc/udev/rules.d/99-liveiso-mount.rules
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
fi
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
index a00a362..59e1024 100755
--- a/modules.d/95resume/resume-genrules.sh
+++ b/modules.d/95resume/resume-genrules.sh
@@ -1,13 +1,17 @@
if [ -n "$resume" ]; then
+ [ -d /dev/.udev/rules.d ] || mkdir -p /dev/.udev/rules.d
{
- printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
- ${resume#/dev/};
- printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
- ${resume#/dev/};
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
+ } >> /dev/.udev/rules.d/99-resume.rules
+
+ {
+ printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
+ ${resume#/dev/};
+ printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/bin/sh -c 'echo %%M:%%m > /sys/power/resume'\"\n" \
+ ${resume#/dev/};
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; }\n' \
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 1b650f8..80e0c4c 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -1,10 +1,11 @@
if [ "${root%%:*}" = "block" ]; then
- (
+ [ -d /dev/.udev/rules.d ] || mkdir -p /dev/.udev/rules.d
+ {
printf 'KERNEL=="%s", SYMLINK+="root"\n' \
${root#block:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
${root#block:/dev/}
- ) >> /etc/udev/rules.d/99-mount.rules
+ } >> /dev/.udev/rules.d/99-root.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
"${root#block:}" "${root#block:}" >> /initqueue-settled/blocksymlink.sh
--
1.7.0.1