-
Notifications
You must be signed in to change notification settings - Fork 18
/
installCDCACM.sh
executable file
·36 lines (33 loc) · 1.19 KB
/
installCDCACM.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Install the cdc-acm module
# First, does the module version magic match the current kernel version?
MAGICVERSION=$(modinfo cdc-acm.ko | grep vermagic)
MODULEVERSION=$(echo $MAGICVERSION | cut -d " " -f 2)
KERNELVERSION=$(uname -r)
if [ "$MODULEVERSION" == "$KERNELVERSION" ]
then
echo "Kernel and Module Versions Match; Installing ..."
else
echo "The Kernel version does not match the Module Version"
echo "Kernel Version: " $KERNELVERSION
echo "Module Version: " $MODULEVERSION
while true; do
read -p "Would you still like to install the module? [Y/n] " response
case $response in
[Yy]* ) break ;;
[Nn]* ) exit;;
* ) echo "Please answer Yes or no. " ;;
esac
done
# The module version did not match the kernel version, but user selected to install anyway
echo "You may have to force the module to be inserted, i.e. "
echo "$ sudo modprobe -f cdc-acm"
fi
# Install the cdc-acm module
# Make sure that the drivers/usb/class directory exists
INSTALLDIRECTORY=/lib/modules/$(uname -r)/kernel/drivers/usb/class
sudo mkdir -p "$INSTALLDIRECTORY"
# Then copy over the module file
sudo cp -v cdc-acm.ko $INSTALLDIRECTORY
sudo depmod -a
echo "Installed cdc-acm Module"