fix run-start.sh: if running in docker-container, just start electron, see #1859

This commit is contained in:
Karsten Hassel 2020-01-03 19:12:02 +01:00
parent 69a887fb05
commit 20a9150ea3
2 changed files with 67 additions and 58 deletions

View File

@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- Force declaration of public ip adress in config file (ISSUE #1852) - Force declaration of public ip adress in config file (ISSUE #1852)
- Fixes `run-start.sh`: If running in docker-container, don't check the environment, just start electron (ISSUE #1859)
### Updated ### Updated

View File

@ -2,66 +2,74 @@
# use bash instead of sh # use bash instead of sh
./untrack-css.sh ./untrack-css.sh
if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty if grep docker /proc/1/cgroup -qa; then
export DISPLAY=:0 # Set by default display # if running in docker, only start electron
fi
# get the processor architecture
arch=$(uname -m)
false='false'
# get the config option, if any electron js/electron.js $1;
# only check non comment lines else
serveronly=$(grep -v '^\s//' config/config.js | grep -i serveronly: | awk '{print tolower($2)}' | tr -d ,\"\') # not running in docker
# set default if not defined in config
serveronly=${serveronly:-false}
# check for xwindows running
xorg=$(pgrep Xorg)
#check for macOS
mac=$(uname)
#
# if the user requested serveronly OR
# electron support for armv6l has been dropped OR
# system is in text mode
#
if [ "$serveronly." != "false." -o "$arch" == "armv6l" ] || [ "$xorg." == "." -a $mac != 'Darwin' ]; then
# if user explicitly configured to run server only (no ui local) if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
# OR there is no xwindows running, so no support for browser graphics export DISPLAY=:0 # Set by default display
if [ "$serveronly." == "true." -o "$xorg." == "." ]; then fi
# start server mode, # get the processor architecture
node serveronly arch=$(uname -m)
else false='false'
# start the server in the background
# wait for server to be ready
# need bash for this
exec 3< <(node serveronly)
# Read the output of server line by line until one line 'point your browser' # get the config option, if any
while read line; do # only check non comment lines
case "$line" in serveronly=$(grep -v '^\s//' config/config.js | grep -i serveronly: | awk '{print tolower($2)}' | tr -d ,\"\')
*point\ your\ browser*) # set default if not defined in config
echo $line serveronly=${serveronly:-false}
break # check for xwindows running
;; xorg=$(pgrep Xorg)
*) #check for macOS
echo $line mac=$(uname)
#sleep .25 #
;; # if the user requested serveronly OR
esac # electron support for armv6l has been dropped OR
done <&3 # system is in text mode
#
if [ "$serveronly." != "false." -o "$arch" == "armv6l" ] || [ "$xorg." == "." -a $mac != 'Darwin' ]; then
# Close the file descriptor # if user explicitly configured to run server only (no ui local)
exec 3<&- # OR there is no xwindows running, so no support for browser graphics
if [ "$serveronly." == "true." -o "$xorg." == "." ]; then
# start server mode,
node serveronly
else
# start the server in the background
# wait for server to be ready
# need bash for this
exec 3< <(node serveronly)
# lets use chrome to display here now # Read the output of server line by line until one line 'point your browser'
# get the server port address from the ready message while read line; do
port=$(echo $line | awk -F\: '{print $4}') case "$line" in
# start chromium *point\ your\ browser*)
echo "Starting chromium browser now, have patience, it takes a minute" echo $line
chromium-browser -noerrdialogs -kiosk -start_maximized --disable-infobars --app=http://localhost:$port --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null break
exit ;;
fi *)
else echo $line
# we can use electron directly #sleep .25
electron js/electron.js $1; ;;
fi esac
done <&3
# Close the file descriptor
exec 3<&-
# lets use chrome to display here now
# get the server port address from the ready message
port=$(echo $line | awk -F\: '{print $4}')
# start chromium
echo "Starting chromium browser now, have patience, it takes a minute"
chromium-browser -noerrdialogs -kiosk -start_maximized --disable-infobars --app=http://localhost:$port --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null
exit
fi
else
# we can use electron directly
electron js/electron.js $1;
fi
fi