Skip to content

Instantly share code, notes, and snippets.

@jaqque
Last active August 29, 2015 14:15
Show Gist options
  • Save jaqque/9f06a5232e2ced39e3ed to your computer and use it in GitHub Desktop.
Save jaqque/9f06a5232e2ced39e3ed to your computer and use it in GitHub Desktop.
diff -ru vmhgfs-only.orig/inode.c vmhgfs-only/inode.c
--- vmhgfs-only.orig/inode.c 2014-11-18 03:07:13.000000000 +0100
+++ vmhgfs-only/inode.c 2014-12-23 22:47:15.783855237 +0100
@@ -1922,7 +1922,7 @@
p,
#endif
&inode->i_dentry,
- d_alias) {
+ d_u.d_alias) {
int dcount = hgfs_d_count(dentry);
if (dcount) {
LOG(4, ("Found %s %d \n", dentry->d_name.name, dcount));
#!/bin/sh
help() {
cat <<EOF
Usage:
$0 [-q|--quiet] </path/to/VMwareTools.tar.gz>
$0 -h|--help
EOF
}
ALERT() {
local pause
printf '%s ' "$*"
read pause
}
TASK() {
[ "$SILENT" ] || printf '%s … ' "$*"
}
OK() {
[ "$SILENT" ] || printf '[\e[32mOK\e[0m]\n'
}
FAILED() {
[ "$SILENT" ] || printf '[\e[31mFAILED\e[0m]\n'
}
if [ -z "$1" ]; then
help
exit 1
fi
case $1 in
-h|--help) help; exit 0 ;;
-q|--quiet) SILENT=yes; shift ;;
-v|--version) printf 'No reportable version\n'; exit 0 ;;
esac
tools="$1"
canary='vmware-tools-distrib/vmware-install.pl'
source='vmware-tools-distrib/lib/modules/source'
driver='vmhgfs'
tarfile="$driver.tar"
tardir="$driver-only"
patchfile='d_alias.patch'
[ -f "$tools" ] || { printf '%s: no such file\n' "$tools"; exit 1; }
# BSD mktemp requires a template
build="$(mktemp -d -t vmtools)" || exit 1
erase_temp() {
[ -d "$build" ] && rm -rf "$build"
}
trap erase_temp exit # clean up after ourselves
TASK Extracting VMware Tools
# even BSD tar is smart enough to uncompress a tarfile without
# being explicitly told
tar -C "$build" -xf "$tools"
[ -f "$build/$canary" ] \
|| { FAILED; help; exit 1; }
OK
## The following three stanzas could be refactored to allow
## multiple drivers to be patched.
## Probably easiest to to unpack all drivers, apply all
## relevant patches, and pack them all up again.
TASK Extracting $driver driver
tar -C "$build/$source" -xf "$build/$source/$tarfile" \
|| { FAILED; exit 1; }
OK
TASK Patching $driver driver
#chmod +w vmhgfs-only/inode.c
patch --quiet -d "$build/$source" -p0 < "$patchfile" \
|| { FAILED; exit 1; }
#chmod -w vmhgfs-only/inode.c
OK
TASK Packing up $driver driver
tar -C "$build/$source" -cf "$build/$source/$tarfile" "$tardir" \
|| { FAILED; exit 1; }
OK
ALERT Press [return] to start VMware Tools installation
sudo "$build/$canary" -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment