summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Auty <ikelos@gentoo.org>2008-11-09 20:57:25 +0000
committerMike Auty <ikelos@gentoo.org>2008-11-09 20:57:25 +0000
commitc676265d4143903f86f452b70debae8df1315453 (patch)
tree5980657e96b28648d3dc1225aab32b12b29643ef /app-emulation/vmware-workstation/files
parentAdd in vmware-workstation 5.5.9 and introduce 6.5.0 for bug 245941. (diff)
downloadgentoo-2-c676265d4143903f86f452b70debae8df1315453.tar.gz
gentoo-2-c676265d4143903f86f452b70debae8df1315453.tar.bz2
gentoo-2-c676265d4143903f86f452b70debae8df1315453.zip
Add in vmware-workstation 5.5.9 and introduce 6.5.0 for bug 245941.
(Portage version: 2.2_rc13/cvs/Linux 2.6.27-gentoo-r1 i686) (Signed Manifest commit)
Diffstat (limited to 'app-emulation/vmware-workstation/files')
-rwxr-xr-xapp-emulation/vmware-workstation/files/helpers/module_patcher.sh8
-rwxr-xr-xapp-emulation/vmware-workstation/files/helpers/unbundler.sh91
-rwxr-xr-xapp-emulation/vmware-workstation/files/helpers/vmware-config.sh29
3 files changed, 128 insertions, 0 deletions
diff --git a/app-emulation/vmware-workstation/files/helpers/module_patcher.sh b/app-emulation/vmware-workstation/files/helpers/module_patcher.sh
new file mode 100755
index 000000000000..03c490a73959
--- /dev/null
+++ b/app-emulation/vmware-workstation/files/helpers/module_patcher.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+MY_BASE=$(basename $1)
+if [ -f ${FILESDIR}/${PV}/${MY_BASE}.patch ];
+then
+ echo -n "Module Patcher: "
+ patch -f -p1 ${1} < ${FILESDIR}/${PV}/${MY_BASE}.patch
+fi
diff --git a/app-emulation/vmware-workstation/files/helpers/unbundler.sh b/app-emulation/vmware-workstation/files/helpers/unbundler.sh
new file mode 100755
index 000000000000..b19b587c2af5
--- /dev/null
+++ b/app-emulation/vmware-workstation/files/helpers/unbundler.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+ORIGFILE="$1"
+
+is_relative() {
+ local path="$1"
+ shift
+
+ [ "${path:0:1}" != "/" ]
+ return
+}
+
+set_offsets() {
+ # This won't work with non-GNU stat.
+ FILE_SIZE=`stat -L --format "%s" "$1"`
+ local offset=$(($FILE_SIZE - 4))
+
+ MAGIC_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ CHECKSUM_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ VERSION_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ PREPAYLOAD_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ PREPAYLOAD_SIZE_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ LAUNCHER_SIZE_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ PAYLOAD_OFFSET=$offset
+ offset=$(($offset - 4))
+
+ PAYLOAD_SIZE_OFFSET=$offset
+ offset=$(($offset - 4))
+}
+
+set_lengths() {
+ local file="$1"
+ if [ ! -s "$file" ]; then
+ echo "$file does not exist"
+ exit 1
+ fi
+
+ # XXX: put extraction in its own function
+ MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`
+
+ if [ "$MAGIC_NUMBER" != "907380241" ]; then
+ echo "magic number does not match"
+ exit 1
+ fi
+
+ LAUNCHER_SIZE=`od -An -t u4 -N 4 -j $LAUNCHER_SIZE_OFFSET "$file" | tr -d ' '`
+ PAYLOAD_SIZE=`od -An -t u4 -N 4 -j $PAYLOAD_SIZE_OFFSET "$file" | tr -d ' '`
+ PREPAYLOAD_SIZE=`od -An -t u4 -N 4 -j $PREPAYLOAD_SIZE_OFFSET "$file" | tr -d ' '`
+
+ SKIP_BYTES=$(($PREPAYLOAD_SIZE + $LAUNCHER_SIZE))
+
+ return 0
+}
+
+if is_relative "${ORIGFILE}"; then
+ ORIGFILE="`pwd`/${ORIGFILE}"
+fi
+
+
+set_offsets ${ORIGFILE}
+set_lengths ${ORIGFILE}
+
+echo "Unbundling" ${ORIGFILE}
+
+PREPAYLOAD="prepayload"
+PAYLOAD="payload"
+
+# Unpack the pre-payload file
+mkdir ${PREPAYLOAD}
+cd ${PREPAYLOAD}
+dd if="${ORIGFILE}" ibs=$LAUNCHER_SIZE obs=1024 skip=1 | tar -xzf - 2> /dev/null
+cd ..
+
+# Unpack the main file
+mkdir ${PAYLOAD}
+cd ${PAYLOAD}
+dd if="${ORIGFILE}" ibs=$SKIP_BYTES obs=1024 skip=1 | tar -xzf - 2> /dev/null
+cd ..
+
diff --git a/app-emulation/vmware-workstation/files/helpers/vmware-config.sh b/app-emulation/vmware-workstation/files/helpers/vmware-config.sh
new file mode 100755
index 000000000000..d97a542d5ec1
--- /dev/null
+++ b/app-emulation/vmware-workstation/files/helpers/vmware-config.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+CONFIG_FILE="${D}/etc/vmware/config"
+
+remove_key() {
+ local key=${1}
+ grep -v "${key} =" ${CONFIG_FILE}
+ grep -v "${key} =" ${CONFIG_FILE} > ${CONFIG_FILE}.tmp
+ mv ${CONFIG_FILE}.tmp ${CONFIG_FILE}
+}
+
+add_key() {
+ local key=${1}
+ local value=${2}
+ echo "${1} = \"${2}\"" >> ${CONFIG_FILE}
+}
+
+mkdir -p $(dirname ${CONFIG_FILE})
+touch ${CONFIG_FILE}
+
+if [ "${1}" == "-s" ]; then
+ remove_key ${2}
+ add_key ${2} ${3/${D}/}
+fi
+
+if [ "${1}" == "-d" ]; then
+ remove_key ${2}
+fi
+