-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdkms-module_build.sh
More file actions
executable file
·32 lines (23 loc) · 1.12 KB
/
Copy pathdkms-module_build.sh
File metadata and controls
executable file
·32 lines (23 loc) · 1.12 KB
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
#!/bin/bash
# make the script stop on error
set -e
BIN_ABSPATH="$(dirname "$(readlink -f "${0}")")"
KERNEL_MODULE_NAME="${1}"
DKMS_MODULE_VERSION="${2}"
. "${BIN_ABSPATH}/kernel-version_get.sh"
echo "Building for kernel version ${KERNEL_VERSION}"
# build and install the DKMS module and update initramfs ------------------------------------------
dkms build -k "${KERNEL_VERSION}" -m "${KERNEL_MODULE_NAME}" -v "${DKMS_MODULE_VERSION}" --force
dkms install -k "${KERNEL_VERSION}" -m "${KERNEL_MODULE_NAME}" -v "${DKMS_MODULE_VERSION}" --force
if dmesg | grep -q 'initramfs'; then
if grep -qE "^ID(_LIKE)?=debian" /etc/os-release; then
update-initramfs -u -k "${KERNEL_VERSION}"
elif grep -q "^ID=arch" /etc/os-release; then
mkinitcpio -P
elif grep -q "^ID=fedora" /etc/os-release; then
sudo dracut --regenerate-all --force --parallel
else
echo "Update of initramfs not (yet) supported for your Linux distro. You might want to modify the distro-specific commands."
fi
fi
printf '\n%s\n %s\n' "Please reboot your system and check whether ${KERNEL_MODULE_NAME} has been loaded via the command" 'dkms status'