summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmware/module.build
diff options
context:
space:
mode:
authorManuel Schneider2014-04-22 15:58:35 +0200
committerManuel Schneider2014-04-22 15:58:35 +0200
commit6170a9e2db4bed1445480af0d8170a9b17da062e (patch)
tree0bb3f89c75afd1723a9faee9d3a7944622d72e1d /remote/modules/vmware/module.build
parent[beamergui] added missing ip (diff)
parent[pam] libncp, ncpfs and libpam-ncp (ncpfs depends on libpam-ncp) for Ubuntu 1... (diff)
downloadtm-scripts-6170a9e2db4bed1445480af0d8170a9b17da062e.tar.gz
tm-scripts-6170a9e2db4bed1445480af0d8170a9b17da062e.tar.xz
tm-scripts-6170a9e2db4bed1445480af0d8170a9b17da062e.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/vmware/module.build')
-rw-r--r--remote/modules/vmware/module.build51
1 files changed, 50 insertions, 1 deletions
diff --git a/remote/modules/vmware/module.build b/remote/modules/vmware/module.build
index 98ee2b8d..57e8cb91 100644
--- a/remote/modules/vmware/module.build
+++ b/remote/modules/vmware/module.build
@@ -31,14 +31,51 @@ build() {
# sanity check to see if KERNEL_HEADERS_PATH is set and exists
[ -z "${KERNEL_HEADERS_PATH}" -o ! -e "${KERNEL_HEADERS_PATH}" ] && perror "KERNEL_HEADERS_PATH ('"${KERNEL_HEADERS_PATH}"') not found. Was the kernel module built?"
+ # build in two steps, to be able to use mltk function while patching modules
pinfo "Installing vmware per chroot..."
chroot_run "${MODULE_BUILD_DIR}" <<-EOF
# PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot
$DELETE_FILES
yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required
+ EOF
+ # check if we need to patch modules
+ cd "${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source" \
+ || perror "Could not cd to '${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source'"
+
+ local KMOD SHORT PATCH MIN_KERN MAX_KERN
+ for KMOD in *.tar; do
+ SHORT="${KMOD%%.tar}"
+ [ -e ".${SHORT}.patched" ] && continue
+ for PATCH in $(find "${MODULE_DIR}/patches/" -name "${SHORT}__*__*.patch"); do
+ parse_patch_name "$PATCH"
+ [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename"
+ if version_lt "$SYS_KERNEL" "$MIN_KERN" || version_gt "$SYS_KERNEL" "$MAX_KERN"; then
+ pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)"
+ continue # Not suitable for our kernel
+ fi
+ pinfo "Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)"
+ [ ! -d "${SHORT}-only" ] && tar xf "$KMOD"
+ [ ! -d "${SHORT}-only" ] && perror "untar of $KMOD failed."
+ cd "${SHORT}-only" || perror "Where is ${SHORT}-only?"
+ if ! patch -p1 < "$PATCH"; then
+ cd ..
+ rm -rf -- "${SHORT}-only"
+ perror "Applying $PATCH failed."
+ fi
+ cd ..
+ done
+ if [ -d "${SHORT}-only" ]; then
+ tar cf "$KMOD" "${SHORT}-only/" || perror "repacking of $KMOD failed."
+ rm -rf -- "${SHORT}-only"
+ touch ".${SHORT}.patched"
+ fi
+ done
+ cd "${MODULE_DIR}" || perror "Could not cd to '${MODULE_DIR}'"
+
+ # now build modules inside the chroot
+ chroot_run "${MODULE_BUILD_DIR}" <<-EOF
vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmnet $(which gcc) "${KERNEL_HEADERS_PATH}/include" vmplayer vmnet
vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmmon $(which gcc) "${KERNEL_HEADERS_PATH}/include" vmplayer vmmon
- # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot
EOF
# cleanup unneeded files
@@ -63,3 +100,15 @@ post_copy() {
cp "${MODULE_BUILD_DIR}/lib/modules/$SYS_UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!"
}
+parse_patch_name() {
+ [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count."
+ local PATCH="$1"
+ MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g')
+ [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g')
+ MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__[0-9\.]+-([0-9\.]+)__[^_]+\.patch$/\1/g')
+ [[ "$MAX_KERN" == /* ]] && MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g')
+ [[ "$MIN_KERN" == /* ]] && MIN_KERN=
+ [[ "$MAX_KERN" == /* ]] && MAX_KERN=
+ # TODO: Parse min and max vmplayer/workstation version
+}
+