From d71fd0ff2d85e6b96f2602b05a8ae6b0a4bff47f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Mon, 9 Jan 2017 20:39:48 -0300
Subject: [PATCH 1/6] Add pm2 configuration for manager MagicMirror in script
installer
---
CHANGELOG.md | 1 +
installers/mm.sh | 2 ++
installers/pm2_MagicMirror.json | 7 +++++++
installers/raspberry.sh | 6 ++++++
4 files changed, 16 insertions(+)
create mode 100755 installers/mm.sh
create mode 100644 installers/pm2_MagicMirror.json
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6408d1d2..8f6205eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Add loaded function to modules, providing an async callback.
+- Add use pm2 for manager process into Installer RaspberryPi script
## [2.1.0] - 2016-12-31
diff --git a/installers/mm.sh b/installers/mm.sh
new file mode 100755
index 00000000..cc6c4bb3
--- /dev/null
+++ b/installers/mm.sh
@@ -0,0 +1,2 @@
+cd ~/MagicMirror
+DISPLAY=:0 npm start
diff --git a/installers/pm2_MagicMirror.json b/installers/pm2_MagicMirror.json
new file mode 100644
index 00000000..55f8df31
--- /dev/null
+++ b/installers/pm2_MagicMirror.json
@@ -0,0 +1,7 @@
+{
+ apps : [{
+ name : "MagicMirror",
+ script : "/home/pi/MagicMirror/installer/mm.sh",
+ watch : ["/home/pi/MagicMirror/config/config.js"]
+ }]
+}
diff --git a/installers/raspberry.sh b/installers/raspberry.sh
index cd995a1e..df3994bc 100644
--- a/installers/raspberry.sh
+++ b/installers/raspberry.sh
@@ -141,6 +141,12 @@ else
echo -e "\e[93mplymouth is not installed.\e[0m";
fi
+# Use pm2 control like a service MagicMirror
+sudo npm install -g pm2
+sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
+pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
+pm2 save
+
echo " "
echo -e "\e[92mWe're ready! Run \e[1m\e[97mDISPLAY=:0 npm start\e[0m\e[92m from the ~/MagicMirror directory to start your MagicMirror.\e[0m"
echo " "
From 4bb3d33907816b139e4fc4a3a174c17d12ea275d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Wed, 11 Jan 2017 10:22:13 -0300
Subject: [PATCH 2/6] add choice to use pm2 for auto starting of MagicMirror
---
installers/raspberry.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/installers/raspberry.sh b/installers/raspberry.sh
index df3994bc..b6ab3435 100644
--- a/installers/raspberry.sh
+++ b/installers/raspberry.sh
@@ -142,10 +142,14 @@ else
fi
# Use pm2 control like a service MagicMirror
-sudo npm install -g pm2
-sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
-pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
-pm2 save
+read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice
+if [[ $choice =~ ^[Yy]$ ]]
+then
+ sudo npm install -g pm2
+ sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
+ pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
+ pm2 save
+fi
echo " "
echo -e "\e[92mWe're ready! Run \e[1m\e[97mDISPLAY=:0 npm start\e[0m\e[92m from the ~/MagicMirror directory to start your MagicMirror.\e[0m"
From 6d1b0ae498f38e9efee66a32db935ca7f01f3695 Mon Sep 17 00:00:00 2001
From: Greg Dev
Date: Thu, 12 Jan 2017 01:33:13 +0100
Subject: [PATCH 3/6] Add Polish translation for UPDATE_INFO
---
translations/pl.json | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/translations/pl.json b/translations/pl.json
index 7a47745b..06bf3b5c 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -24,10 +24,10 @@
"W": "W",
"WNW": "WNW",
"NW": "NW",
- "NNW": "NNW"
-
+ "NNW": "NNW",
+
/* UPDATE INFO */
"UPDATE_NOTIFICATION": "Dostępna jest aktualizacja MagicMirror².",
"UPDATE_NOTIFICATION_MODULE": "Dostępna jest aktualizacja modułu MODULE_NAME.",
- "UPDATE_INFO": "The current installation is COMMIT_COUNT behind on the BRANCH_NAME branch."
+ "UPDATE_INFO": "Zainstalowana wersja odbiega o COMMIT_COUNT commitów od gałęzi BRANCH_NAME."
}
From 3cea6e5d0cea7b4e927e7182c29d0b0b1b1f01f3 Mon Sep 17 00:00:00 2001
From: Alex Barcelo
Date: Thu, 12 Jan 2017 09:58:02 +0100
Subject: [PATCH 4/6] Add apt-get update in raspberry.sh script
Just tried this script and realized that it is likely that it will fail because the apt index is not up to date.
The trivial fix seems to be to add an `apt-get update` before the package installation. It should be harmless also.
---
installers/raspberry.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/installers/raspberry.sh b/installers/raspberry.sh
index b970d02e..e91c2850 100644
--- a/installers/raspberry.sh
+++ b/installers/raspberry.sh
@@ -36,6 +36,10 @@ fi
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function command_exists () { type "$1" &> /dev/null ;}
+# Update before first apt-get
+echo -e "\e[96mUpdating packages ...\e[90m"
+sudo apt-get update || exit
+
# Installing helper tools
echo -e "\e[96mInstalling helper tools ...\e[90m"
sudo apt-get install curl wget git build-essential unzip || exit
From af85ef8cfbd2aaf99556302e5834500b6bacb997 Mon Sep 17 00:00:00 2001
From: Alex Barcelo
Date: Thu, 12 Jan 2017 17:15:58 +0100
Subject: [PATCH 5/6] removing unnecessary exit, leaving a warning
---
installers/raspberry.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/installers/raspberry.sh b/installers/raspberry.sh
index e91c2850..3ba16795 100644
--- a/installers/raspberry.sh
+++ b/installers/raspberry.sh
@@ -38,7 +38,7 @@ function command_exists () { type "$1" &> /dev/null ;}
# Update before first apt-get
echo -e "\e[96mUpdating packages ...\e[90m"
-sudo apt-get update || exit
+sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation ...\e[90m"
# Installing helper tools
echo -e "\e[96mInstalling helper tools ...\e[90m"
From ab9e0f891ab035904c733b7085a30fa9f7b71ba2 Mon Sep 17 00:00:00 2001
From: Alex Barcelo
Date: Thu, 12 Jan 2017 17:25:33 +0100
Subject: [PATCH 6/6] updating CHANGELOG
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b061f6f..aead7517 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Update .gitignore to not ignore default modules folder.
- Remove white flash on boot up.
+- Added `update` in Raspberry Pi installation script.
## [2.1.0] - 2016-12-31