diff --git a/Makefile b/Makefile index 0c6313f4..42c8f36d 100644 --- a/Makefile +++ b/Makefile @@ -9,28 +9,44 @@ SHELL=bash SBIN = /usr/sbin LIBDIR = /usr/lib/dkms +MODDIR = /lib/modules KCONF = /etc/kernel SYSTEMD = /usr/lib/systemd/system #Define the top-level build directory BUILDDIR := $(shell pwd) -all: dkms dkms.8 dkms_autoinstaller dkms.service kernel_install.d_dkms kernel_postinst.d_dkms +all: \ + dkms \ + dkms.8 \ + dkms_autoinstaller \ + dkms.bash-completion \ + dkms_common.postinst \ + dkms_framework.conf \ + dkms.service \ + kernel_install.d_dkms \ + kernel_postinst.d_dkms \ + kernel_prerm.d_dkms clean: -rm -rf dist/ -rm -rf dkms -rm -rf dkms.8 -rm -rf dkms_autoinstaller + -rm -rf dkms.bash-completion + -rm -rf dkms_common.postinst + -rm -rf dkms_framework.conf -rm -rf dkms.service -rm -rf kernel_install.d_dkms -rm -rf kernel_postinst.d_dkms + -rm -rf kernel_prerm.d_dkms SED_PROCESS = \ sed -e 's,@RELEASE_STRING@,$(RELEASE_STRING),g' \ -e 's,@RELEASE_DATE@,$(RELEASE_DATE),g' \ -e 's,@SBINDIR@,$(SBIN),g' \ -e 's,@KCONFDIR@,$(KCONF),g' \ + -e 's,@MODDIR@,$(MODDIR),g' \ -e 's,@LIBDIR@,$(LIBDIR),g' $^ > $@ dkms: dkms.in @@ -42,6 +58,15 @@ dkms.8: dkms.8.in dkms_autoinstaller: dkms_autoinstaller.in $(SED_PROCESS) +dkms.bash-completion: dkms.bash-completion.in + $(SED_PROCESS) + +dkms_common.postinst: dkms_common.postinst.in + $(SED_PROCESS) + +dkms_framework.conf: dkms_framework.conf.in + $(SED_PROCESS) + dkms.service: dkms.service.in $(SED_PROCESS) @@ -51,6 +76,9 @@ kernel_install.d_dkms: kernel_install.d_dkms.in kernel_postinst.d_dkms: kernel_postinst.d_dkms.in $(SED_PROCESS) +kernel_prerm.d_dkms: kernel_prerm.d_dkms.in + $(SED_PROCESS) + install: all $(if $(strip $(VAR)),$(error Setting VAR is not supported)) install -d -m 0755 $(DESTDIR)/var/lib/dkms diff --git a/dkms.8.in b/dkms.8.in index 55b9c9cf..eb8c91ff 100644 --- a/dkms.8.in +++ b/dkms.8.in @@ -374,7 +374,7 @@ This option executes modprobe on the modules upon successful installation. Using this option you can specify the location of your kernel source directory. Most likely you will not need to set this if your kernel source is accessible via -.I /lib/modules/$kernel_version/build. +.I @MODDIR@/$kernel_version/build. .TP .B \-\-directive <"cli\-directive=cli\-value"> Using this option, you can specify additional directives from the command @@ -421,13 +421,13 @@ Enable verbose output of external commands executed in DKMS. During the first install of a module for a , .B dkms will search -.I /lib/modules/ +.I @MODDIR@/ for a pre-existing module of the same name. If one is found, it will automatically be saved as an "original_module" so that if the newer module is later removed, .B dkms will put the original module back in its place. Currently, DKMS searches for these original modules with first preference going to modules located in -.I /lib/modules//updates/ +.I @MODDIR@//updates/ followed by .B $DEST_MODULE_LOCATION (as specified in @@ -526,7 +526,7 @@ This directive specifies the destination where a module should be installed to, is used for finding original_modules. This is a .B required directive, except as noted below. This directive must start with the text "/kernel" which is in reference to -/lib/modules//kernel. +@MODDIR@//kernel. Note that for each module within a dkms package, the numeric value of .B # must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and @@ -744,12 +744,12 @@ values. This variable can be used within a directive definition and during use, the actual kernel version in question will be substituted in its place. This is especially useful in MAKE commands when specifying which INCLUDE statements should be used when compiling your -module (eg. MAKE="make all INCLUDEDIR=/lib/modules/${kernelver}/build/include"). +module (eg. MAKE="make all INCLUDEDIR=@MODDIR@/${kernelver}/build/include"). .TP .B $kernel_source_dir This variable holds the value of the location of your kernel source directory. Usually, this will be -.IR /lib/modules/$kernelver/build , +.IR @MODDIR@/$kernelver/build , unless otherwise specified with the .B \-\-kernelsourcedir option. @@ -785,7 +785,7 @@ Control which folders DKMS uses for components and artifacts. Can be set to anything but a null value to enable verbose output of external commands executed in DKMS. .TP .B $symlink_modules -Controls whether binary modules are copied to /lib/modules or if only symlinks are created there. Note that these variables can also +Controls whether binary modules are copied to @MODDIR@ or if only symlinks are created there. Note that these variables can also be manipulated on the command line with \-\-dkmstree, \-\-sourcetree, \-\-installtree and \-\-symlink-modules options. .TP diff --git a/dkms.bash-completion b/dkms.bash-completion.in similarity index 97% rename from dkms.bash-completion rename to dkms.bash-completion.in index a81679cb..a72aefaa 100644 --- a/dkms.bash-completion +++ b/dkms.bash-completion.in @@ -7,7 +7,7 @@ # _kernels() { - COMPREPLY=( $( cd /lib/modules && compgen -d -- "$cur" ) ) + COMPREPLY=( $( cd @MODDIR@ && compgen -d -- "$cur" ) ) } # complete on full directory names under $1 diff --git a/dkms.in b/dkms.in index f63b6597..6fc35cba 100644 --- a/dkms.in +++ b/dkms.in @@ -2394,7 +2394,7 @@ current_os=$(uname -s) running_distribution=$(distro_version) || exit dkms_tree="/var/lib/dkms" source_tree="/usr/src" -install_tree="/lib/modules" +install_tree="@MODDIR@" tmp_location=${TMPDIR:-/tmp} verbose="" symlink_modules="" diff --git a/dkms_autoinstaller.in b/dkms_autoinstaller.in index 0d4e46ca..8dcfe82a 100755 --- a/dkms_autoinstaller.in +++ b/dkms_autoinstaller.in @@ -43,7 +43,7 @@ uname_s=$(uname -s) _get_kernel_dir() { KVER=$1 case ${uname_s} in - Linux) DIR="/lib/modules/$KVER/build" ;; + Linux) DIR="@MODDIR@/$KVER/build" ;; GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;; esac echo $DIR diff --git a/dkms_common.postinst b/dkms_common.postinst.in similarity index 96% rename from dkms_common.postinst rename to dkms_common.postinst.in index 18459ff0..fad3092a 100644 --- a/dkms_common.postinst +++ b/dkms_common.postinst.in @@ -13,7 +13,7 @@ uname_s=$(uname -s) _get_kernel_dir() { KVER=$1 case ${uname_s} in - Linux) DIR="/lib/modules/$KVER/build" ;; + Linux) DIR="@MODDIR@/$KVER/build" ;; GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;; esac echo $DIR @@ -31,7 +31,7 @@ _check_kernel_dir() { # Check the existence of a kernel named as $1 _is_kernel_name_correct() { - if [ -e "/lib/modules/$1" ]; then + if [ -e "@MODDIR@/$1" ]; then echo yes else echo no @@ -127,7 +127,7 @@ if [ -r /etc/dkms/framework.conf ]; then . /etc/dkms/framework.conf fi -KERNELS=$(ls -dv /lib/modules/*/build 2>/dev/null | cut -d/ -f4 || true) +KERNELS=$(ls -dv @MODDIR@/*/build 2>/dev/null | cut -d/ -f4 || true) CURRENT_KERNEL=$(uname -r) #We never want to keep an older version side by side to prevent conflicts @@ -156,14 +156,14 @@ elif [ -d "/usr/src/$NAME-$VERSION" ]; then fi # On 1st installation, let us look for a directory -# in /lib/modules which matches $(uname -r). If none +# in @MODDIR@ which matches $(uname -r). If none # is found it is possible that buildd is being used # and that uname -r is giving us the name of the # kernel used by the buildd machine. # # If this is the case we try to build the kernel # module for each kernel which has a directory in -# /lib/modules. Furthermore we will have to tell +# @MODDIR@. Furthermore we will have to tell # DKMS which architecture it should build the module # for (e.g. if the buildd machine is using a # 2.6.24-23-xen 64bit kernel). diff --git a/dkms_framework.conf b/dkms_framework.conf.in similarity index 95% rename from dkms_framework.conf rename to dkms_framework.conf.in index 6ad6dd2a..b3ea3e9c 100644 --- a/dkms_framework.conf +++ b/dkms_framework.conf.in @@ -7,8 +7,8 @@ # DKMS Tree Location (default: /var/lib/dkms): # dkms_tree="/var/lib/dkms" -# Install Tree Location (default: /lib/modules): -# install_tree="/lib/modules" +# Install Tree Location (default: @MODDIR@): +# install_tree="@MODDIR@" # Temporary folder Location (default: /tmp): # tmp_location="/tmp" diff --git a/kernel_postinst.d_dkms.in b/kernel_postinst.d_dkms.in index 82fcfff1..f4ccc950 100755 --- a/kernel_postinst.d_dkms.in +++ b/kernel_postinst.d_dkms.in @@ -8,7 +8,7 @@ uname_s=$(uname -s) _get_kernel_dir() { KVER=$1 case ${uname_s} in - Linux) DIR="/lib/modules/$KVER/build" ;; + Linux) DIR="@MODDIR@/$KVER/build" ;; GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;; esac echo "$DIR" diff --git a/kernel_prerm.d_dkms b/kernel_prerm.d_dkms.in similarity index 91% rename from kernel_prerm.d_dkms rename to kernel_prerm.d_dkms.in index 9d507fe0..cbf0c942 100755 --- a/kernel_prerm.d_dkms +++ b/kernel_prerm.d_dkms.in @@ -21,7 +21,7 @@ if command -v dkms > /dev/null; then fi rmdir --ignore-fail-on-non-empty \ - "/lib/modules/$inst_kern/updates/dkms" \ - "/lib/modules/$inst_kern/updates" 2>/dev/null + "@MODDIR@/$inst_kern/updates/dkms" \ + "@MODDIR@/$inst_kern/updates" 2>/dev/null exit 0