-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.sh
executable file
·40 lines (36 loc) · 1.26 KB
/
container.sh
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
#!/bin/bash -e
GITDIR=$(pwd)
if [ -d "../eclipseconfig" ]; then
# use persistent workspace in ../ if explicitly created there
WORKSPACE=$(cd .. && pwd)
else
WORKSPACE=/tmp/sara
fi
case "$1" in
-*|"") ;;
*) WORKSPACE=$(cd "$1" && pwd); shift ;; # always allow workspace to be overridden
esac
containerize() {
mkdir -p $WORKSPACE
udocker run --user=$(whoami) --hostauth --hostenv -w "$WORKSPACE" -v "$WORKSPACE" -v "$GITDIR" sara "$@"
echo -e "\e[1;34mCONTAINER STOPPED\e[0m"
}
eclipse() {
echo -e '\e[32m'
echo "===================================================="
echo -en '\e[1m'
echo "IF THIS IS YOUR INITAL RUN, PLEASE DO THE FOLLOWING:"
echo -e '\e[0;32m'
echo " 1) Import the SARA code as 'Existing Maven Project'"
echo " 2) Open a terminal (Ctrl-Shift-Alt-T) and run:"
echo " $GITDIR/saradb/initdb.sh";
echo " 3) Open 'bwfdm.sara.Application' and right-click 'Run' -> 'Java Application'"
echo " 4) Wait for Spring to start, connect to 'http://localhost:8080'"
echo " 5) Congrats ... you're done!"
echo -e '\e[0m'
containerize /opt/eclipse/eclipse -configuration "$WORKSPACE/eclipseconfig" -data "$WORKSPACE" "$@"
}
case "$1" in
-*|"") eclipse "$@" ;; # no command, maybe optional args
*) containerize "$@" ;; # explicit command, execute that instead
esac