summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmware/vmplayer.build
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/vmware/vmplayer.build')
-rw-r--r--remote/modules/vmware/vmplayer.build162
1 files changed, 162 insertions, 0 deletions
diff --git a/remote/modules/vmware/vmplayer.build b/remote/modules/vmware/vmplayer.build
new file mode 100644
index 00000000..85929c17
--- /dev/null
+++ b/remote/modules/vmware/vmplayer.build
@@ -0,0 +1,162 @@
+fetch_source() {
+ [ -e "./src" ] && { rm -r ./src || perror "Could not delete old src dir."; }
+ mkdir -p "./src" || perror "Could not mkdir src"
+ cd "./src" || perror "cd fail."
+ # Get directory listing
+ wget -O "index.html" "$REQUIRED_DOWNLOAD_BASE" || perror "Could not download vmware dir index"
+ # # Try to treat it as version listing
+ # local LATEST=$(grep -o -E '"[0-9]+\.[0-9]+\.[0-9]+/' "index.html" | cut -c 2- | sort --version-sort | tail -n 1)
+ # if [ -n "$LATEST" ]; then
+ # REQUIRED_DOWNLOAD_BASE+="$LATEST"
+ # # Determine latest build
+ # fi
+ local FILE=$(grep -E -o -i "href=\"VMware-$REQUIRED_TYPE-[^\"]+[\._\-]$ARCHREGEX[\._\-][^\"]+\"" "index.html" | head -n 1 | awk -F '"' '{printf $2}')
+ [ -z "$FILE" ] && perror "Could not determine vmware $REQUIRED_TYPE bundle file for current arch from $MODULE_DIR/src/index.html"
+ # Download file
+ wget -O "$FILE" "$REQUIRED_DOWNLOAD_BASE/$FILE" || perror "Could not download $FILE from $REQUIRED_DOWNLOAD_BASE"
+ if [[ "$FILE" == *.tar ]]; then
+ tar -x "${FILE%.tar}" -f "$FILE" || perror "Could not untar downloaded $FILE"
+ unlink "$FILE"
+ FILE="${FILE%.tar}"
+ fi
+ pinfo "Extracting bundle of VMware $(echo "$FILE" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') build $(echo "$FILE" | grep -o -E '[0-9]{7,9}') for $(echo "$FILE" | grep -o -E "$ARCHREGEX")"
+ ./$FILE -x "./bundle/" || perror "Extracting the vmware bundle failed."
+ pinfo "done"
+}
+
+build() {
+ local SRCDIR="./src/bundle"
+ [ ! -d "$SRCDIR" ] && perror "Extracted vmplayer bundle not found in $SRCDIR - please clean vmplayer module."
+ local TARGET="$MODULE_BUILD_DIR/usr/lib/vmware/"
+ mkdir -p "$TARGET"{lib,share,bin}
+ pinfo "Copying data to build dir"
+ cp -r ./$SRCDIR/vmware-installer/lib/lib* "$TARGET" || perror "Could not copy libs from vmware-installer"
+ cp -r ./$SRCDIR/vmware-network-editor/lib "$MODULE_BUILD_DIR/usr/" || perror "Could not copy libs from vmware-network-config"
+ cp -r ./$SRCDIR/vmware-$REQUIRED_TYPE/lib/share "$TARGET" || perror "Could not copy lib/share from vmware-player"
+ cp -r ./$SRCDIR/vmware-$REQUIRED_TYPE/share "$MODULE_BUILD_DIR/usr/" || perror "C0oudld not copy share from vmware-player"
+ cp -r ./$SRCDIR/vmware-player-app/etc "$MODULE_BUILD_DIR/" || perror "Could not copy bin and etc from vmware-player-app."
+ cp -r ./$SRCDIR/vmware-player-app/lib/* "$TARGET" || perror "Could not copy lib subtree from vmware-player-app."
+ cp -r ./$SRCDIR/vmware-player-app/{bin,share} "$MODULE_BUILD_DIR/usr/" || perror "could not copy share from vmware-player-app."
+ cp -r ./$SRCDIR/vmware-usbarbitrator/bin "$MODULE_BUILD_DIR/usr/" || perror "Could not copy bin from vmware-usbarbitrator."
+ cp -r ./$SRCDIR/vmware-vmx/{bin,etc,sbin} "$MODULE_BUILD_DIR/usr/" || perror "could not copy bin,etc,sbin to usr for vmare-vmx."
+ cp -r ./$SRCDIR/vmware-vmx/lib/{bin,icu,lib,libconf,scripts} "$TARGET" || perror "Could not copy many things from vmware-vmx."
+ [ -d "./$SRCDIR/vmware-workstation-server" ] && cp -r ./$SRCDIR/vmware-workstation-server/{bin,lib} "$TARGET" || perror "Could not copy many things from vmware-workstation-server."
+ [ ! -L "$TARGET/bin/vmplayer" ] && { ln -s /usr/lib/vmware/bin/appLoader "$TARGET/bin/vmplayer" || perror "Could not link vmplayer to appLoader."; }
+ chmod +x "$TARGET"/bin/*
+ chmod u+s "$TARGET"/bin/vmware-vmx* || perror "Error setting suid-bit on vmware-vmx*"
+ chmod +x "$MODULE_BUILD_DIR"/usr/{bin,sbin}/*
+ chmod u+s "$MODULE_BUILD_DIR"/usr/bin/vmware-mount || perror "Error setting suid-bit on vmware-mount"
+ chmod u+s "$MODULE_BUILD_DIR"/usr/sbin/vmware-authd || perror "Error setting suid-bit on vmware-authd"
+ chmod +x "$TARGET"/lib/*.sh
+ find "$MODULE_BUILD_DIR" -name '*.sh' -exec chmod +x {} \;
+ for file in $(grep -rl -E "^#!/" "$MODULE_BUILD_DIR"); do
+ chmod +x "$file"
+ done
+ pinfo "Patching LIBCONF_DIR"
+ local file=""
+ for file in $(grep -rl "@@LIBCONF_DIR@@" "$MODULE_BUILD_DIR"); do
+ sed -i 's#@@LIBCONF_DIR@@#/usr/lib/vmware/libconf#g' "$file"
+ done
+
+ # Compile kernel modules
+ pinfo "Compiling required kernel modules."
+ # build modules
+ build_modules
+
+}
+
+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-usbarbotrator bug
+ date +'%Y.%m.%d' >"${TARGET_BUILD_DIR}/etc/arch-release"
+ copy_modules
+}
+
+build_modules() {
+ # need to be in src
+ cd "$MODULE_DIR/src" || perror "Could not cd to '$MODULE_DIR/src'"
+ local VMWARE_MODCONFIG="$MODULE_DIR/$SRCDIR/vmware-vmx/bin/vmware-modconfig"
+ [ -e "$VMWARE_MODCONFIG" ] && chmod +x "$VMWARE_MODCONFIG" || perror "Could not find $VMWARE_MODCONFIG"
+ # link vmware-modconfig-console in the build dir
+ local MANIFEST="$MODULE_DIR/$SRCDIR/vmware-vmx/manifest.xml"
+ local BUILD_NUMBER="$(grep -o -E '<buildNumber>[0-9]*</buildNumber>' "$MANIFEST"|grep -o -E '[0-9]*')"
+ local VERSION="$(grep -o -E '<version>[0-9\.]*</version>' "$MANIFEST"|grep -o -E '[0-9\.]*')"
+ local CORE_VERSION="$(grep -o -E '<coreVersion>[0-9\.]*</coreVersion>' "$MANIFEST"|grep -o -E '[0-9\.]*')"
+ # /etc/vmware/config gen
+
+ sed -i.bak1 '/^ETCDIR/d;/^VMISETCDIR/d;/bootstrap/d' "$VMWARE_MODCONFIG"
+ sed -i.bak2 "s/libdir=.*/libdir=$(echo $MODULE_BUILD_DIR | escape_replace)\/usr\/lib\/vmware/g" "$VMWARE_MODCONFIG"
+ sed -i.bak3 "s#set -e#set -e\nPREFIX=\"/usr\"\nBINDIR=\"/usr/bin\"\nSBINDIR=\"/usr/sbin\"\nLIBDIR=\"/usr/lib\"\nDATADIR=\"/usr/share\"\nSYSCONFDIR=\"/etc\"\nDOCDIR=\"/usr/share/doc\"\nMANDIR=\"/usr/share/man\"\nINCLUDEDIR=\"/usr/include\"\nINITDIR=\"/etc\"\nINITSCRIPTDIR=\"/etc/init.d\"\nVMWARE_INSTALLER=\"/usr/lib/vmware-installer/$CORE_VERSION\"\nVERSION=\"$CORE_VERSION\"\nVMISVERSION=\"$CORE_VERSION\"\nVMISPYVERSION=\"25\"#g" "$VMWARE_MODCONFIG"
+
+
+ [ -e "/etc/vmware/config" ] && cp "/etc/vmware/config" "/etc/vmware/config.mltk.bak"
+ mkdir -p "/etc/vmware" || perror "Could not create /etc/vmware"
+ cat > "/etc/vmware/config" << EOF
+.encoding = "UTF-8"
+installerDefaults.componentDownloadEnabled = "yes"
+installerDefaults.dataCollectionEnabled = "no"
+installerDefaults.transferVersion = "1"
+installerDefaults.autoSoftwareUpdateEnabled = "yes"
+NETWORKING = "yes"
+VMBLOCK_CONFED = "yes"
+gksu.rootMethod = "sudo"
+libdir = "$MODULE_BUILD_DIR/usr/lib/vmware"
+VMCI_CONFED = "yes"
+VSOCK_CONFED = "yes"
+initscriptdir = "/etc/init.d"
+authd.fullpath = "/usr/sbin/vmware-authd"
+bindir = "/usr/bin"
+vmware.fullpath = "/usr/bin/vmware"
+vix.libdir = "/usr/lib/vmware-vix"
+vix.config.version = "1"
+player.product.version = "$VERSION"
+product.buildNumber = "$BUILD_NUMBER"
+authd.client.port = "902"
+authd.proxy.nfc = "vmware-hostd:ha-nfc"
+authd.soapserver = "TRUE"
+product.version = "$VERSION"
+workstation.product.version = "$VERSION"
+product.name = "VMware Workstation"
+EOF
+ mkdir -p "$MODULE_BUILD_DIR/usr/lib/vmware/modules"
+ ln -sf "$MODULE_DIR/$SRCDIR/vmware-vmx/extra/modules.xml" "$MODULE_BUILD_DIR/usr/lib/vmware/modules/"
+ ln -sf "$MODULE_DIR/$SRCDIR/vmware-vmx/lib/modules/source" "$MODULE_BUILD_DIR/usr/lib/vmware/modules/"
+
+ ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig"
+ ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig-console"
+
+ [ ! -e "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" ] && perror "Could not find uts release!!!"
+ local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')"
+ pinfo "Patching vmblock.tar"
+ cd "$MODULE_BUILD_DIR/usr/lib/vmware/modules/source" || perror "cd failed."
+ tar xf "vmblock.tar" || perror "untar of vmblock.tar failed."
+ for sourcefile in $(grep -l -r -E '\sputname' "vmblock-only/"); do
+ sed -r -i 's/\sputname/__putname/g' "$sourcefile" || perror "sed of $sourcefile failed."
+ done
+ tar cf "vmblock.tar" "vmblock-only/" || perror "repacking of vmblock.tar failed."
+ cd -
+
+ pinfo "KOMPILIERE VMWARE KERNEL MODULE"
+ for MOD in vsock vmblock vmmon vmnet vmci; do
+ pinfo "Kompiliere $MOD"
+ [ -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko"
+ "$VMWARE_MODCONFIG" --console --build-mod -k "$UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD"
+ [ ! -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG"
+ done
+
+ cd -
+
+ [ -e /etc/vmware/config ] && rm -f /etc/vmware/config
+ cp /etc/vmware/config.mltk.bak /etc/vmware/config
+
+}
+
+function copy_modules() {
+ local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')"
+ mkdir -p "$TARGET_BUILD_DIR/lib/modules/vmware/"
+ cp "/lib/modules/$UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!"
+}
+