diff options
| author | Simon Rettberg | 2014-04-17 15:06:10 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2014-04-17 15:06:10 +0200 |
| commit | ed66ffde51ae0d35eb0af7d908237d4f51a40f13 (patch) | |
| tree | ae9c7f72170a5efa11b5b51bc827052d07f81d07 /remote/modules/vmware/module.build | |
| parent | [remote/include/qt] Fix qt version selection on systems without qtchooser (diff) | |
| parent | [vmware] added patch for vmnet + old patching functionality (diff) | |
| download | tm-scripts-ed66ffde51ae0d35eb0af7d908237d4f51a40f13.tar.gz tm-scripts-ed66ffde51ae0d35eb0af7d908237d4f51a40f13.tar.xz tm-scripts-ed66ffde51ae0d35eb0af7d908237d4f51a40f13.zip | |
Merge branch 'master' of dnbd3:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/vmware/module.build')
| -rw-r--r-- | remote/modules/vmware/module.build | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/remote/modules/vmware/module.build b/remote/modules/vmware/module.build index 98ee2b8d..4d08c5c5 100644 --- a/remote/modules/vmware/module.build +++ b/remote/modules/vmware/module.build @@ -31,14 +31,54 @@ 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 + 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 + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmnet $(which gcc) "${KERNEL_HEADERS_PATH}/include" vmplayer vmnet + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot 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 + 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 +103,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 +} + |
