[packages/geninitrd] - rel 9; swsusp was breaking normal setups; fix that

arekm arekm at pld-linux.org
Sat Dec 26 01:21:48 CET 2020


commit 5dbbb84edc018b8d4324fa7345a9948dc9f05733
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Dec 26 01:21:31 2020 +0100

    - rel 9; swsusp was breaking normal setups; fix that

 geninitrd-git.patch    | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
 geninitrd-swsusp.patch | 135 ----------------------------------------
 geninitrd.spec         |   4 +-
 3 files changed, 164 insertions(+), 138 deletions(-)
---
diff --git a/geninitrd.spec b/geninitrd.spec
index 0a89992..66a0335 100644
--- a/geninitrd.spec
+++ b/geninitrd.spec
@@ -2,7 +2,7 @@ Summary:	Creates an initial ramdisk image for preloading modules
 Summary(pl.UTF-8):	Narzędzie do tworzenia inicjalnego ramdysku używanego przy starcie systemu
 Name:		geninitrd
 Version:	12787
-Release:	8
+Release:	9
 License:	GPL
 Group:		Applications/System
 Source0:	%{name}-%{version}.tar.gz
@@ -10,7 +10,6 @@ Source0:	%{name}-%{version}.tar.gz
 Patch0:		%{name}-git.patch
 Patch1:		%{name}-static-dev.patch
 Patch2:		%{name}-posix-sh.patch
-Patch3:		%{name}-swsusp.patch
 URL:		http://git.pld-linux.org/?p=projects/geninitrd.git
 BuildRequires:	xmlto >= 0:0.0.18-1
 Requires:	/usr/bin/ldd
@@ -86,7 +85,6 @@ bieżących informacji zawartych w /etc/modules.conf.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
-%patch3 -p1
 
 %build
 %{__make}
diff --git a/geninitrd-git.patch b/geninitrd-git.patch
index 84a15c1..1eccf06 100644
--- a/geninitrd-git.patch
+++ b/geninitrd-git.patch
@@ -425,3 +425,166 @@ index 9015cc3..3a52190 100644
  
  	if [ -z "$modaliases" ]; then
  		return
+
+commit 152a5bf18b37b825a9b6677153aa5af54df94d7b
+Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
+Date:   Sat Dec 26 01:03:50 2020 +0100
+
+    - swsusp support from mis at pld-linux
+
+diff --git a/Makefile b/Makefile
+index 1994b97..a9039b1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # when making release, make sure you do it as RELEASE document describes
+ NAME		:= geninitrd
+ VERSION		:= $(shell test -d .git && git describe --tags || echo git)
+-MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
++MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend swsusp fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
+ FILES_MODS  := $(MODS:%=mod-%.sh)
+ FILES_ADDON := extract-ikconfig
+ FILES_UDEV  := 01-ignore.rules 59-persistent-storage.rules 61-persistent-storage.rules 11-dm.rules
+diff --git a/geninitrd b/geninitrd
+index 7f5495f..ea7d438 100755
+--- a/geninitrd
++++ b/geninitrd
+@@ -1209,7 +1209,7 @@ if [ ! -f /proc/mounts ]; then
+ 	warn "/proc filesystem not mounted, may cause wrong results or failure."
+ fi
+ 
+-geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
++geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev swsusp tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
+ 
+ while [ $# -gt 0 ]; do
+ 	case $1 in
+@@ -1245,6 +1245,9 @@ while [ $# -gt 0 ]; do
+ 	--without-fbcondecor)
+ 		FB_CON_DECOR=no
+ 		;;
++	--without-swsusp)
++		USE_SWSUSP=no
++		;;
+ 	--with-suspend)
+ 		USE_SUSPEND=yes
+ 		;;
+@@ -1508,6 +1511,10 @@ if is_yes "$USE_SUSPEND"; then
+ 	find_modules_suspend
+ fi
+ 
++if is_yes "$USE_SWSUSP"; then
++	find_modules_swsusp
++fi
++
+ find_root "$fstab" || exit
+ verbose "Using $rootdev as device for rootfs"
+ 
+@@ -1703,6 +1710,7 @@ initrd_gen_stop_uvesafb
+ # resume after killing local processes
+ initrd_gen_tuxonice
+ initrd_gen_suspend
++initrd_gen_swsusp
+ 
+ # clean up env
+ add_linuxrc <<-'EOF'
+diff --git a/mod-swsusp.sh b/mod-swsusp.sh
+new file mode 100644
+index 0000000..d6ade58
+--- /dev/null
++++ b/mod-swsusp.sh
+@@ -0,0 +1,74 @@
++#!/bin/sh
++# geninitrd mod: swsusp
++#
++USE_SWSUSP=${USE_SWSUSP:-yes}
++
++# resume device
++swap_dev=""
++
++# setup geninitrd module
++# @access	public
++setup_mod_swsusp() {
++    	if ! is_yes "$USE_SWSUSP"; then
++		return
++	fi
++
++	swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
++	if [ -z "$swap_dev" ]; then
++	    warn "Cannot determine swap device. You may try add specific device to kernel command line"
++	else
++	    verbose "swsusp: will try to resume from swap device $swap_dev"
++	fi
++}
++
++# find modules for for swsusp
++# @access	public
++find_modules_swsusp() {
++    	swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
++
++	# save state
++	local vgvolumes=$LVM_VGVOLUMES
++	find_modules_for_devpath $swap_dev
++
++	# check for saved state, differenciate between rootfs VG
++	if [ "$LVM_VGVOLUMES" != "$vgvolumes" ]; then
++		# add swap device to LVM_SUSPENDVG
++		LVM_SUSPENDVG="$LVM_SUSPENDVG $LVM_VGVOLUMES"
++		LVM_VGVOLUMES=$vgvolumes
++		verbose "swap device is on LVM"
++	fi
++}
++
++# generate initrd fragment
++# @access	public
++initrd_gen_swsusp() {
++	if ! is_yes "$USE_SWSUSP"; then
++		return
++	fi
++
++	verbose "Setting up swsusp..."
++
++	mkdir -p $DESTDIR${swap_dev%/*}
++	inst $swap_dev $swap_dev
++
++        mount_dev
++	mount_sys
++        echo "swap_dev=$swap_dev" | add_linuxrc
++
++	add_linuxrc <<-'EOF'
++	resume=no
++	for arg in $CMDLINE; do
++		if [ "${arg##resume=/dev/}" != "${arg}" ]; then
++			swap_dev=${arg##resume=}
++			resume=yes
++		elif [ "${arg##resume=}" != "${arg}" ]; then
++			resume=${arg##resume=}
++		fi
++	done
++
++	if [ "$resume" = "yes" ] && [ -n "$swap_dev" ]; then
++	        echo "Resuming from $swap_dev..."
++		echo "$swap_dev" > /sys/power/resume
++	fi
++	EOF
++}
+
+commit 55248df65f545d53bb1cfb56edcf5a699a45f52f
+Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
+Date:   Sat Dec 26 01:04:09 2020 +0100
+
+    Disable swsusp support when swap device not found.
+
+diff --git a/mod-swsusp.sh b/mod-swsusp.sh
+index d6ade58..9224536 100644
+--- a/mod-swsusp.sh
++++ b/mod-swsusp.sh
+@@ -15,7 +15,8 @@ setup_mod_swsusp() {
+ 
+ 	swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
+ 	if [ -z "$swap_dev" ]; then
+-	    warn "Cannot determine swap device. You may try add specific device to kernel command line"
++	    warn "Cannot determine swap device. You may try add specific device to kernel command line. Disabling swsusp support."
++	    USE_SWSUSP=no
+ 	else
+ 	    verbose "swsusp: will try to resume from swap device $swap_dev"
+ 	fi
diff --git a/geninitrd-swsusp.patch b/geninitrd-swsusp.patch
deleted file mode 100644
index 91ee5f6..0000000
--- a/geninitrd-swsusp.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-diff --git a/Makefile b/Makefile
-index 1994b97..a9039b1 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,7 +1,7 @@
- # when making release, make sure you do it as RELEASE document describes
- NAME		:= geninitrd
- VERSION		:= $(shell test -d .git && git describe --tags || echo git)
--MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
-+MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend swsusp fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
- FILES_MODS  := $(MODS:%=mod-%.sh)
- FILES_ADDON := extract-ikconfig
- FILES_UDEV  := 01-ignore.rules 59-persistent-storage.rules 61-persistent-storage.rules 11-dm.rules
-diff --git a/geninitrd b/geninitrd
-index 7f5495f..ea7d438 100755
---- a/geninitrd
-+++ b/geninitrd
-@@ -1209,7 +1209,7 @@ if [ ! -f /proc/mounts ]; then
- 	warn "/proc filesystem not mounted, may cause wrong results or failure."
- fi
- 
--geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
-+geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev swsusp tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
- 
- while [ $# -gt 0 ]; do
- 	case $1 in
-@@ -1245,6 +1245,9 @@ while [ $# -gt 0 ]; do
- 	--without-fbcondecor)
- 		FB_CON_DECOR=no
- 		;;
-+	--without-swsusp)
-+		USE_SWSUSP=no
-+		;;
- 	--with-suspend)
- 		USE_SUSPEND=yes
- 		;;
-@@ -1508,6 +1511,10 @@ if is_yes "$USE_SUSPEND"; then
- 	find_modules_suspend
- fi
- 
-+if is_yes "$USE_SWSUSP"; then
-+	find_modules_swsusp
-+fi
-+
- find_root "$fstab" || exit
- verbose "Using $rootdev as device for rootfs"
- 
-@@ -1703,6 +1710,7 @@ initrd_gen_stop_uvesafb
- # resume after killing local processes
- initrd_gen_tuxonice
- initrd_gen_suspend
-+initrd_gen_swsusp
- 
- # clean up env
- add_linuxrc <<-'EOF'
-diff --git a/mod-swsusp.sh b/mod-swsusp.sh
-new file mode 100644
-index 0000000..d6ade58
---- /dev/null
-+++ b/mod-swsusp.sh
-@@ -0,0 +1,74 @@
-+#!/bin/sh
-+# geninitrd mod: swsusp
-+#
-+USE_SWSUSP=${USE_SWSUSP:-yes}
-+
-+# resume device
-+swap_dev=""
-+
-+# setup geninitrd module
-+# @access	public
-+setup_mod_swsusp() {
-+    	if ! is_yes "$USE_SWSUSP"; then
-+		return
-+	fi
-+
-+	swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
-+	if [ -z "$swap_dev" ]; then
-+	    warn "Cannot determine swap device. You may try add specific device to kernel command line"
-+	else
-+	    verbose "swsusp: will try to resume from swap device $swap_dev"
-+	fi
-+}
-+
-+# find modules for for swsusp
-+# @access	public
-+find_modules_swsusp() {
-+    	swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
-+
-+	# save state
-+	local vgvolumes=$LVM_VGVOLUMES
-+	find_modules_for_devpath $swap_dev
-+
-+	# check for saved state, differenciate between rootfs VG
-+	if [ "$LVM_VGVOLUMES" != "$vgvolumes" ]; then
-+		# add swap device to LVM_SUSPENDVG
-+		LVM_SUSPENDVG="$LVM_SUSPENDVG $LVM_VGVOLUMES"
-+		LVM_VGVOLUMES=$vgvolumes
-+		verbose "swap device is on LVM"
-+	fi
-+}
-+
-+# generate initrd fragment
-+# @access	public
-+initrd_gen_swsusp() {
-+	if ! is_yes "$USE_SWSUSP"; then
-+		return
-+	fi
-+
-+	verbose "Setting up swsusp..."
-+
-+	mkdir -p $DESTDIR${swap_dev%/*}
-+	inst $swap_dev $swap_dev
-+
-+        mount_dev
-+	mount_sys
-+        echo "swap_dev=$swap_dev" | add_linuxrc
-+
-+	add_linuxrc <<-'EOF'
-+	resume=no
-+	for arg in $CMDLINE; do
-+		if [ "${arg##resume=/dev/}" != "${arg}" ]; then
-+			swap_dev=${arg##resume=}
-+			resume=yes
-+		elif [ "${arg##resume=}" != "${arg}" ]; then
-+			resume=${arg##resume=}
-+		fi
-+	done
-+
-+	if [ "$resume" = "yes" ] && [ -n "$swap_dev" ]; then
-+	        echo "Resuming from $swap_dev..."
-+		echo "$swap_dev" > /sys/power/resume
-+	fi
-+	EOF
-+}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/geninitrd.git/commitdiff/5dbbb84edc018b8d4324fa7345a9948dc9f05733



More information about the pld-cvs-commit mailing list