Fixing raspbian installer

* fixing issue #1377
* fixing problem with old node installation from fresh raspbian
* add feature for disable screen saver
This commit is contained in:
fdahms
2019-01-12 18:11:48 +01:00
parent 8f24cc8d13
commit f87adebe41

View File

@@ -47,7 +47,7 @@ sudo apt-get --assume-yes install curl wget git build-essential unzip || exit
# Check if we need to install or upgrade Node.js. # Check if we need to install or upgrade Node.js.
echo -e "\e[96mCheck current Node installation ...\e[0m" echo -e "\e[96mCheck current Node installation ...\e[0m"
NODE_INSTALL=false NODE_INSTALL=false
if command_exists node; then if command_exists node && command_exists npm; then
echo -e "\e[0mNode currently installed. Checking version number."; echo -e "\e[0mNode currently installed. Checking version number.";
NODE_CURRENT=$(node -v) NODE_CURRENT=$(node -v)
echo -e "\e[0mMinimum Node version: \e[1m$NODE_TESTED\e[0m" echo -e "\e[0mMinimum Node version: \e[1m$NODE_TESTED\e[0m"
@@ -152,9 +152,19 @@ fi
read -p "Do you want use pm2 for auto starting of your MagicMirror (y/N)?" choice read -p "Do you want use pm2 for auto starting of your MagicMirror (y/N)?" choice
if [[ $choice =~ ^[Yy]$ ]]; then if [[ $choice =~ ^[Yy]$ ]]; then
sudo npm install -g pm2 sudo npm install -g pm2
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi" if [[ "$(ps --no-headers -o comm 1)" =~ systemd ]]; then #Checking for systemd
pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json sudo pm2 startup systemd -u pi --hp /home/pi
pm2 save else
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
fi
pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
pm2 save
fi
# Disable Screensaver
read -p "Do you want to disable the screen saver? (y/N)?" choice
if [[ $choice =~ ^[Yy]$ ]]; then
su -c "echo -e '@xset s noblank\n@xset s off\n@xset -dpms' >> /etc/xdg/lxsession/LXDE-pi/autostart"
export DISPLAY=:0; xset s noblank;xset s off;xset -dpms
fi fi
echo " " echo " "