Last active
August 29, 2015 13:56
-
-
Save RPDiep/8800027 to your computer and use it in GitHub Desktop.
Apt hook for installing r1soft modules on ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DPkg::Post-Invoke {"/usr/local/sbin/r1soft-installmodule"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create r1soft-installmodule as /usr/local/sbin/r1soft-installmodule ( and make it executable ) | |
Create 98r1soft-installmodule as /etc/apt/apt.conf.d/98r1soft-installmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" == "debug" ]] | |
then | |
debug=1 | |
else | |
debug=0 | |
fi | |
restart=0 | |
kernelversion=$(uname -r) | |
kernelvariant=${kernelversion##*-} | |
exec 5>&1 | |
[[ $debug -eq 0 ]] && exec >/dev/null 2>&1 | |
for dir in /usr/src/linux-headers*${kernelvariant} | |
do | |
kernel=${dir##*headers-} | |
if [ -f /lib/modules/r1soft/hcpdriver-cki-${kernel}.ko ] | |
then | |
echo "Kernel module for kernel version ${kernel} exists" | |
else | |
echo "Installing r1soft module for kernel version ${kernel} ..." >&5 | |
serverbackup-setup --get-module --kernel-dir ${dir} | |
restart=1 | |
fi | |
done | |
[[ ${restart} -eq 1 ]] && /etc/init.d/cdp-agent restart | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment