forked from AchimPieters/MagicZeroMirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMMZeroInstallScript.sh
85 lines (73 loc) · 3.2 KB
/
MMZeroInstallScript.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
#
# Copyright 2020 Achim Pieters | StudioPieters®
#
# More information on https://Studiopieters.nl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NO NINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
echo 'Downloading MagicMirror Raspberry Pi Zero W installation files'
git clone --recursive https://github.com/AchimPieters/MagicZeroMirror.git
echo 'Updating Pi'
sudo apt-get update;
echo 'Upgrading Pi'
sudo apt-get upgrade;
sudo apt-get upgrade --fix-missing;
echo 'Downloading node v10.16.0'
sudo wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz;
echo 'Extracting node v11.6.0'
tar xvf node-v10.16.0-linux-armv6l.tar.xz;
cd node-v10.16.0-linux-armv6l;
sudo cp -R * /usr/local/;
echo 'Installing Magic Mirror Dependencies'
cd ~;
sudo apt install npm -y;
sudo apt install git;
echo 'Cloning the latest version of Magic Mirror2'
git clone https://github.com/MichMich/MagicMirror;
echo 'Installing Magic Mirror Dependencies'
cd MagicMirror;
npm install --arch=armv7l;
sudo apt install chromium-browser -y;
sudo apt-get install xinit -y;
sudo apt install xorg -y;
sudo apt install matchbox -y;
sudo apt install unclutter -y;
echo 'Loading default config'
cp config/config.js.sample config/config.js;
echo 'Set the splash screen to be magic mirror'
THEME_DIR="/usr/share/plymouth/themes"
sudo mkdir $THEME_DIR/MagicMirror;
sudo cp ~/MagicMirror/splashscreen/splash.png $THEME_DIR/MagicMirror/splash.png && sudo cp ~/MagicMirror/splashscreen/MagicMirror.plymouth $THEME_DIR/MagicMirror/MagicMirror.plymouth && sudo cp ~/MagicMirror/splashscreen/MagicMirror.script $THEME_DIR/MagicMirror/MagicMirror.script;
sudo plymouth-set-default-theme -R MagicMirror;
echo 'Copy Magic Mirror2 startup scripts'
cd ~;
sudo mv ~/MagicZeroMirror/mmstart.sh ~/mmstart.sh;
sudo mv ~/MagicZeroMirror/chromium_start.sh ~/chromium_start.sh;
sudo mv ~/MagicZeroMirror/pm2_MagicMirror.json ~/pm2_MagicMirror.json;
sudo chmod a+x mmstart.sh;
sudo chmod a+x chromium_start.sh;
sudo chmod a+x pm2_MagicMirror.json;
echo 'Use pm2 control like a service MagicMirror'
cd ~;
sudo npm install -g pm2;
pm2 startup;
sudo env PATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi;
pm2 start pm2_MagicMirror.json;
pm2 save;
echo 'Magic Mirror should begin shortly'