mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
Update start methods.
This commit is contained in:
parent
3bb801f579
commit
09c1ea992c
@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Updated config.js.sample: Corrected some grammar on `config.js.sample` comment section.
|
- Updated config.js.sample: Corrected some grammar on `config.js.sample` comment section.
|
||||||
|
- Remove `run-start.sh` script and update start commands:
|
||||||
|
- To start using electron, use `npm run start`.
|
||||||
|
- To start in server only mode, use `npm run server`.
|
||||||
|
|
||||||
## [2.11.0] - Unreleased (Develop Branch)
|
## [2.11.0] - Unreleased (Develop Branch)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
* By Michael Teeuw http://michaelteeuw.nl
|
* By Michael Teeuw http://michaelteeuw.nl
|
||||||
* MIT Licensed.
|
* MIT Licensed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var Server = require(__dirname + "/server.js");
|
var Server = require(__dirname + "/server.js");
|
||||||
var Utils = require(__dirname + "/utils.js");
|
var Utils = require(__dirname + "/utils.js");
|
||||||
@ -24,6 +23,11 @@ console.log("Starting MagicMirror: v" + global.version);
|
|||||||
// global absolute root path
|
// global absolute root path
|
||||||
global.root_path = path.resolve(__dirname + "/../");
|
global.root_path = path.resolve(__dirname + "/../");
|
||||||
|
|
||||||
|
if (!process.env.DISPLAY) {
|
||||||
|
console.log("DISPLAY environment variable not set. Using DISPLAY=:0");
|
||||||
|
process.env.DISPLAY = ":0";
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.MM_CONFIG_FILE) {
|
if (process.env.MM_CONFIG_FILE) {
|
||||||
global.configuration_file = process.env.MM_CONFIG_FILE;
|
global.configuration_file = process.env.MM_CONFIG_FILE;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
"description": "The open source modular smart mirror platform.",
|
"description": "The open source modular smart mirror platform.",
|
||||||
"main": "js/electron.js",
|
"main": "js/electron.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "./run-start.sh",
|
"start": "./node_modules/.bin/electron js/electron.js",
|
||||||
|
"server": "node ./serveronly",
|
||||||
"install": "cd vendor && npm install",
|
"install": "cd vendor && npm install",
|
||||||
"install-fonts": "cd fonts && npm install",
|
"install-fonts": "cd fonts && npm install",
|
||||||
"postinstall": "sh untrack-css.sh && sh installers/postinstall/postinstall.sh && npm run install-fonts",
|
"postinstall": "sh untrack-css.sh && sh installers/postinstall/postinstall.sh && npm run install-fonts",
|
||||||
|
75
run-start.sh
75
run-start.sh
@ -1,75 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# use bash instead of sh
|
|
||||||
./untrack-css.sh
|
|
||||||
|
|
||||||
if grep docker /proc/1/cgroup -qa; then
|
|
||||||
# if running in docker, only start electron
|
|
||||||
|
|
||||||
electron js/electron.js $1;
|
|
||||||
else
|
|
||||||
# not running in docker
|
|
||||||
|
|
||||||
if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
|
|
||||||
export DISPLAY=:0 # Set by default display
|
|
||||||
fi
|
|
||||||
# get the processor architecture
|
|
||||||
arch=$(uname -m)
|
|
||||||
false='false'
|
|
||||||
|
|
||||||
# get the config option, if any
|
|
||||||
# only check non comment lines
|
|
||||||
serveronly=$(grep -v '^\s//' config/config.js | grep -i serveronly: | awk '{print tolower($2)}' | tr -d ,\"\')
|
|
||||||
# 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)
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
# Read the output of server line by line until one line 'point your browser'
|
|
||||||
while read line; do
|
|
||||||
case "$line" in
|
|
||||||
*point\ your\ browser*)
|
|
||||||
echo $line
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $line
|
|
||||||
#sleep .25
|
|
||||||
;;
|
|
||||||
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
|
|
@ -1,11 +0,0 @@
|
|||||||
# Long history here
|
|
||||||
# https://github.com/MichMich/MagicMirror/pull/1540
|
|
||||||
STATUS_CUSTOM_CSS=$(git ls-files -v css/custom.css| awk '{print $1}')
|
|
||||||
|
|
||||||
if [ "$STATUS_CUSTOM_CSS" = "H" ]; then
|
|
||||||
echo "We'll remove from the repository the css/custom.css"
|
|
||||||
echo "This script apply git update-index --skip-worktree css/custom.css"
|
|
||||||
git update-index --skip-worktree css/custom.css
|
|
||||||
git rm --cached css/custom.css
|
|
||||||
fi
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user