-
Notifications
You must be signed in to change notification settings - Fork 0
/
dkms.post_build.sh
executable file
·51 lines (42 loc) · 1.04 KB
/
dkms.post_build.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Post-build hook to copy Module.symvers into the DKMS tree alongside the .ko
# files, so that other modules can build against it
if [ ${#} -ne 2 ]
then
echo "usage: dkms.post_build.sh <symvers_directory> <package_directory>"
exit 1
fi
SYMVERS_DIR=${1}
PACKAGE_DIR=${2}
if [ ! -d ${SYMVERS_DIR} ]
then
echo "error: ${SYMVERS_DIR} is not a directory"
exit 1
fi
if [ ! -d ${PACKAGE_DIR} ]
then
echo "error: ${PACKAGE_DIR} is not a directory"
exit 1
fi
if [ ! -f ${SYMVERS_DIR}/Module.symvers ]
then
echo "error: ${SYMVERS_DIR}/Module.symvers is not present or is not a file"
exit 1
fi
if [ -z "${kernelver}" ]
then
echo "error: '${kernelver}' is empty"
exit 1
fi
if [ -z "${arch}" ]
then
echo "error: '${arch}' is empty"
exit 1
fi
if [ ! -d ${PACKAGE_DIR}/${kernelver}/${arch}/module ]
then
echo "error: ${PACKAGE_DIR}/${kernelver}/${arch}/module directory does not exist"
exit 1
fi
cp -f ${SYMVERS_DIR}/Module.symvers ${PACKAGE_DIR}/${kernelver}/${arch}/module
exit ${?}