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.

    With Sam's Backup and Restore script I need help

    Scheduled Pinned Locked Moved General Discussion
    10 Posts 2 Posters 911 Views 2 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.
    • S Offline
      sdetweil @sdetweil
      last edited by sdetweil

      @kayakbabe

      and one other thing

      only one side can create the repo with files

      github (with readme), then git clone to pi (and add files via backup)
      or
      github create empty repo, no files
      git push initial files from pi (after backup)

      if u create repo at github w readme
      AND you git commit at pi
      then try to git pull,
      now you have confusion
      if you git clone, BUT it already exists
      you can clone INSIDE the repo/backup
      folder but now you have repo in repo.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      kayakbabeK 1 Reply Last reply Reply Quote 0
      • kayakbabeK Offline
        kayakbabe @sdetweil
        last edited by

        @sdetweil

        I’ll put this in my own words to see if I’m understanding what I am to do.

        Depending on how I create my repository on github will determine my next step.

        1. Create respository on GitHub (private is most preferable since I might have private info in my magic mirror config file and I don’t want that public via GitHub).

        Note: This process is easier if you create an empty GitHub Repository.

        1. If I created an empty GitHub Repsitory:
          2.a.Run the backupscript using the flags on the backup script for repository name, source folder, backup destination folder, github userid, etc.
          2.b. from the backup desitnation folder run the command
          git push

        2. if I created GitHub repository with a readme:
          then I’ve made a big mess and shouldn’t have done that. So delete the local folder and github repository and start over.

        Results
        I ran this

        bash -c ./mm_backup.sh -s /home/pi/MagicMirror -b /home/pi/MMbackup2 -r https://github.com/Kayakbabe/MMbackup2.git -u Kayakbabe -e email@mydomain.com -m 5thTry 
        
        

        And got this:
        folder created with name /home/MM_backup
        files created inside /home/MM_backup
        no folder named MMbackup2

        I also tried with -b /home/pi/MMbackup2
        and still get home/pi/MM_backup created

        i don’t have a folder named MMbackup2 on my pi at all.

        I then manually created /home/pi/MMbackup2
        ran my command again and still no files were placed in MMbackup2. i tried both =b /home/pi/MMbackup2 and -b MMbackup2 to no avail.

        I noticed .git was created in the MM_backup folder along with the files the script created.

        I ran git remote -v and get no output. (Just to make sure, i went to a diff local git folder and ran git remote -v and it shows the origins for fetch and pull.) so I think the .git being created in the MM_backup folder isn’t correct.

        My questions are:

        What is wrong with my flags that my backup folder isn’t being create with the folder name I chose?

        Was the backup script supposed to do all the git stuff for me, like the git remote add origin and add files and set the branch and message?
        So that, all I am supposed to have to run git push?

        Or, am i supposed to now do all the following stuff?

        git remote add origin https://github.com/<USER>/<repo>.git
        git branch -M main
        git push -u origin main
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @kayakbabe
          last edited by

          @kayakbabe can you send me the log?

          MagicMirror/installers/backup.log

          if you are putting the files in your home folder you don’t use the full path

          you don’t push, -p will do that.
          if you do NOT specify -p then YOU have to do the setup to push, and push. I was trying to save you work
          (but as you specified the github repo, I should prompt if you DO want to push)

          git remote -v
          is from the inside backup folder (see below)

          any parms whos default is good you don’t need to specify

          also, you don’t clone the scripts to your system, just execute then from the guthub page like install and upgrade (you don’t get my fixes if you clone the repo),
          you also don’t contaminate your system in case you have disk troubles and are trying to make an emergency backup

          bash -c ./mm_backup.sh -s /home/pi/MagicMirror -b /home/pi/MMbackup2 -r https://github.com/Kayakbabe/MMbackup2.git -u Kayakbabe -e email@mydomain.com -m 5thTry 
          

          should be (-s MagicMirror is default)

          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_backup.sh)" -p  -b MMbackup2 -r MMbackup2 -u Kayakbabe -e user@email.com -m "first backup after build finished (or whatever)"
          

          because you did not specify to push, the script did not setup for push (no git remote add )

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @sdetweil
            last edited by sdetweil

            @kayakbabe
            try the latest

            I updated the scripts to check for and handle full paths like you used.
            and if you specified a repo but did NOT request push, I prompt to discover if you WANT to push this time

            if the full path of the backup folder does not exist, I will try to create it,
            if it fails, I will report the error, and abort.

            -b /foobar

            will probably fail, with permission denied
            -b /home/$username/whatever

            will be used as specified, not jamming $HOME in front

            thank you for these testcases which I hadn’t considered…

            please use your prior full path command (but use from github)

            I also extract the userid from the github repo (and if you specify it thru -u, I check that it matches the one in the url, and abort if not)
            hm… I typically build the url from username abd reponame. one thing to check… thx

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            kayakbabeK 1 Reply Last reply Reply Quote 0
            • kayakbabeK Offline
              kayakbabe @sdetweil
              last edited by

              @sdetweil
              what was happening is that no matter if i used the full path or just the folder name like this
              -b /home/pi/MMbackup2
              -b MMbackup2
              the script always used it’s own folder name of MM_backup.

              when i tried to run from your repository,
              Illegal option '- ’

              I tried a local copy pulled a fresh copy from your GitHub and tried again
              using -s MagicMirror
              and -b MMbackup3

              bash -c ./mm_backup.sh -p -b MMbackup3 -r MMbackup2 -u Kayakbabe -e user@email.com -m "second backup after build finished "

              the backup folder was still created MM_backup and not MMbackup3.

              Then I tried removing the -p option and I get this
              bash -c “$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_backup.sh)” -b MMbackup2 -r MMbackup2 -u Kayakbabe -e email@mydomain.com -m “first backup after build finished (or whatever)”
              environment: line 155: [: too many arguments
              checking for backup folder MMbackup2
              folder doesn’t exist, creating backup folder /home/kelly/MMbackup2
              backup folder is /home/kelly/MMbackup2
              username specified with -u temp doesn’t match the user in the github repo MMbackup2, aborting

              Note i used my correct email, just don’t want it out here to get scraped. And the name and email DO match my github.
              I run git remote-v in the folder it created (MM_backup) and there is no git .

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @kayakbabe
                last edited by

                @kayakbabe well, all I can say, is I must not have tested it right.
                my apologies

                try again… all three scripts corrected now

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • 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