Skip to content

Instantly share code, notes, and snippets.

@lbt
Created October 21, 2012 10:53
Show Gist options
  • Save lbt/3926675 to your computer and use it in GitHub Desktop.
Save lbt/3926675 to your computer and use it in GitHub Desktop.
#!/bin/bash
TIMEOUT=10
DEV=eth0
cnt=0
echo waiting for IP
while (( $cnt < $TIMEOUT )); do
IP=$(/sbin/ip -4 addr show dev $DEV scope global | grep "inet" | cut -f6 -d' ' | cut -f1 -d'/' )
[[ $IP ]] && break
sleep 1;
(( cnt++ ))
IP="Unknown"
done
/usr/bin/clear
cat << EOF
Welcome to the Mer SDK. Use "right-ctrl F2" to get a login prompt.
Your VM SDK IP address is: $IP
Note that if you have configured VirtualBox to use NAT for this VM you
should use
ssh -p 2222 root@localhost
Mounting shared folders....
EOF
fail=
if VBoxControl -nologo sharedfolder list | grep ' home$' > /dev/null 2>&1 ; then
mount -tvboxsf -o"rw,exec,uid=1001,gid=1001,dev" home /home/mersdk || fail=1
else
echo 'Failed to mount shared folder "home"'
fail=1
fi
if VBoxControl -nologo sharedfolder list | grep ' targets$' > /dev/null 2>&1 ; then
mount -tvboxsf -o"rw,exec,uid=1001,gid=1001,dev" targets /srv/mer/targets || fail=1
else
echo 'Failed to mount shared folder "targets"'
fail=1
fi
if [[ $fail ]]; then
VBoxControl -nologo sharedfolder list
echo "Please see https://wiki.merproject.org/wiki/Platform_SDK_on_VirtualBox"
echo "for instructions on setting up"
else
echo mounted home and targets succesfully
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment