Last active
February 21, 2016 02:05
-
-
Save LTGIV/d9f34f7a5088d22c0d12 to your computer and use it in GitHub Desktop.
Remount VMWare Host-Guest File System with proper permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "VMware Host-Guest File System Remount" | |
author "Louis T. Getterman IV" | |
# Save this file to /etc/init/vmware-hgfs-remount.conf | |
# chmod 444 /etc/init/vmware-hgfs-remount.conf | |
# Note: Adjust UID and GID arguments below, if needed. | |
start on started vmware-tools | |
stop on stopped vmware-tools | |
post-start script | |
exec sudo /bin/bash -- <<'EOF' | |
while read -r line; do | |
umount -v /mnt/hgfs/$line || /bin/true; | |
mkdir -pv "/mnt/hgfs/$line" | |
mount -t vmhgfs -o defaults,ttl=5,uid=1000,gid=1000 .host:/$line /mnt/hgfs/$line | |
done <<< "`/usr/bin/vmware-hgfsclient`" | |
EOF | |
end script | |
post-stop script | |
exec sudo /bin/bash -- <<'EOF' | |
while read -r line; do | |
umount -v /mnt/hgfs/$line; | |
if [ $? -eq 0 ]; then | |
rmdir "/mnt/hgfs/$line" | |
fi | |
done <<< "`/usr/bin/vmware-hgfsclient`" | |
EOF | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment