forked from kgyrtkirk/hive-dev-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hdb
executable file
·34 lines (32 loc) · 794 Bytes
/
hdb
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
#!/bin/bash -e
# go home...
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
cmd=$1
[ "$cmd" != "" ] && shift
case "$cmd" in
enter)
./enter.bash "$@"
;;
run)
./run.bash -d "$@"
./enter.bash "$@"
;;
run0)
./run.bash "$@"
;;
bash_completion)
cat bashrc
;;
*)
echo "usage: $0 run <new_container_name>"
echo "usage: $0 enter <existing_container_name>"
exit 1
;;
esac