mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
add apt get upgrade to actually upgrade files, as OS repos are lagging
This commit is contained in:
parent
22a3448461
commit
153d1853fa
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This is an installer script for MagicMirror2. It works well enough
|
# This is an installer script for MagicMirror2. It works well enough
|
||||||
# that it can detect if you have Node installed, run a binary script
|
# that it can detect if you have Node installed, run a binary script
|
||||||
@ -93,6 +92,7 @@ function verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 ;}
|
|||||||
# Update before first apt-get
|
# Update before first apt-get
|
||||||
if [ $mac != 'Darwin' ]; then
|
if [ $mac != 'Darwin' ]; then
|
||||||
echo -e "\e[96mUpdating packages ...\e[90m" | tee -a $logfile
|
echo -e "\e[96mUpdating packages ...\e[90m" | tee -a $logfile
|
||||||
|
upgrade=$false
|
||||||
update=$(sudo apt-get update 2>&1)
|
update=$(sudo apt-get update 2>&1)
|
||||||
echo $update >> $logfile
|
echo $update >> $logfile
|
||||||
update_rc=$?
|
update_rc=$?
|
||||||
@ -100,18 +100,25 @@ if [ $mac != 'Darwin' ]; then
|
|||||||
echo -e "\e[91mUpdate failed, retrying installation ...\e[90m" | tee -a $logfile
|
echo -e "\e[91mUpdate failed, retrying installation ...\e[90m" | tee -a $logfile
|
||||||
if [ $(echo $update | grep "apt-secure" | wc -l) -eq 1 ]; then
|
if [ $(echo $update | grep "apt-secure" | wc -l) -eq 1 ]; then
|
||||||
update=$(sudo apt-get update --allow-releaseinfo-change 2>&1)
|
update=$(sudo apt-get update --allow-releaseinfo-change 2>&1)
|
||||||
echo $update >> $logfile
|
|
||||||
update_rc=$?
|
update_rc=$?
|
||||||
|
echo $update >> $logfile
|
||||||
if [ $update_rc -ne 0 ]; then
|
if [ $update_rc -ne 0 ]; then
|
||||||
echo "second apt-get update failed" $update | ree -a $logfile
|
echo "second apt-get update failed" $update | tee -a $logfile
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "second apt-get update completed ok" >> $logfile
|
echo "second apt-get update completed ok" >> $logfile
|
||||||
|
upgrade=$true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "apt-get update completed ok" >> $logfile
|
echo "apt-get update completed ok" >> $logfile
|
||||||
|
upgrade=$true
|
||||||
fi
|
fi
|
||||||
|
if [ $upgrade -eq $true ]; then
|
||||||
|
upgrade_result=$(sudo apt-get upgrade 2>&1)
|
||||||
|
upgrade_rc=$?
|
||||||
|
echo apt upgrade result ="rc=$upgrade_rc $upgrade_result" >> $logfile
|
||||||
|
fi
|
||||||
|
|
||||||
# Installing helper tools
|
# Installing helper tools
|
||||||
echo -e "\e[96mInstalling helper tools ...\e[90m" | tee -a $logfile
|
echo -e "\e[96mInstalling helper tools ...\e[90m" | tee -a $logfile
|
||||||
@ -379,18 +386,19 @@ if [[ $choice =~ ^[Yy]$ ]]; then
|
|||||||
echo pm2 startup command done >>$logfile
|
echo pm2 startup command done >>$logfile
|
||||||
# is this is mac
|
# is this is mac
|
||||||
# need to fix pm2 startup, only on catalina
|
# need to fix pm2 startup, only on catalina
|
||||||
if [ $mac == 'Darwin' -a $(sw_vers -productVersion | head -c 6) == '10.15.' ]; then
|
if [ $mac == 'Darwin' ];then
|
||||||
# only do if the faulty tag is present (pm2 may fix this, before the script is fixed)
|
if [ $(sw_vers -productVersion | head -c 6) == '10.15.' ]; then
|
||||||
if [ $(grep -m 1 UserName /Users/$USER/Library/LaunchAgents/pm2.$USER.plist | wc -l) -eq 1 ]; then
|
# only do if the faulty tag is present (pm2 may fix this, before the script is fixed)
|
||||||
# copy the pm2 startup file config
|
if [ $(grep -m 1 UserName /Users/$USER/Library/LaunchAgents/pm2.$USER.plist | wc -l) -eq 1 ]; then
|
||||||
cp /Users/$USER/Library/LaunchAgents/pm2.$USER.plist .
|
# copy the pm2 startup file config
|
||||||
# edit out the UserName key/value strings
|
cp /Users/$USER/Library/LaunchAgents/pm2.$USER.plist .
|
||||||
sed -e '/UserName/{N;d;}' pm2.$USER.plist > pm2.$USER.plist.new
|
# edit out the UserName key/value strings
|
||||||
# copy the file back
|
sed -e '/UserName/{N;d;}' pm2.$USER.plist > pm2.$USER.plist.new
|
||||||
sudo cp pm2.$USER.plist.new /Users/$USER/Library/LaunchAgents/pm2.$USER.plist
|
# copy the file back
|
||||||
fi
|
sudo cp pm2.$USER.plist.new /Users/$USER/Library/LaunchAgents/pm2.$USER.plist
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# if the user is no pi, we have to fixup the pm2 json file
|
# if the user is no pi, we have to fixup the pm2 json file
|
||||||
echo configure the pm2 config file for MagicMirror >>$logfile
|
echo configure the pm2 config file for MagicMirror >>$logfile
|
||||||
if [ "$USER" != "pi" ]; then
|
if [ "$USER" != "pi" ]; then
|
||||||
@ -551,4 +559,4 @@ echo -e "\e[92mWe're ready! Run \e[1m\e[97m$rmessage\e[0m\e[92m from the ~/Magic
|
|||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
date +"install completed - %a %b %e %H:%M:%S %Z %Y" >>$logfile
|
date +"install completed - %a %b %e %H:%M:%S %Z %Y" >>$logfile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user