99 lines
5.9 KiB
Diff
99 lines
5.9 KiB
Diff
|
From 8064f68d602b45778afc3f32a703b8376609d019 Mon Sep 17 00:00:00 2001
|
||
|
From: Harald Hoyer <harald@redhat.com>
|
||
|
Date: Mon, 2 Dec 2013 11:02:34 +0100
|
||
|
Subject: [PATCH] resume: no more autoresume
|
||
|
|
||
|
---
|
||
|
modules.d/95resume/parse-resume.sh | 76 +++++++++++++++++++++-----------------
|
||
|
1 file changed, 43 insertions(+), 33 deletions(-)
|
||
|
|
||
|
diff --git a/modules.d/95resume/parse-resume.sh b/modules.d/95resume/parse-resume.sh
|
||
|
index bd4bcd3..c84dafb 100755
|
||
|
--- a/modules.d/95resume/parse-resume.sh
|
||
|
+++ b/modules.d/95resume/parse-resume.sh
|
||
|
@@ -36,41 +36,51 @@ case "$splash" in
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
-if [ -n "$resume" ]; then
|
||
|
- {
|
||
|
- printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||
|
- ${resume#/dev/};
|
||
|
- printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||
|
- ${resume#/dev/};
|
||
|
- } >> /etc/udev/rules.d/99-resume-link.rules
|
||
|
|
||
|
- {
|
||
|
- if [ -x /usr/sbin/resume ]; then
|
||
|
- printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||
|
- ${resume#/dev/} "$a_splash" "$resume";
|
||
|
- printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||
|
- ${resume#/dev/} "$a_splash" "$resume";
|
||
|
- fi
|
||
|
- printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||
|
- ${resume#/dev/};
|
||
|
- printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||
|
- ${resume#/dev/};
|
||
|
- } >> /etc/udev/rules.d/99-resume.rules
|
||
|
+if ! getarg noresume; then
|
||
|
+ if [ -n "$resume" ]; then
|
||
|
+ {
|
||
|
+ printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||
|
+ ${resume#/dev/};
|
||
|
+ printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||
|
+ ${resume#/dev/};
|
||
|
+ } >> /etc/udev/rules.d/99-resume-link.rules
|
||
|
|
||
|
- printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||
|
- "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||
|
+ {
|
||
|
+ if [ -x /usr/sbin/resume ]; then
|
||
|
+ printf -- "KERNEL==\"%s\", " "${resume#/dev/}"
|
||
|
+ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||
|
+ "$a_splash" "$resume";
|
||
|
+ printf -- "SYMLINK==\"%s\", " "${resume#/dev/}"
|
||
|
+ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||
|
+ "$a_splash" "$resume";
|
||
|
+ fi
|
||
|
+ printf -- "KERNEL==\"%s\", " ${resume#/dev/};
|
||
|
+ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n"
|
||
|
+ printf -- "SYMLINK==\"%s\", " ${resume#/dev/};
|
||
|
+ printf -- "%s" "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n"
|
||
|
+ } >> /etc/udev/rules.d/99-resume.rules
|
||
|
|
||
|
- printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";' \
|
||
|
- "$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||
|
+ printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||
|
+ "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||
|
|
||
|
- wait_for_dev "/dev/resume"
|
||
|
- mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
|
||
|
-elif ! getarg noresume; then
|
||
|
- {
|
||
|
- if [ -x /usr/sbin/resume ]; then
|
||
|
- printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
|
||
|
- fi
|
||
|
- echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
|
||
|
- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
|
||
|
- } >> /etc/udev/rules.d/99-resume.rules
|
||
|
+ printf -- "%s" 'warn "Cancelling resume operation. Device not found.";'
|
||
|
+ printf -- ' cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";' \
|
||
|
+ "$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||
|
+
|
||
|
+ mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if [ -x /usr/sbin/resume ]; then
|
||
|
+ printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
|
||
|
+ fi
|
||
|
+ printf -- "%s" "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\","
|
||
|
+ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
|
||
|
+ } >> /etc/udev/rules.d/99-resume.rules
|
||
|
+ fi
|
||
|
fi
|