summaryrefslogtreecommitdiffstats
path: root/remote/modules/kernel-system
diff options
context:
space:
mode:
authorSimon Rettberg2014-07-04 14:46:20 +0200
committerSimon Rettberg2014-07-04 14:46:20 +0200
commitd1f5aedd76df437a08f3283fa00bc8a9dab7fa2b (patch)
tree8c046eeaf8e874b479b95964b2bf410365cff438 /remote/modules/kernel-system
parentremove hardcoded /bin/rm call. Relative calls work in services files (diff)
downloadtm-scripts-d1f5aedd76df437a08f3283fa00bc8a9dab7fa2b.tar.gz
tm-scripts-d1f5aedd76df437a08f3283fa00bc8a9dab7fa2b.tar.xz
tm-scripts-d1f5aedd76df437a08f3283fa00bc8a9dab7fa2b.zip
"Fedora Support", step 1 ->
Several changes: 1) Make sure /bin /sbin /lib and /lib64 are ALWAYS symlinks to /usr/XXX, no matter what the current distribution does. 2) Make sure nobody and nogroup exist. 3) Fix various modules making assumptions that are not true on every distro. 4) Add symlinks to kdm module since fedora is looking for kdmrc in yet another spot. 5) Add detection of fedora, support its package manager What still breaks: dnbd3 Other distros might not work now, they need adaption to changed logic in some modules.
Diffstat (limited to 'remote/modules/kernel-system')
-rw-r--r--remote/modules/kernel-system/module.build20
-rw-r--r--remote/modules/kernel-system/module.conf.fedora6
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
+"