[packages/geninitrd] - rel 2; libdir brokeness fixed

arekm arekm at pld-linux.org
Thu Mar 26 21:28:53 CET 2015


commit 464ad04e48c431ef2de693b78f2a4e2c18888e41
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Mar 26 21:28:42 2015 +0100

    - rel 2; libdir brokeness fixed

 geninitrd-git.patch | 167 ++++++++++++++++++++++++++++++++++++++--------------
 geninitrd.spec      |   4 +-
 2 files changed, 125 insertions(+), 46 deletions(-)
---
diff --git a/geninitrd.spec b/geninitrd.spec
index 8e868e9..6f33fbf 100644
--- a/geninitrd.spec
+++ b/geninitrd.spec
@@ -7,7 +7,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:	12749
-Release:	1
+Release:	2
 License:	GPL
 Group:		Applications/System
 Source0:	%{name}-%{version}.tar.gz
@@ -85,7 +85,7 @@ bieżących informacji zawartych w /etc/modules.conf.
 %prep
 %setup -qc
 mv %{name}-%{version}*/* .
-#%patch0 -p1
+%patch0 -p1
 
 %build
 %{__make}
diff --git a/geninitrd-git.patch b/geninitrd-git.patch
index 6c1b268..c8e4e62 100644
--- a/geninitrd-git.patch
+++ b/geninitrd-git.patch
@@ -1,45 +1,124 @@
-diff --git a/mod-luks.sh b/mod-luks.sh
-index 8cd9959..43bdcaa 100644
---- a/mod-luks.sh
-+++ b/mod-luks.sh
-@@ -134,15 +134,27 @@ luks_crypttab() {
- 			if key_is_random "$key"; then
- 				die "$dst: LUKS requires non-random key, skipping"
- 			fi
--			if [ -n "$opt" ]; then
--				warn "$dst: options are invalid for LUKS partitions, ignoring them"
--			fi
- 			if [ "$key" ]; then
- 				keyfile=/etc/.$dst.key
- 				inst $key $keyfile
- 			fi
- 
--			verbose "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'"
-+			crypttab_opt=""
-+			old_IFS="$IFS"
-+			IFS=","
-+			for option in $opt; do
-+				case "$option" in
-+					discard|allow-discards)
-+						crypttab_opt="$crypttab_opt --allow-discards"
-+						;;
-+					*)
-+						warn "$dst: option \'$opt\' is invalid for LUKS partitions, ignored"
-+						;;
-+				esac
-+			done
-+			IFS="$old_IFS"
-+
-+			verbose "+ cryptsetup ${keyfile:+-d $keyfile} open --type luks $crypttab_opt '$src' '$dst'"
- 			add_linuxrc <<-EOF
- 			debugshell
- 
-@@ -169,7 +181,7 @@ luks_crypttab() {
- 				crypt_status=\$(cryptsetup \$cryptsetup_opt status '$dst')
- 				if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then
- 					# is inactive
--					cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} luksOpen "\$luksdev" '$dst' <&1
-+					cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} open --type luks $crypttab_opt "\$luksdev" '$dst' <&1
- 				fi
- 			fi
+diff --git a/functions b/functions
+index a3f6b19..f4d9acb 100644
+--- a/functions
++++ b/functions
+@@ -291,3 +291,9 @@ find_modules_by_class_mit() {
+ 	'
+ }
  
++# get possible paths for specifed patter containing LIBDIR
++get_libdir() {
++	for dir in lib lib64 libx32; do
++		echo -n "${1/LIBDIR/$dir} "
++	done
++}
+diff --git a/geninitrd b/geninitrd
+index 2c435f8..6ad6820 100755
+--- a/geninitrd
++++ b/geninitrd
+@@ -553,17 +553,20 @@ inst_exec() {
+ 
+ 	# hack for uclibc linked binaries requiring this fixed path
+ 	# XXX: shouldn't rpath be used here instead so th
+-	if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
+-		lib=$DESTDIR/$_lib/libc.so.0
+-		lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
+-		libdir=$(cd $(dirname "$lib"); pwd)
+-		if [ ! -e $DESTDIR$libdir ]; then
+-			libdir=$(dirname "$libdir")
+-			inst_d $libdir
+-			verbose "+ ln -s /$_lib $DESTDIR$libdir"
+-			ln -s /$_lib $DESTDIR$libdir
++	for _lib in $(get_libdir LIBDIR); do
++		if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
++			lib=$DESTDIR/$_lib/libc.so.0
++			lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
++			libdir=$(cd $(dirname "$lib"); pwd)
++			if [ ! -e $DESTDIR$libdir ]; then
++				libdir=$(dirname "$libdir")
++				inst_d $libdir
++				verbose "+ ln -s /$_lib $DESTDIR$libdir"
++				ln -s /$_lib $DESTDIR$libdir
++				break
++			fi
+ 		fi
+-	fi
++	done
+ }
+ 
+ # output modules.conf / modprobe.conf
+@@ -1363,19 +1366,10 @@ for dir in libx32 lib64 lib; do
+ 	fi
+ done
+ 
+-if [ -d /libx32 -a -d /usr/libx32 ]; then
+-	_lib=libx32
+-elif [ -d /lib64 -a -d /usr/lib64 ]; then
+-	_lib=lib64
+-else
+-	_lib=lib
+-fi
+-
+ kernel_version=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d",$1,$2)}')
+ kernel_version_long=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d%03d",$1,$2,$3)}')
+ 
+ verbose "# geninitrd $VERSION"
+-debug "Using _lib: $_lib"
+ debug "Using initrd_dir: $initrd_dir"
+ 
+ busybox=$(find_tool $initrd_dir/busybox $initrd_dir/initrd-busybox /bin/initrd-busybox) || die "Couldn't find busybox suitable for initrd"
+diff --git a/mod-multipath.sh b/mod-multipath.sh
+index f918dd5..559eb55 100644
+--- a/mod-multipath.sh
++++ b/mod-multipath.sh
+@@ -112,13 +112,19 @@ initrd_gen_multipath() {
+ 	inst_exec /sbin/multipath /sbin
+ 
+ 	# for udev callouts
+-	local scsi_id=$(find_tool /$_lib/udev/scsi_id /lib/udev/scsi_id /sbin/scsi_id)
++	local scsi_id=$(find_tool $(get_libdir /LIBDIR/udev/scsi_id) /lib/udev/scsi_id /sbin/scsi_id)
+ 	inst_exec $scsi_id /lib/udev
+ 
+-	if [ -d /$_lib/multipath ]; then
+-		inst_d /$_lib/multipath
+-		inst_exec /$_lib/multipath/* /$_lib/multipath
+-	else
++	local installed=0
++	for _lib in $(get_libdir LIBDIR); do
++		if [ -d /$_lib/multipath ]; then
++			inst_d /$_lib/multipath
++			inst_exec /$_lib/multipath/* /$_lib/multipath
++			installed=1
++			break
++		fi
++	done
++	if [ "$installed" -eq 0 ]; then
+ 		inst_exec /sbin/mpath* /sbin
+ 	fi
+ 
+diff --git a/mod-suspend.sh b/mod-suspend.sh
+index 48efd57..c984e77 100644
+--- a/mod-suspend.sh
++++ b/mod-suspend.sh
+@@ -13,7 +13,7 @@ setup_mod_suspend() {
+ 		warn "Tuxonice and mainline suspend are exclusive!"
+ 	fi
+ 
+-	resume=$(find_tool $initrd_dir/resume /usr/${_lib}/suspend/resume /usr/sbin/resume)
++	resume=$(find_tool $(get_libdir /usr/LIBDIR/suspend/resume) $initrd_dir/resume /usr/sbin/resume)
+ 
+ 	if [ ! -x "$resume" ] || [ ! -f /etc/suspend.conf ]; then
+ 		USE_SUSPEND=no
+@@ -58,11 +58,7 @@ initrd_gen_suspend() {
+ 	inst $resume_dev $resume_dev
+ 
+ 	inst /etc/suspend.conf /etc/suspend.conf
+-	if [ -x /usr/${_lib}/suspend/resume ]; then
+-		inst_exec /usr/${_lib}/suspend/resume /bin/resume
+-	else
+-		inst_exec /usr/sbin/resume /bin/resume
+-	fi
++	inst_exec $resume /bin/resume
+ 
+ 	add_linuxrc <<-'EOF'
+ 	resume=no
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/geninitrd.git/commitdiff/464ad04e48c431ef2de693b78f2a4e2c18888e41



More information about the pld-cvs-commit mailing list