-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_linux.sh
executable file
·69 lines (63 loc) · 3.18 KB
/
start_linux.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Get `openrobertalab_binaries` from git, if one doesn't exist already
cd ../
if [[ ( ${PWD} == ${HOME} && $(find openrobertalab_binaries | wc -l) -eq 0 ) || ( ${PWD} != ${HOME} && $(find -name openrobertalab_binaries | wc -l) -eq 0 ) ]]; then
echo "No current installation of openrobertalab_binaries found. Getting latest binaries..."
curl -sLO https://github.com/OpenRoberta/openroberta-lab/releases/latest/download/openrobertalab_binaries.zip
echo "Done!"
# Unzip the binaries folder, then delete the zip
echo "Unzipping binaries..."
unzip -q openrobertalab_binaries.zip && rm -rf openrobertalab_binaries.zip
echo "Done!"
fi
# Copy `robertalab-tutorial-editor` into `staticResources` directory in the binaries
# and rename it to "tutorialEditor", so that the URL in the application is succint!
if [ $(find openrobertalab_binaries/staticResources/ -name tutorialEditor | wc -l) -eq 0 ]; then
echo "Copying resources..."
cp -r robertalab-tutorial-editor openrobertalab_binaries/staticResources/tutorialEditor
echo "Done!"
fi
ADMIN_DIR="${HOME}/openroberta-tutorial"
BROWSER=""
while true
do
case "$1" in
-a|--admin-dir) ADMIN_DIR=$2
shift; shift
;;
-b|--browser) BROWSER=$2
shift; shift;
;;
-h|--help) echo "Usage:"
echo " ./start_linux.sh [-a | --admin-dir <admin-dir>] [-b | --browser <browser-name>] [-h | --help]"
echo ""
echo "<admin-dir> defaults to '$HOME/openroberta-tutorial'"
echo "If <browser-name> provided is not installed, URLs to access the"
echo "application will be printed to stdout."
echo ""
exit 0
;;
*) break ;;
esac
done
cd openrobertalab_binaries/
case "$BROWSER" in
chrome|google-chrome) if hash google-chrome >/dev/null; then
( sleep 5; google-chrome "http://localhost:1999/tutorialEditor" "http://localhost:1999/") &
else
echo "Google Chrome not installed, but supplied as a parameter. Please use another browser..."
fi
;;
firefox|mozilla-firefox) if hash firefox >/dev/null; then
( sleep 5; firefox "http://localhost:1999/tutorialEditor" "http://localhost:1999/") &
else
echo "Mozilla Firefox not installed, but supplied as a parameter. Please use another browser..."
fi
;;
*) echo "***************************************************************"
echo "Browser name not supplied or not installed. Please navigate to:"
echo " ORLab: http://localhost:1999/"
echo " Tutorial editor: http://localhost:1999/tutorialEditor"
echo "***************************************************************"
;;
esac
/bin/bash admin.sh -admin-dir ${ADMIN_DIR} -q start-server