diff options
Diffstat (limited to 'remote/modules/kernel-system')
-rw-r--r-- | remote/modules/kernel-system/module.build | 20 | ||||
-rw-r--r-- | remote/modules/kernel-system/module.conf.fedora | 6 |
2 files changed, 20 insertions, 6 deletions
diff --git a/remote/modules/kernel-system/module.build b/remote/modules/kernel-system/module.build index 91dc4d35..d698db22 100644 --- a/remote/modules/kernel-system/module.build +++ b/remote/modules/kernel-system/module.build @@ -10,8 +10,14 @@ get_kernel_version(){ declare -rg KERNEL_NEW_VERSION="$KERNEL_CURRENT_VERSION" 2>/dev/null # check linux headers directory - if [ -d "/usr/src/linux-headers-$(uname -r)" ]; then - declare -rg KERNEL_HEADERS_PATH="/usr/src/linux-headers-$(uname -r)" 2>/dev/null + if [ -d "/lib/modules/$KERNEL_CURRENT_VERSION/build" ]; then + declare -rg KERNEL_HEADERS_PATH="/lib/modules/$KERNEL_CURRENT_VERSION/build" 2>/dev/null + elif [ -d "/lib/modules/$KERNEL_CURRENT_VERSION/source" ]; then + declare -rg KERNEL_HEADERS_PATH="/lib/modules/$KERNEL_CURRENT_VERSION/source" 2>/dev/null + elif [ -d "/usr/src/linux-headers-$KERNEL_CURRENT_VERSION" ]; then + declare -rg KERNEL_HEADERS_PATH="/usr/src/linux-headers-$KERNEL_CURRENT_VERSION" 2>/dev/null + elif [ -d "/usr/src/kernels/$KERNEL_CURRENT_VERSION" ]; then + declare -rg KERNEL_HEADERS_PATH="/usr/src/kernels/$KERNEL_CURRENT_VERSION" 2>/dev/null else # fetch source did not install the headers correctly. perror "kernel headers for $KERNEL_CURRENT_VERSION not found! Re-build the kernel-system module" @@ -19,7 +25,7 @@ get_kernel_version(){ # check kernel modules/firmware directory if [ -d "/lib/modules/${KERNEL_CURRENT_VERSION}" -a \ - -d "/lib/firmware/${KERNEL_CURRENT_VERSION}" ]; then + -d "/lib/firmware" ]; then # The expected paths exists, set KERNEL_BASE_DIR to / declare -rg KERNEL_BASE_DIR="/" 2>/dev/null else @@ -52,11 +58,13 @@ build() { # simply copy the kernel from the running system # to the build directory as it is. local KERNEL_SYSTEM_PATH="" + local BOOT_IMAGE="" # 1st "parse" /proc/cmdline for the kernel name for i in $(cat /proc/cmdline); do - [[ "$i" =~ ^BOOT_IMAGE=.* ]] && local BOOT_IMAGE="$(basename $(echo $i|cut -c 12-))" + [[ "$i" == BOOT_IMAGE=* ]] && BOOT_IMAGE="$(basename "${i#BOOT_IMAGE=}")" done + [ -z "${BOOT_IMAGE}" ] && local BOOT_IMAGE="$(uname -r)" # exit if KERNEL_SYSTEM_FILENAME is empty, should not happen [ -z "${BOOT_IMAGE}" ] && perror "Could not determine the full path to the running kernel..." @@ -64,14 +72,14 @@ build() { # now find it in KERNEL_SYSTEM_SEARCH_PATH # NOTE: this variable should be expanded in the future if new locations are to be searched local KERNEL_SYSTEM_SEARCH_PATH="/boot" - local KERNEL_SYSTEM_SEARCH_RESULTS="$(find "${KERNEL_SYSTEM_SEARCH_PATH}" -type f -iname "*${BOOT_IMAGE}*")" + local KERNEL_SYSTEM_SEARCH_RESULTS="$(find "${KERNEL_SYSTEM_SEARCH_PATH}" -type f -name "${BOOT_IMAGE}")" if [ "$(echo $KERNEL_SYSTEM_SEARCH_RESULTS|wc -w)" -eq 1 ]; then # we found the running kernel path KERNEL_SYSTEM_PATH="${KERNEL_SYSTEM_SEARCH_RESULTS}" else # we found more than one, shouldn't happen... - perror "Found more than one kernel named '${BOOT_IMAGE}' inside '${KERNEL_SYSTEM_SEARCH_PATH}'." + perror "Found no or more than one kernel named '${BOOT_IMAGE}' in '${KERNEL_SYSTEM_SEARCH_PATH}'." fi # at this point, we should definitly have KERNEL_SYSTEM_PATH, check just in case :) diff --git a/remote/modules/kernel-system/module.conf.fedora b/remote/modules/kernel-system/module.conf.fedora new file mode 100644 index 00000000..cf683784 --- /dev/null +++ b/remote/modules/kernel-system/module.conf.fedora @@ -0,0 +1,6 @@ +REQUIRED_INSTALLED_PACKAGES=" + kernel-headers +" +REQUIRED_CONTENT_PACKAGES=" + kernel-headers +" |