summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmware/module.build
diff options
context:
space:
mode:
authorSimon Rettberg2014-04-01 15:35:26 +0200
committerSimon Rettberg2014-04-01 15:35:26 +0200
commitc189f9ce049cbae19aaad06ae74a642b1e0733d4 (patch)
treea1db240f7adba119bc7469474bed73d3cd23bb58 /remote/modules/vmware/module.build
parent[vmware/vmchooser] Generalize string cleaning function (diff)
parent[config curitiba] add curitiba config (diff)
downloadtm-scripts-c189f9ce049cbae19aaad06ae74a642b1e0733d4.tar.gz
tm-scripts-c189f9ce049cbae19aaad06ae74a642b1e0733d4.tar.xz
tm-scripts-c189f9ce049cbae19aaad06ae74a642b1e0733d4.zip
Merge branch 'master' of simonslx:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/vmware/module.build')
-rw-r--r--remote/modules/vmware/module.build65
1 files changed, 65 insertions, 0 deletions
diff --git a/remote/modules/vmware/module.build b/remote/modules/vmware/module.build
new file mode 100644
index 00000000..98ee2b8d
--- /dev/null
+++ b/remote/modules/vmware/module.build
@@ -0,0 +1,65 @@
+fetch_source() {
+ [ -e "${MODULE_DIR}/src" -a -d "${MODULE_DIR}/src" ] && \
+ { rm -r "${MODULE_DIR}/src" || perror "Could not delete old src dir."; }
+ mkdir -p "${MODULE_DIR}/src" || perror "Could not mkdir src"
+ cd "${MODULE_DIR}/src" || perror "cd fail."
+
+ # Get directory listing
+ wget -O "index.html" "$REQUIRED_DOWNLOAD_BASE" || perror "Could not download vmware dir index"
+
+ VMWARE_BUNDLE_FILE=$(grep -E -o -i "href=\"VMware-$REQUIRED_TYPE-[^\"]+[\._\-]$ARCHREGEX[\._\-][^\"]+\"" "index.html" | head -n 1 | awk -F '"' '{printf $2}')
+ [ -z "$VMWARE_BUNDLE_FILE" ] && perror "Could not determine vmware $REQUIRED_TYPE bundle file for current arch from $MODULE_DIR/src/index.html"
+ # Download file
+ wget -O "$VMWARE_BUNDLE_FILE" "$REQUIRED_DOWNLOAD_BASE/$VMWARE_BUNDLE_FILE" || perror "Could not download $VMWARE_BUNDLE_FILE from $REQUIRED_DOWNLOAD_BASE"
+ if [[ "$VMWARE_BUNDLE_FILE" == *.tar ]]; then
+ tar -x "${VMWARE_BUNDLE_FILE%.tar}" -f "$VMWARE_BUNDLE_FILE" || perror "Could not untar downloaded $VMWARE_BUNDLE_FILE"
+ unlink "$VMWARE_BUNDLE_FILE"
+ VMWARE_BUNDLE_FILE="${VMWARE_BUNDLE_FILE%.tar}"
+ fi
+
+ cd - >/dev/null
+}
+
+build() {
+ local DELETE_FILES
+ DELETE_FILES=$(for LINE in $REQUIRED_VMWARE_DELETIONS;do echo rm -rf $LINE; done)
+
+ # prepare the build directory with the files needed during the chroot
+ cp "${MODULE_DIR}/src/$VMWARE_BUNDLE_FILE" "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE"
+ cp -r "${MODULE_DIR}/patches" "${MODULE_BUILD_DIR}"
+
+ # 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?"
+
+ 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
+ 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
+ rm -rf -- "${MODULE_BUILD_DIR}/etc/vmware-installer"
+ rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-installer"
+ rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-ovftool"
+ unlink "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE"
+
+}
+
+post_copy() {
+ # FIXME: gconftool is copied without dependencies
+ tarcopy "$(find /usr/lib/ /usr/lib64 -name gconv -type d)" "$TARGET_BUILD_DIR"
+
+ # Update Icon cache for vmplayer
+ gtk-update-icon-cache-3.0 "${TARGET_BUILD_DIR}/usr/share/icons/hicolor/" || pwarning "update-icon-cache-3.0 failed."
+
+ # fix vmware-usbarbitrator bug
+ date +'%Y.%m.%d' >"${TARGET_BUILD_DIR}/etc/arch-release"
+
+ mkdir -p "$TARGET_BUILD_DIR/lib/modules/vmware/"
+ cp "${MODULE_BUILD_DIR}/lib/modules/$SYS_UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!"
+}
+