This repository has been archived by the owner on Jan 1, 2021. It is now read-only.
VirtualBox Guest Additions #534
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# TODO add more magic like sshfs share setup here <3 | ||
|
||
# VirtualBox Guest Additions | ||
# - this will bail quickly and gracefully if we're not in VBox | ||
if modprobe vboxguest &> /dev/null && modprobe vboxsf &> /dev/null; then | ||
mountOptions='defaults' | ||
if grep -q '^docker:' /etc/passwd; then | ||
mountOptions="${mountOptions},uid=$(id -u docker),gid=$(id -g docker)" | ||
fi | ||
|
||
# try mounting "$name" (which defaults to "$dir") at "$dir", | ||
# but quietly clean up empty directories if it fails | ||
try_mount_share() { | ||
dir="$1" | ||
name="${2:-$dir}" | ||
|
||
mkdir -p "$dir" 2>/dev/null | ||
if ! mount -t vboxsf -o "$mountOptions" "$name" "$dir" 2>/dev/null; then | ||
rmdir "$dir" 2>/dev/null || true | ||
while [ "$(dirname "$dir")" != "$dir" ]; do | ||
dir="$(dirname "$dir")" | ||
rmdir "$dir" 2>/dev/null || break | ||
done | ||
|
||
return 1 | ||
fi | ||
|
||
return 0 | ||
} | ||
|
||
# bfirsh gets all the credit for this hacky workaround :) | ||
try_mount_share /Users 'Users' \ | ||
|| try_mount_share /Users \ | ||
|| try_mount_share /c/Users 'c/Users' \ | ||
|| try_mount_share /c/Users \ | ||
|| try_mount_share /c/Users 'c:/Users' \ | ||
|| true | ||
# TODO replace this whole hacky bit with VBoxService --only-automount | ||
# (the problem with that being that we can't run VBoxService because the | ||
# 32bit VBoxService won't work with the 64bit kernel modules, but the 64bit | ||
# VBoxService won't work with our 32bit userspace; good times) | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.