test-functions revision ac289ce3f5eb3f13806f7c631c6b23cee18b26da
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek# ex: ts=8 sw=4 sts=4 et filetype=sh
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekPATH=/sbin:/bin:/usr/sbin:/usr/bin
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekLOOKS_LIKE_DEBIAN=$(source /etc/os-release && [[ "$ID" = "debian" || "$ID_LIKE" = "debian" ]] && echo yes)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekKERNEL_VER=${KERNEL_VER-$(uname -r)}
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekKERNEL_MODS="/lib/modules/$KERNEL_VER/"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmekif ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekBASICTOOLS="sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-SzmekDEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # SUSE and Red Hat call the binary qemu-kvm
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a kvm qemu-kvm 2>/dev/null | grep '^/' -m1)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # QEMU's own build system calls it qemu-system-x86_64
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu-system-x86_64 2>/dev/null | grep '^/' -m1)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu-system-i386 2>/dev/null | grep '^/' -m1)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu 2>/dev/null | grep '^/' -m1)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek echo "Could not find a suitable QEMU binary" >&2
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poettering if [ -f /etc/machine-id ]; then
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek read MACHINE_ID < /etc/machine-id
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ -z "$INITRD" ] && [ -e "/boot/$MACHINE_ID/$KERNEL_VER/initrd" ] \
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek && INITRD="/boot/$MACHINE_ID/$KERNEL_VER/initrd"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ -z "$KERNEL_BIN" ] && [ -e "/boot/$MACHINE_ID/$KERNEL_VER/linux" ] \
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek && KERNEL_BIN="/boot/$MACHINE_ID/$KERNEL_VER/linux"
603938e0a9b5379984d7397e3cf81683c0037a53Lennart Poettering default_fedora_initrd=/boot/initramfs-${KERNEL_VER}.img
603938e0a9b5379984d7397e3cf81683c0037a53Lennart Poettering default_debian_initrd=/boot/initrd.img-${KERNEL_VER}
603938e0a9b5379984d7397e3cf81683c0037a53Lennart Poettering [ "$KERNEL_BIN" ] || KERNEL_BIN=/boot/vmlinuz-$KERNEL_VER
603938e0a9b5379984d7397e3cf81683c0037a53Lennart Poettering [ "$INITRD" ] || { [ -e "$default_fedora_initrd" ] && INITRD=$default_fedora_initrd; }
603938e0a9b5379984d7397e3cf81683c0037a53Lennart Poettering [ "$INITRD" ] || { [ "$LOOKS_LIKE_DEBIAN" ] && [ -e "$default_debian_initrd" ] && INITRD=$default_debian_initrd; }
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmekraid=noautodetect \
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidtconsole=ttyS0 \
c099716487df4a4f5394e57e7ca14da1d358166aZbigniew Jędrzejewski-Szmek QEMU_OPTIONS="$QEMU_OPTIONS -initrd $INITRD"
c099716487df4a4f5394e57e7ca14da1d358166aZbigniew Jędrzejewski-Szmek if [ -c /dev/kvm ]; then
c099716487df4a4f5394e57e7ca14da1d358166aZbigniew Jędrzejewski-Szmek QEMU_OPTIONS="$QEMU_OPTIONS -machine accel=kvm -enable-kvm -cpu host"
c099716487df4a4f5394e57e7ca14da1d358166aZbigniew Jędrzejewski-Szmek $QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND" $TESTDIR/rootdisk.img ) || return 1
fff40a51ccbb02e8dec4ff2ee505bc84f75e445cZbigniew Jędrzejewski-Szmek ../../systemd-nspawn --register=no --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # create the basic filesystem layout
2c408cb6276e3b8d18fb4e2a81a1128d8bbaa70dLennart Poettering if ! type -p valgrind; then
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek local _valgrind_bins=$(strace -e execve valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if /^execve\("([^"]+)"/')
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek local _valgrind_libs=$(LD_DEBUG=files valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if m{calling init: (/.*vgpreload_.*)}')
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek strace -e open valgrind /bin/true 2>&1 >/dev/null |
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poettering perl -lne 'if (my ($fname) = /^open\("([^"]+).*= (?!-)\d+/) { print $fname if $fname =~ /debug|\.supp$/ }'
892213bf1fd23e48d64a407ece6e10b07bef1926Zbigniew Jędrzejewski-Szmek local _valgrind_wrapper=$initdir/$ROOTLIBDIR/systemd-under-valgrind
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poetteringexec valgrind --leak-check=full --log-file=/valgrind.out $ROOTLIBDIR/systemd "\$@"
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek type -P dmeventd >/dev/null && dracut_install dmeventd
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek inst_libdir_file "libdevmapper-event.so*"
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek if [[ "$LOOKS_LIKE_DEBIAN" ]]; then
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # dmsetup installs 55-dm and 60-persistent-storage-dm on Debian/Ubuntu
23ea3dab15181a3966ec45fa2ccbb81e59d2e0a7Zbigniew Jędrzejewski-Szmek # see https://anonscm.debian.org/cgit/pkg-lvm/lvm2.git/tree/debian/patches/0007-udev.patch
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek inst_rules 55-dm.rules 60-persistent-storage-dm.rules
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek (cd $TEST_BASE_DIR/..; set -x; make DESTDIR=$initdir install)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek rm -fr $initdir/usr/share/{man,doc}
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # we strip binaries since debug symbols increase binaries size a lot
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # and it could fill the available space
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # install possible missing libraries
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # Create the blank file to use as a root filesystem
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek dd if=/dev/null of="$TESTDIR/rootdisk.img" bs=1M seek=400
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek mkfs.ext3 -L systemd "${LOOPDEV}p1"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ -f $TESTDIR/nspawn-root/failed ]] && cp -a $TESTDIR/nspawn-root/failed $TESTDIR
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp -a $TESTDIR/nspawn-root/var/log/journal $TESTDIR
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ls -l $TESTDIR/journal/*/*.journal
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek test -s $TESTDIR/failed && ret=$(($ret+1))
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek find "$initdir" -executable -not -path '*/lib/modules/*.ko' -type f | xargs strip --strip-unneeded | ddebug
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cat >$initdir/etc/rc.d/rc.local <<EOF
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek chmod 0755 $initdir/etc/rc.d/rc.local
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ddebug "install any Execs from the service files"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek export PKG_CONFIG_PATH=$TEST_BASE_DIR/../src/core/
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek systemdsystemunitdir=$(pkg-config --variable=systemdsystemunitdir systemd)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek systemduserunitdir=$(pkg-config --variable=systemduserunitdir systemd)
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek | while read i; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poettering ! depmod -a -b "$initdir" $KERNEL_VER; then
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek dfatal "\"depmod -a $KERNEL_VER\" failed."
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poettering inst /lib/modules/$KERNEL_VER/modules.order
30374ebe5e9f0b37e99dcbdc965c00fcf542f89dLennart Poettering inst /lib/modules/$KERNEL_VER/modules.builtin
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # install plymouth, if found... else remove plymouth service files
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
e9c1ea9de87d4d508ac38ce87a2fa56e7529a91aJason St. John # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
9d458c0902cdc5d993fd2f78d36fb83a8130c81bLennart Poettering # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
e9c1ea9de87d4d508ac38ce87a2fa56e7529a91aJason St. John rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp -a /etc/ld.so.conf* $initdir/etc
892213bf1fd23e48d64a407ece6e10b07bef1926Zbigniew Jędrzejewski-Szmek echo systemd-testsuite > $initdir/etc/hostname
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-SzmekLABEL=systemd / ext3 rw 0 1
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # in Debian ldconfig is just a shell script wrapper around ldconfig.real
892213bf1fd23e48d64a407ece6e10b07bef1926Zbigniew Jędrzejewski-Szmek [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # install libnss_files for login
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek NSS_LIBS=$(LD_DEBUG=files getent passwd 2>&1 >/dev/null |sed -n '/calling init: .*libnss_/ {s!^.* /!/!; p}')
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek inst $ROOTLIBDIR/system/dbus.socket
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek /etc/dbus-1 /usr/share/dbus-1 -xtype f \
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek | while read file; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ "$LOOKS_LIKE_DEBIAN" ]] && type -p dpkg-architecture &>/dev/null && find "/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/security" -xtype f
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp /etc/pam.d/systemd-user $initdir/etc/pam.d/
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek /usr/lib/kbd/keymaps/include/* \
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek /usr/lib/kbd/keymaps/i386/include/* \
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek /usr/lib/kbd/keymaps/i386/qwerty/us.*; do
5e65c93a433447b15180249166f7b3944c3e6156Zbigniew Jędrzejewski-Szmek [[ -f $i ]] || continue
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek /usr/lib/kbd/consolefonts/eurlatgr* \
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek /usr/lib/kbd/consolefonts/latarcyrheb-sun16*; do
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek [[ -f $i ]] || continue
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [ -f ${_terminfodir}/l/linux ] && break
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek dracut_install -o ${_terminfodir}/l/linux
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek # make the testsuite the default target
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ln -fs testsuite.target $initdir/etc/systemd/system/default.target
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ddebug "cp -ar $initdir $TESTDIR/nspawn-root"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek cp -ar $initdir $TESTDIR/nspawn-root
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek mkdir -p $initdir/etc/systemd/system
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek mkdir -p $initdir/var/log/journal
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log dev proc sys sysroot root run run/lock run/initramfs; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek ln -sfn /run/lock "$initdir/var/lock"
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek LC_ALL=C ldd "$_bin" 2>/dev/null | while read _line; do
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek [[ $_line = 'not a dynamic executable' ]] && break
2ca0435be9359bde3020eeb528c2a6d72ac1e0b0Zbigniew Jędrzejewski-Szmek if [[ $_line =~ $_so_regex ]]; then
[[ -e $STATEFILE ]] && . $STATEFILE
export TESTDIR
export initdir
[ $1 -le $LOG_LEVEL ] || return 0
if [ $# -ge 1 ]; then
while read line; do
while [[ ${__absolute[__level]} == ${__current[__level]} ]]
if [[ -n $__newpath ]]
if [[ -L $_file ]]; then
# rev_lib_symlinks libfoo.so.8.1
if [[ -L $_src ]]; then
[[ -L $_bin ]] && inst_symlink $_bin $_target && return 0
if [[ $_line =~ $_so_regex ]]; then
_file=${BASH_REMATCH[1]}
local _bin
local _line _shebang_regex
[[ $_line =~ $_shebang_regex ]] || return 1
if [[ -d $_realsrc ]]; then
if [[ -f $r/$_rule ]]; then
if [[ -f ${r}$_rule ]]; then
local _x
case $# in
[[ $initdir = $2 ]] && set $1;;
for _x in inst_symlink inst_script inst_binary inst_simple; do
local to f
if [[ $_optional = yes ]]; then
if [[ $omit_drivers ]]; then
_found=1
local _modname _filtercmd
if ! [[ $hostonly ]]; then
if ! [[ $hostonly ]]; then
[[ $no_kernel = yes ]] && return
local _fderr=9
| instmods
| instmods
local _moddirname=${KERNEL_MODS%%/lib/modules/*}
--set-version $KERNEL_VER ${_moddirname} $_mpargs
return $_ret
while read _mod; do
set -o pipefail
| while read line; do [[ "$line" =~ $_filter_not_found ]] && echo $line || echo $line >&2 ;done | derror
_ret=$?
set +o pipefail
return $_ret
local _pattern=$1
case $1 in
--run)
ret=$?
exit $ret;;
--setup)
--clean)
--all)
ret=$?
exit $ret
ret=$?
exit $ret;;