chiark / gitweb /
test-functions:install_libnss() call dracut_install with all $NSS_LIBS
[elogind.git] / test / test-functions
index 4fa0c59f2d6c514bfedf2d51ec64bc15ebe8e890..368e7a1e52ca33ea45c8e2c038d4aefc6e53fd55 100644 (file)
@@ -7,8 +7,13 @@ export PATH
 KERNEL_VER=${KERNEL_VER-$(uname -r)}
 KERNEL_MODS="/lib/modules/$KERNEL_VER/"
 
-BASICTOOLS="sh bash setsid loadkeys setfont login sushell sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
+if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
+    echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2
+    ROOTLIBDIR=/usr/lib/systemd
+fi
+
+BASICTOOLS="sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe"
+DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname"
 
 function find_qemu_bin() {
     # SUSE and Red Hat call the binary qemu-kvm
@@ -47,7 +52,7 @@ run_qemu() {
 systemd.log_level=debug \
 raid=noautodetect \
 loglevel=2 \
-init=/usr/lib/systemd/systemd \
+init=$ROOTLIBDIR/systemd \
 ro \
 console=ttyS0 \
 selinux=0 \
@@ -72,7 +77,7 @@ $KERNEL_APPEND \
 
 run_nspawn() {
     set -x
-    ../../systemd-nspawn --boot --directory=$TESTDIR/nspawn-root /usr/lib/systemd/systemd $KERNEL_APPEND
+    ../../systemd-nspawn --boot --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
 }
 
 setup_basic_environment() {
@@ -227,6 +232,9 @@ EOF
 
 install_basic_tools() {
     [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
+    dracut_install -o sushell
+    # in Debian ldconfig is just a shell script wrapper around ldconfig.real
+    dracut_install -o ldconfig.real
 }
 
 install_debug_tools() {
@@ -235,12 +243,13 @@ install_debug_tools() {
 
 install_libnss() {
     # install libnss_files for login
-    inst_libdir_file "libnss_files*"
+    NSS_LIBS=$(LD_DEBUG=files getent passwd 2>&1 >/dev/null |sed -n '/calling init: .*libnss_/ {s!^.* /!/!; p}')
+    dracut_install $NSS_LIBS
 }
 
 install_dbus() {
-    inst /usr/lib/systemd/system/dbus.socket
-    inst /usr/lib/systemd/system/dbus.service
+    inst $ROOTLIBDIR/system/dbus.socket
+    inst $ROOTLIBDIR/system/dbus.service
 
     find \
         /etc/dbus-1 -xtype f \
@@ -287,7 +296,8 @@ install_terminfo() {
 }
 
 setup_testsuite() {
-    cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+    cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
+    sed "s#@SYSTEMCTL@#$(type -P systemctl)#g" $TEST_BASE_DIR/end.service.in > $initdir/etc/systemd/system/end.service
 
     mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
     ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service