Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.15.0 is available! For more information about this release, check out this topic.

    Multi module install script

    Troubleshooting
    3
    3
    1456
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Snille
      Snille Module Developer last edited by Snille

      Just to help you other people out there doing the same I’m doing, I made this little script to clone all the modules I’m using to a “new” mirror without any fuzz.
      First change the “Moddir” path to the correct one for you.

      array in script (I have all of mine in there, but just change or comment them out. 🙂

      Make the script executable (chmod +x installmodules.sh)
      And execute it.

      Each module will then be cloned and “npm installed” automatically.

      When it’s done, just copy the config.js and the custom.css files in place from your “other” mirror.
      Restart the “new” mirror (pm2 restart mm). Done! 🙂

      Here is the “installmodules.sh” script:

      #!/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 ~/.ssh/id_rsa.pub
      
      ## Copy the SSH public key and add it to you GIT SSH keys.
      
      ## ----------------------------------------------------------------------------
      ## Config below.
      ## ----------------------------------------------------------------------------
      
      ## The module install directory.
      Moddir='/home/pi/MagicMirror/modules'
      #Moddir='/home/linaro/MagicMirror/modules'
      #Moddir='/var/www/html/magicmirror/mm/modules'
      #Moddir='/var/www/html/magicmirror/m/modules'
      
      ## Package file
      Packfile='package.json'
      
      ## All the modules repos from Git.
      Repos[1]='git@github.com:KirAsh4/calendar_monthly.git'
      #Repos[2]='git@github.com:desertblade/iFrame.git'
      Repos[3]='git@github.com:masters1222/mm-hide-all.git'
      #Repos[4]='git@github.com:valmassoi/MMM-bitcoin.git'
      #Repos[5]='git@github.com:barnabycolby/MMM-Carousel.git'
      Repos[6]='git@github.com:Snille/MMM-Chart.git'
      Repos[7]='git@github.com:matteodanelli/MMM-cryptocurrency.git'
      #Repos[8]='git@github.com:cowboysdude/MMM-DailyQuote.git'
      #Repos[9]='git@github.com:brobergp/MMM-doomsDay.git'
      Repos[10]='git@github.com:LukeSkywalker92/MMM-Globe.git'
      Repos[11]='git@github.com:shbatm/MMM-JSONStatusChecker.git'
      Repos[12]='git@github.com:schnibel/MMM-Memo.git'
      Repos[13]='git@github.com:Snille/MMM-Modulebar.git'
      Repos[14]='git@github.com:Snille/MMM-ModuleScheduler.git'
      Repos[15]='git@github.com:CatoAntonsen/MMM-MotionEye.git'
      #Repos[16]='git@github.com:Tueti/MMM-MovieListings.git'
      #Repos[17]='git@github.com:Snille/MMM-MovieListings.git'
      Repos[18]='git@github.com:jclarke0000/MMM-MyCommute.git'
      #Repos[19]='git@github.com:ianperrin/MMM-NetworkScanner.git'
      Repos[20]='git@github.com:brobergp/MMM-newsfeedtouch.git'
      #Repos[21]='git@github.com/shbatm/MMM-OnScreenMenu.git'
      #Repos[22]='git@github.com:Snille/MMM-PiLights.git'
      #Repos[23]='git@github.com:Snille/MMM-PlexNowPlaying.git'
      Repos[24]='git@github.com:Gyran/MMM-plex-recently-added.git'
      Repos[25]='git@github.com:Snille/MMM-Profilepicture.git'
      Repos[26]='git@github.com:tosti007/MMM-ProfileSwitcher.git'
      Repos[27]='git@github.com:Jopyth/MMM-Remote-Control.git'
      Repos[28]='git@github.com:Snille/MMM-Sonos.git'
      Repos[29]='git@github.com:janbanan007/mmm-suncalc.git'
      Repos[30]='git@github.com:BenRoe/MMM-SystemStats.git'
      Repos[31]='git@github.com:brobergp/MMM-TextClock.git'
      Repos[32]='git@github.com:tosti007/MMM-TouchNavigation.git'
      Repos[33]='git@github.com/tosti007/MMM-TouchNotifications.git'
      Repos[34]='git@github.com:RedNax67/MMM-WunderGround.git'
      Repos[35]='git@github.com/jclarke0000/MMM-MyCalendar.git'
      Repos[36]='git@github.com/TheBogueRat/MMM-iFrameReload.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 "All done."
      echo "Now you have to add all the modules to your config (or copy your old one) and don't forget your custom.css file."
      

      Enjoy! 🙂

      Mykle1 1 Reply Last reply Reply Quote 3
      • Mykle1
        Mykle1 Project Sponsor Module Developer @Snille last edited by

        @Snille said in Multi module install script:

        Here is the “installmodules.sh” script:

        Pretty friggin cool, and also damn nice of you!

        1 Reply Last reply Reply Quote 1
        • cowboysdude
          cowboysdude Project Sponsor Module Developer last edited by

          That is awesome!!!

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy