#!/bin/sh

KERNEL_VER=$1
if [ -z "$KERNEL_VER" ]; then
    KERNEL_VER=`uname -r`
fi

#Find all network devices
HIDE_PCI=`lspci -mm -n | grep '^[^ ]* "02'|awk '{ ORS="";print "(" $1 ")";}'`

echo "# This file is autogenerated by kernel post-install script" > /etc/modprobe.d/pciback.conf
echo "# DO NOT EDIT" >> /etc/modprobe.d/pciback.conf
echo "" >> /etc/modprobe.d/pciback.conf
echo "options pciback hide=$HIDE_PCI" >> /etc/modprobe.d/pciback.conf

dracut --force --add-drivers 'xts aesni-intel aes-x86_64 crc32c-intel fpu ghash-clmulni-intel salsa20-x86_64 twofish-x86_64 pciback' \
      /boot/initramfs-$KERNEL_VER.img $KERNEL_VER