-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.sh
executable file
·62 lines (49 loc) · 2.18 KB
/
launch.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
SERIAL_WEBSOCKET_CMD="cd $PWD/../serial-websocket && npm run start"
BUILD_CONTROLLER_CMD="cd $PWD && npm run build"
SERVE_CONTROLLER_CMD="cd $PWD && python3 -m http.server"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
for terminal in "$TERMINAL" x-terminal-emulator mate-terminal gnome-terminal terminator xfce4-terminal urxvt rxvt termit Eterm aterm uxterm xterm roxterm termite lxterminal terminology st qterminal lilyterm tilix terminix konsole kitty guake tilda alacritty hyper wezterm rio; do
if command -v "$terminal" > /dev/null 2>&1; then
exec "$terminal" "$SERIAL_WEBSOCKET_CMD"
exec "$terminal" "$SERVE_CONTROLLER_CMD"
if [[ $1 == "dev" ]] ; then
exec "$terminal" "$BUILD_CONTROLLER_CMD"
fi
chromium --kiosk http://localhost:8000
fi
done
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
# Start serial-websocket
osascript -e "tell app \"Terminal\" to do script \"$SERIAL_WEBSOCKET_CMD\""
# Launch a server to serve tipibot-controller-gui on localhost:8000
osascript -e "tell app \"Terminal\" to do script \"$SERVE_CONTROLLER_CMD\""
# Build tipibot-controller-gui if in dev mode
if [[ $1 == "dev" ]] ; then
osascript -e "tell app \"Terminal\" to do script \"$BUILD_CONTROLLER_CMD\""
# Open chromium windows @ localhost:8000
chromium --kiosk http://localhost:8000
else
open -n -a "Firefox" --args "localhost:8000"
fi
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
echo $OSTYPE
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
GIT_BASH=C:\Program Files\Git\git-bash.exe
$GIT_BASH $SERIAL_WEBSOCKET_CMD
if [[ $1 == "dev" ]] ; then
$GIT_BASH $BUILD_CONTROLLER_CMD
break
fi
$GIT_BASH $SERVE_CONTROLLER_CMD
chromium --kiosk http://localhost:8000
echo $OSTYPE
elif [[ "$OSTYPE" == "win32" ]]; then
echo $OSTYPE
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo $OSTYPE
else
echo $OSTYPE
fi