Hi there! Manual “backup” of the config, CSS and compliments files when I change them (just copying it to my server). Then when reinstalling, I’m using a script (that I can wget down to the new install) containing all modules to reinstall and it copy back the config, CSS and compliments from the backup location… :)
See script below…
#!/bin/bash
## ----------------------------------------------------------------------------
## Snilles automatic module clone and install script for MM2.
## ----------------------------------------------------------------------------
## Don't forget to add your public SSH key to your GIT profile!
## If you don't, nothing will be cloned!
## If you don't have an SSH key. This is how you get one.
## Generate SSH key(s).
# cd ~
# ssh-keygen -t rsa
## Press: Enter, Enter, Enter...
## See the public Key...
# cat /home/pi/.ssh/id_rsa.pub
## Copy the SSH public key and add it to your GIT SSH keys on GitHUB.
## ----------------------------------------------------------------------------
## Config below.
## ----------------------------------------------------------------------------
# System to install (what config to use).
## Housesystems Server Install
Toinstall='house'
## NUC install (On the actual Mirror, this is not used anymore)
#Toinstall='NUC'
# Real Name of the config file.
ConfigName='config.js'
## The Install Folder.
## Local install.
## On NUC
#User='/home/snille'
## On Raspberry Pi
#User='/home/pi'
## Install om Homesystems Server.
User='/var/www/html/magicmirror'
## The module install directory.
Moddir=$User'/MagicMirror/modules'
## Configuration and other files backup location (from previous installation).
DownloadFrom='https://yoursite.com/mmbackup/'
## Configuration file.
Files[1]='config-'$Toinstall'.js'
## Where to put the Configuration file.
Dirs[1]=$User'/MagicMirror/config/'
## Custom CSS file.
Files[2]='custom.css'
## Where to put the CSS file.
Dirs[2]=$User'/MagicMirror/css/'
## Custom screen on/off scripts.
Files[3]='screen.sh'
## Where to put the screen script files.
Dirs[3]=$User'/'
## Not used moved to "screen.sh"
#Files[4]='turnoffscreen.sh'
#Dirs[4]=$User'/'
#Files[5]='turnonscreen.sh'
#Dirs[5]=$User'/'
## Custom Magic Mirror update script.
Files[6]='update.sh'
## Where to put the update script file.
Dirs[6]=$User'/'
## Custom compliment files.
Files[7]='compliments-Snille.json'
## Where to put the compliment file.
Dirs[7]=$User'/MagicMirror/modules/default/compliments/'
Files[8]='compliments-Camilla.json'
Dirs[8]=$User'/MagicMirror/modules/default/compliments/'
Files[9]='compliments-Louise.json'
Dirs[9]=$User'/MagicMirror/modules/default/compliments/'
#Files[10]='compliments-Martin.json'
#Dirs[10]=$User'/MagicMirror/modules/default/compliments/'
# Start file for the MagigMirror
Files[11]='MacigMirror.sh'
Dirs[11]=$User'/'
## Package file
Packfile='package.json'
## All the modules repos from Git.
Repos[1]='git@github.com:Snille/MMM-HideAll.git'
Repos[2]='git@github.com:matteodanelli/MMM-cryptocurrency.git'
Repos[3]='git@github.com:basknol/MMM-Globe.git'
Repos[4]='git@github.com:Snille/MMM-Modulebar.git'
Repos[5]='git@github.com:Snille/MMM-ModuleScheduler.git'
Repos[6]='git@github.com:CatoAntonsen/MMM-MotionEye.git'
Repos[7]='git@github.com:Gyran/MMM-plex-recently-added.git'
Repos[8]='git@github.com:Snille/MMM-Profilepicture.git'
Repos[9]='git@github.com:tosti007/MMM-ProfileSwitcher.git'
Repos[10]='git@github.com:Jopyth/MMM-Remote-Control.git'
Repos[11]='git@github.com:Snille/MMM-Sonos.git'
Repos[12]='git@github.com:brobergp/MMM-TextClock.git'
Repos[13]='git@github.com:tosti007/MMM-TouchNavigation.git'
Repos[14]='git@github.com:bugsounet/MMM-Tools.git'
Repos[15]='git@github.com:timdows/MMM-JsonTable.git'
Repos[16]='git@github.com:derekn/MMM-TautulliActivity.git'
#Repos[17]='git@github.com:Snille/MMM-IFTTT.git' # For development of the IFTTT module, the one below is used.
Repos[18]='git@github.com:jc21/MMM-IFTTT.git'
Repos[19]='git@github.com:NolanKingdon/MMM-MoonPhase.git'
Repos[20]='git@github.com:Snille/MMM-homeassistant-sensors.git'
#Repos[21]='git@github.com:schnibel/MMM-Memo.git' # Replaced by module below, I changed some things.
Repos[22]='git@github.com:Snille/MMM-Memo.git'
Repos[23]='git@github.com:almerica/MMM-ImageFit.git'
Repos[24]='git@github.com:Snille/MMM-Videoplayer.git'
Repos[25]='git@github.com:MartinGris/MMM-GoogleMaps-Tracking.git'
## ----------------------------------------------------------------------------
## Start!
cd "$Moddir"
for t in "${Repos[@]}"
do
git clone $t
#echo "Cloning $t"
done
echo "Cloning Done."
echo "Now npm installing..."
for f in *;
do
if [[ -d $f ]]; then
installmodule=$(basename $f)
[[ $installmodule =~ ^(default|node_modules)$ ]] && continue
cd "$installmodule"
if [ -e "$Packfile" ]; then
# npm install --production
npm install
fi
cd ".."
fi
done
echo "Download and install done."
echo "Now restoring backup files from $DownloadFrom."
## Counts through the array of files (and uses the dirs to know where to put them).
for ((i=1; i<=${#Files[@]}; i++)); do
if [[ $(wget $DownloadFrom${Files[i]} -O-) ]] 2>/dev/null
then
wget $DownloadFrom${Files[i]}
printf 'Moving %s to %s...\n\n' "${Files[i]}" "${Dirs[i]}"
mv ${Files[i]} ${Dirs[i]}
fi
done
## Rename the config.
mv ${Dirs[1]}${Files[1]} ${Dirs[1]}$ConfigName
echo "Installation and restore done!"
echo "You can now start your Magic Mirror."
exit