Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to download and prepare DigiPort kernel modules for DKMS. THIS WILL ONLY MANAGE THE KERNEL MODULES, NOT THE ADDITIONAL INIT-SCRIPTS! Install the additional scripts by removing the line "FULLPACKAGE = FULLPACKAGE" from Makefile and running ´make install´.
#!/bin/bash
# Get sources from: http://www.digi.com/support/productdetail?pid=3037
if [ ! -x /usr/sbin/dkms ]; then
echo "DKMS not found. Install DKMS (from RepoForge) before running this script."
exit 1
fi
# Download latest source as of 2014-05-26
echo "Downloading latest sources (if download fails, check http://www.digi.com/support/productdetail?pid=3037 for an updated URL)..."
#wget -N http://ftp1.digi.com/support/driver/40002086_U.src.rpm -P /tmp/
wget -N http://ftp1.digi.com/support/driver/81000137_U.tgz -P /tmp/
if [ -d /usr/src/dgrp-1.9 ]; then
echo "Removing old dgrp-1.9 from DKMS..."
dkms remove -m dgrp -v 1.9 --all
echo "Removing old dgrp-1.9 sources..."
rm -r /usr/src/dgrp-1.9
if [ -d /usr/src/dgrp-1.9 ]; then
echo "Removal failed. Check /usr/src/dgrp-1.9/ and remove it."
exit 1
fi
fi
echo "Unpacking to /usr/src/..."
tar xzf /tmp/81000137_U.tgz -C /usr/src/
echo "Patching Makefile.in..."
mv /usr/src/dgrp-1.9/Makefile.in /usr/src/dgrp-1.9/Makefile.in~
sed -e 's/^CFLAGS/EXTRA_CFLAGS/' /usr/src/dgrp-1.9/Makefile.in~ > /usr/src/dgrp-1.9/Makefile.in
echo "Adding DKMS configuration..."
(
cat <<'E_O_F'
PACKAGE_NAME="dgrp"
PACKAGE_VERSION="1.9"
MAKE[0]="LINUX_KERNEL_VERSION=$kernelver make"
BUILT_MODULE_NAME[0]="dgrp"
BUILT_MODULE_LOCATION[0]="driver/build/"
DEST_MODULE_LOCATION[0]="/extra/"
AUTOINSTALL="yes"
E_O_F
) > /usr/src/dgrp-1.9/dkms.conf
echo "Adding module to DKMS..."
dkms add -m dgrp -v 1.9
echo "Building using DKMS..."
dkms build -m dgrp -v 1.9
echo "Installing using DKMS..."
dkms install -m dgrp -v 1.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.