add script for mounting VirtualBox shared folders
This commit is contained in:
parent
6be0568703
commit
f56d7756a0
1 changed files with 33 additions and 0 deletions
33
dotfiles/.local/bin/vboxmount
Executable file
33
dotfiles/.local/bin/vboxmount
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
scriptname=`basename "$0"`
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $scriptname SHARE [...]"
|
||||||
|
echo ""
|
||||||
|
echo " Mount the SHARE VirtualBox shared folder(s) into /mnt/SHARE."
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " SHARE the name of the shared folder(s) configured for this virtual machine."
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_share() {
|
||||||
|
share="$1"
|
||||||
|
sudo mkdir "/mnt/$share"
|
||||||
|
sudo chmod 777 "/mnt/$share"
|
||||||
|
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) "$share" "/mnt/$share"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for share in "$@"; do
|
||||||
|
mount_share "$share"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
Loading…
Add table
Reference in a new issue