Blame 0025-TEST-50-MULTINIC-install-correct-nss-libs.patch

Harald Hoyer d1bf89
From 3eca0cc846e89675949abb11e9606f3222a2e266 Mon Sep 17 00:00:00 2001
Harald Hoyer d1bf89
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer d1bf89
Date: Fri, 15 Jun 2012 11:12:46 +0200
Harald Hoyer d1bf89
Subject: [PATCH] TEST-50-MULTINIC: install correct nss libs
Harald Hoyer d1bf89
Harald Hoyer d1bf89
---
Harald Hoyer d1bf89
 test/TEST-50-MULTINIC/test.sh |  118 ++++++++++++++++++++++++++---------------
Harald Hoyer d1bf89
 1 file changed, 74 insertions(+), 44 deletions(-)
Harald Hoyer d1bf89
Harald Hoyer d1bf89
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
Harald Hoyer d1bf89
index 712f90e..6efa8ef 100755
Harald Hoyer d1bf89
--- a/test/TEST-50-MULTINIC/test.sh
Harald Hoyer d1bf89
+++ b/test/TEST-50-MULTINIC/test.sh
Harald Hoyer d1bf89
@@ -12,7 +12,7 @@ run_server() {
Harald Hoyer d1bf89
     # Start server first
Harald Hoyer d1bf89
     echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
-    $testdir/run-qemu -hda $TESTDIR/server.ext2 -m 256M -nographic \
Harald Hoyer d1bf89
+    $testdir/run-qemu -hda $TESTDIR/server.ext3 -m 512M -nographic \
Harald Hoyer d1bf89
 	-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
Harald Hoyer d1bf89
 	-net socket,listen=127.0.0.1:12350 \
Harald Hoyer d1bf89
 	-serial $SERIAL \
Harald Hoyer d1bf89
@@ -122,15 +122,41 @@ test_client() {
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
 test_setup() {
Harald Hoyer d1bf89
      # Make server root
Harald Hoyer d1bf89
-     dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60
Harald Hoyer d1bf89
-     mke2fs -F $TESTDIR/server.ext2
Harald Hoyer d1bf89
-     mkdir $TESTDIR/mnt
Harald Hoyer d1bf89
-     sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt
Harald Hoyer d1bf89
+    dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
Harald Hoyer d1bf89
+    mke2fs -j -F $TESTDIR/server.ext3
Harald Hoyer d1bf89
+    mkdir $TESTDIR/mnt
Harald Hoyer d1bf89
+    sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+    export kernel=$KVERSION
Harald Hoyer d1bf89
+    export srcmods="/lib/modules/$kernel/"
Harald Hoyer d1bf89
+    # Detect lib paths
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+    . $basedir/dracut-functions.sh
Harald Hoyer d1bf89
+    if ! [[ $libdirs ]] ; then
Harald Hoyer d1bf89
+	if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
Harald Hoyer d1bf89
+            && [[ -d /lib64 ]]; then
Harald Hoyer d1bf89
+            libdirs+=" /lib64"
Harald Hoyer d1bf89
+            [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
Harald Hoyer d1bf89
+	else
Harald Hoyer d1bf89
+            libdirs+=" /lib"
Harald Hoyer d1bf89
+            [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
Harald Hoyer d1bf89
+	fi
Harald Hoyer d1bf89
+    fi
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
-     kernel=$KVERSION
Harald Hoyer d1bf89
-     (
Harald Hoyer d1bf89
+    (
Harald Hoyer d1bf89
      	initdir=$TESTDIR/mnt
Harald Hoyer d1bf89
- 	. $basedir/dracut-functions.sh
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+	for _f in modules.builtin.bin modules.builtin; do
Harald Hoyer d1bf89
+	    [[ $srcmods/$_f ]] && break
Harald Hoyer d1bf89
+	done || {
Harald Hoyer d1bf89
+	    dfatal "No modules.builtin.bin and modules.builtin found!"
Harald Hoyer d1bf89
+	    return 1
Harald Hoyer d1bf89
+	}
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+        for _f in modules.builtin.bin modules.builtin modules.order; do
Harald Hoyer d1bf89
+	    [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
Harald Hoyer d1bf89
+	done
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
  	dracut_install sh ls shutdown poweroff stty cat ps ln ip \
Harald Hoyer d1bf89
  	    dmesg mkdir cp ping exportfs \
Harald Hoyer d1bf89
  	    modprobe rpc.nfsd rpc.mountd showmount tcpdump \
Harald Hoyer d1bf89
@@ -144,36 +170,32 @@ test_setup() {
Harald Hoyer d1bf89
  	[ -f /etc/netconfig ] && dracut_install /etc/netconfig
Harald Hoyer d1bf89
  	type -P dhcpd >/dev/null && dracut_install dhcpd
Harald Hoyer d1bf89
  	[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
Harald Hoyer d1bf89
- 	instmods nfsd sunrpc ipv6
Harald Hoyer d1bf89
+ 	instmods nfsd sunrpc ipv6 lockd
Harald Hoyer d1bf89
  	inst ./server-init.sh /sbin/init
Harald Hoyer d1bf89
  	inst ./hosts /etc/hosts
Harald Hoyer d1bf89
  	inst ./exports /etc/exports
Harald Hoyer d1bf89
  	inst ./dhcpd.conf /etc/dhcpd.conf
Harald Hoyer d1bf89
  	dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
Harald Hoyer d1bf89
  	dracut_install rpc.idmapd /etc/idmapd.conf
Harald Hoyer d1bf89
- 	if ldd $(type -P rpc.idmapd) |grep -q lib64; then
Harald Hoyer d1bf89
- 	    LIBDIR="/lib64"
Harald Hoyer d1bf89
- 	else
Harald Hoyer d1bf89
- 	    LIBDIR="/lib"
Harald Hoyer d1bf89
- 	fi
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
- 	dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap*.so* 2>/dev/null )
Harald Hoyer d1bf89
- 	dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap/*.so 2>/dev/null )
Harald Hoyer d1bf89
- 	dracut_install $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null)
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap_nsswitch.so*'
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap/*.so*'
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap*.so*'
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
+        _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
Harald Hoyer d1bf89
+	    |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
Harald Hoyer d1bf89
+        _nsslibs=${_nsslibs#|}
Harald Hoyer d1bf89
+        _nsslibs=${_nsslibs%|}
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
-	nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
Harald Hoyer d1bf89
-              |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
Harald Hoyer d1bf89
-	nsslibs=${nsslibs#|}
Harald Hoyer d1bf89
-	nsslibs=${nsslibs%|}
Harald Hoyer d1bf89
+	inst_libdir_file -n "$_nsslibs" 'libnss*.so*'
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
-	dracut_install $(for i in $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs")
Harald Hoyer d1bf89
  	(
Harald Hoyer d1bf89
  	    cd "$initdir";
Harald Hoyer d1bf89
  	    mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind}
Harald Hoyer d1bf89
  	    mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
Harald Hoyer d1bf89
  	    chmod 777 var/lib/rpcbind var/lib/nfs
Harald Hoyer d1bf89
  	)
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
  	inst /etc/nsswitch.conf /etc/nsswitch.conf
Harald Hoyer d1bf89
  	inst /etc/passwd /etc/passwd
Harald Hoyer d1bf89
  	inst /etc/group /etc/group
Harald Hoyer d1bf89
@@ -181,49 +203,57 @@ test_setup() {
Harald Hoyer d1bf89
  	    inst_library $i
Harald Hoyer d1bf89
  	done
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
- 	/sbin/depmod -a -b "$initdir" $kernel
Harald Hoyer d1bf89
+	/sbin/depmod -a -b "$initdir" $kernel
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
 	cp -a /etc/ld.so.conf* $initdir/etc
Harald Hoyer d1bf89
 	sudo ldconfig -r "$initdir"
Harald Hoyer d1bf89
-     )
Harald Hoyer d1bf89
+    )
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
     # Make client root inside server root
Harald Hoyer d1bf89
     initdir=$TESTDIR/mnt/nfs/client
Harald Hoyer d1bf89
     mkdir -p $initdir
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
     (
Harald Hoyer d1bf89
- 	. $basedir/dracut-functions.sh
Harald Hoyer d1bf89
- 	dracut_install sh shutdown poweroff stty cat ps ln ip \
Harald Hoyer d1bf89
-            mount dmesg mkdir \
Harald Hoyer d1bf89
- 	    cp ping grep ls
Harald Hoyer d1bf89
+	dracut_install sh shutdown poweroff stty cat ps ln ip \
Harald Hoyer d1bf89
+            mount dmesg mkdir cp ping grep ls
Harald Hoyer d1bf89
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
Harald Hoyer d1bf89
 	    [ -f ${_terminfodir}/l/linux ] && break
Harald Hoyer d1bf89
 	done
Harald Hoyer d1bf89
 	dracut_install -o ${_terminfodir}/l/linux
Harald Hoyer d1bf89
- 	inst ./client-init.sh /sbin/init
Harald Hoyer d1bf89
- 	(
Harald Hoyer d1bf89
- 	    cd "$initdir"
Harald Hoyer d1bf89
- 	    mkdir -p dev sys proc etc run
Harald Hoyer d1bf89
- 	    mkdir -p var/lib/nfs/rpc_pipefs
Harald Hoyer d1bf89
+	inst ./client-init.sh /sbin/init
Harald Hoyer d1bf89
+	(
Harald Hoyer d1bf89
+	    cd "$initdir"
Harald Hoyer d1bf89
+	    mkdir -p dev sys proc etc run
Harald Hoyer d1bf89
+	    mkdir -p var/lib/nfs/rpc_pipefs
Harald Hoyer d1bf89
 	)
Harald Hoyer d1bf89
- 	inst /etc/nsswitch.conf /etc/nsswitch.conf
Harald Hoyer d1bf89
- 	inst /etc/passwd /etc/passwd
Harald Hoyer d1bf89
- 	inst /etc/group /etc/group
Harald Hoyer d1bf89
- 	for i in /lib*/libnss_files*;do
Harald Hoyer d1bf89
- 	    inst_library $i
Harald Hoyer d1bf89
- 	done
Harald Hoyer d1bf89
+	inst /etc/nsswitch.conf /etc/nsswitch.conf
Harald Hoyer d1bf89
+	inst /etc/passwd /etc/passwd
Harald Hoyer d1bf89
+	inst /etc/group /etc/group
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap_nsswitch.so*'
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap/*.so*'
Harald Hoyer d1bf89
+	inst_libdir_file 'libnfsidmap*.so*'
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+        _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
Harald Hoyer d1bf89
+	    |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
Harald Hoyer d1bf89
+        _nsslibs=${_nsslibs#|}
Harald Hoyer d1bf89
+        _nsslibs=${_nsslibs%|}
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+	inst_libdir_file -n "$_nsslibs" 'libnss*.so*'
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
 	cp -a /etc/ld.so.conf* $initdir/etc
Harald Hoyer d1bf89
 	sudo ldconfig -r "$initdir"
Harald Hoyer d1bf89
-     )
Harald Hoyer d1bf89
+    )
Harald Hoyer d1bf89
+
Harald Hoyer d1bf89
+    chroot $initdir
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
-     sudo umount $TESTDIR/mnt
Harald Hoyer d1bf89
-     rm -fr $TESTDIR/mnt
Harald Hoyer d1bf89
+    sudo umount $TESTDIR/mnt
Harald Hoyer d1bf89
+    rm -fr $TESTDIR/mnt
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
     # Make an overlay with needed tools for the test harness
Harald Hoyer d1bf89
     (
Harald Hoyer d1bf89
  	initdir=$TESTDIR/overlay
Harald Hoyer d1bf89
  	mkdir $TESTDIR/overlay
Harald Hoyer d1bf89
- 	. $basedir/dracut-functions.sh
Harald Hoyer d1bf89
  	dracut_install poweroff shutdown
Harald Hoyer d1bf89
  	inst_hook emergency 000 ./hard-off.sh
Harald Hoyer d1bf89
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
Harald Hoyer d1bf89
@@ -232,7 +262,7 @@ test_setup() {
Harald Hoyer d1bf89
     # Make server's dracut image
Harald Hoyer d1bf89
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
Harald Hoyer d1bf89
 	-m "dash udev-rules base rootfs-block debug kernel-modules" \
Harald Hoyer d1bf89
-	-d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
Harald Hoyer d1bf89
+	-d "piix ide-gd_mod ata_piix ext3 sd_mod e1000" \
Harald Hoyer d1bf89
 	-f $TESTDIR/initramfs.server $KVERSION || return 1
Harald Hoyer d1bf89
 
Harald Hoyer d1bf89
     # Make client's dracut image