MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    How to update.

    Scheduled Pinned Locked Moved Tutorials
    35 Posts 21 Posters 96.2k Views 20 Watching
    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.
    • johnnyboyJ Offline
      johnnyboy @izanbard
      last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • SnilleS Offline
        Snille Module Developer @izanbard
        last edited by Snille

        @izanbard Hello, added a restart of the mirror (via pm2) if an npm install has been done and also added “–production” to the npm install command. Sometimes the module-developer have lot’s of extra stuff added in the package list just for developing. :)
        I’m currently now running this script via CRON every night. :)

        #!/usr/bin/env bash
        
        updated=false
        
        cd /home/pi/MagicMirror
        echo "Checking for MagicMirror updates."
        git fetch
        if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]
        then
            echo "Found, updating..."
            git pull
            npm install
            updated=true
            echo "Update done."
        else
            echo "No update needed."
        fi
        echo ""
        
        cd modules
        
        for directory in *; do
            if [[ -d ${directory} && ${directory} != "node_modules" && ${directory} != "default" ]]; then
                echo "Checking for ${directory} updates."
                cd ${directory}
                git fetch
                if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]; then
                    echo "Found, updating ${directory}..."
                    git pull
                    if [[ -e "package.json" && -f "package.json" ]]; then
                        echo "package.joson changed for ${directory}, installing..."
                        npm install --production 
                        updated=true
                        echo "Update done."
                    fi
                else
                    echo "No update needed."
                fi
                echo ""
                cd ..
            fi
        done
        
        if $updated; then
            echo "Restart of MM needed, restarting now."
            pm2 restart mm
        fi
        echo "All done. :)"
        

        If you cant find it, make it and share it!
        Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

        D 1 Reply Last reply Reply Quote 0
        • R Offline
          RudyAcevedo @izanbard
          last edited by

          @izanbard Thank you!!

          1 Reply Last reply Reply Quote 0
          • B Offline
            batzyn
            last edited by yawns

            thank u!

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              akrishnan.j @batzyn
              last edited by

              @batzyn

              pi@akpi:~/MagicMirror $ sudo git pull && npm install
              Updating 8010e62…5c41e24
              error: Your local changes to the following files would be overwritten by merge:
              css/main.css
              Please, commit your changes or stash them before you can merge.
              Aborting
              Any ideas…

              johnnyboyJ S 2 Replies Last reply Reply Quote 0
              • johnnyboyJ Offline
                johnnyboy @akrishnan.j
                last edited by johnnyboy

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • UnboredU Offline
                  Unbored @izanbard
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • UnboredU Offline
                    Unbored @izanbard
                    last edited by

                    @izanbard Thank you.

                     #!/usr/bin/env bash
                    
                    cd /home/pi/MagicMirror
                    echo "######### CHECKING MAGIC MIRROR ##########"
                    

                    Has anyone else deployed this script?

                    When I try to run it as a .py or .sh there is an error on line 6 stating invalid syntax at the end of the first echo row. Any suggestions on clearing this issue?

                    B 1 Reply Last reply Reply Quote 0
                    • B Offline
                      Binog @Unbored
                      last edited by

                      @Unbored
                      Delete the " and add straight ones again " (If You edited this file via an alternate editor on win/Mac then it might be a cursive "… try it, worked for me!

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        KX900
                        last edited by

                        hi

                        i get this message:

                        error: Your local changes to the following files would be overwritten by merge:
                        	modules/default/calendar/calendar.js
                        	modules/default/compliments/compliments.js
                        	modules/default/newsfeed/newsfeed.js
                        Please, commit your changes or stash them before you can merge.
                        Aborting
                        
                        

                        what should i do?

                        brobergB 1 Reply Last reply Reply Quote 0
                        • brobergB Offline
                          broberg Project Sponsor @KX900
                          last edited by

                          @KX900 backup those files somewhere if you want to keep the changes you’ve made (you shouldn’t have made any changes in those files unless you really reaally had to) and then delete them and try to update again.

                          K 1 Reply Last reply Reply Quote 0
                          • K Offline
                            KX900 @broberg
                            last edited by

                            @broberg
                            thank you.
                            i had to do the changes because of “Umlaute”.

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              SpecialRob @akrishnan.j
                              last edited by

                              @akrishnan.j

                              I was just searching for the same thing and had the same error message.
                              I renamed the offending file
                              ran the sudo git pull && nom install command
                              update worked fine without error and installed a new copy of offending file
                              copy the original file back if your edits were critical

                              1 Reply Last reply Reply Quote 0
                              • G Offline
                                gripworks
                                last edited by

                                I have never had an issue updating until tonight. I got the following message back and am not sure how to proceed.

                                
                                pi@magicmirror:~/MagicMirror $ git pull
                                
                                *** Please tell me who you are.
                                
                                Run
                                
                                  git config --global user.email "you@example.com"
                                  git config --global user.name "Your Name"
                                
                                to set your account's default identity.
                                Omit --global to set the identity only in this repository.
                                
                                fatal: empty ident name (for ) not allowed
                                
                                

                                I’m sure it’s something stupid I don’t understand ,(not super knowledgeable about linux). I have tried entering various credentials in various ways but my lack of understanding the correct syntax seems to be my undoing.

                                Thanks in advance.

                                1 Reply Last reply Reply Quote 0
                                • SnilleS Offline
                                  Snille Module Developer
                                  last edited by

                                  @gripworks this usually happens when you have cloned the repository with ssh instead of https.
                                  At least that’s what I have figured out works. :)

                                  If you just do the suggested commands it’s all solved.
                                  It’s github that wants to know who you are. :)

                                  git config --global user.email "you@example.com"
                                  git config --global user.name "Your Name"
                                  

                                  If you cant find it, make it and share it!
                                  Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                                  1 Reply Last reply Reply Quote 0
                                  • G Offline
                                    gripworks
                                    last edited by

                                    Thank you, That worked. I appreciate the help.

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      dam4 @Snille
                                      last edited by

                                      @Snille
                                      I am new to Linex and I have copied your script exactly and I get the following error.
                                      -bash: update.sh: command not found

                                      I called the script update.sh and I was going to use it in a cron job after I tested it to make sure it worked. Can you tell me what I might have done wrong. Thank you in advance for your help.

                                      I 1 Reply Last reply Reply Quote 0
                                      • I Offline
                                        izanbard @dam4
                                        last edited by

                                        @dam4 It is likely that two things are wrong.

                                        First the script needs to be executable so please run:

                                        $ chmod u+x update.sh
                                        

                                        this will add execute permissions for the file owner to the file. Have a look at man chmod for more detail.

                                        The next thing is to make sure that Linux knows where to look for it. This can be quite a complicated subject involving descriptions of the $PATH environment variable and all sorts. But the easy way to do it is to add a relative or absolute path to the start of the command. So from the command prompt in the folder where the script exists try:

                                        $ ./update.sh
                                        

                                        where the . means “this folder”. For the cron tab through you might want to use the full path something like:

                                        0 2 * * * /full/path/to/file/update.sh
                                        

                                        Hope at least some of that is meaningful for you.

                                        D 1 Reply Last reply Reply Quote 2
                                        • D Offline
                                          dam4 @izanbard
                                          last edited by

                                          @izanbard
                                          Thank you. I did the chmod to make it executable but using the ./update.sh worked. Thank you again for your help.

                                          1 Reply Last reply Reply Quote 0
                                          • L Offline
                                            LucrativeRook62
                                            last edited by

                                            This post is deleted!
                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy