#!/bin/sh
module="powerfip"

DRV_DIR=/lib/modules/$(uname -r)/kernel/drivers/fip
RULES_DIR=/etc/udev/rules.d

# create the driver directory if it does not exist
if [ ! -d "${DRV_DIR}" ];
then
    mkdir ${DRV_DIR}
fi

# copy the module to the driver directory
cp ./${module}.ko ${DRV_DIR}

# copy the rules to udev.rules.d
cp ./udev.rules.d/10-${module}.rules ${RULES_DIR}

# add module to kernel
depmod -a
modprobe ${module}
