forked from bafu/hack-ubiquity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug-init
executable file
·46 lines (39 loc) · 839 Bytes
/
debug-init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
USERNAME="u"
IP=10.101.46.252
#USERNAME="ubuntu"
#IP=192.168.56.102
MOUNTPOINT="$PWD/mnt"
usage() {
echo "USAGE: debug-init mount [target IP]"
echo "USAGE: debug-init umount"
echo "USAGE: debug-init ssh [target IP]"
exit 1
}
main() {
# TODO: need to be executed with sudo
if [ ! -e $MOUNTPOINT ]; then
echo "ERROR: $MOUNTPOINT does not exist."
exit 2
fi
if [ "$2" != "" ]; then
IP=$2
fi
echo "Target IP: $IP"
case $1 in
mount)
sshfs $USERNAME@$IP:/ "$MOUNTPOINT"
#sshfs ubuntu@$IP:/ "$MOUNTPOINT" -o allow_other
;;
umount)
sudo umount "$MOUNTPOINT"
;;
ssh)
ssh $USERNAME@$IP
;;
*)
usage
;;
esac
}
main $1 $2