Backup module usb-import.sh script (beta)

Yet another example of why new “features” need to be “wrung out” before getting released.

I was sure I’d tested this one, its now fixed, thanks!

I have just updated to emonSD-17Oct19 and get “USB drive not found”. The USB drive is:

OK I just read the code and I think I see that the master hasn’t been updated yet, pending Trystan’s GitHub issue investigation - completely understand why. I assume Paul created his own branch to get it working. I’m not a GitHub user so I might need some help to create my own mod :slight_smile:

If you just edit the file line 34 in the folder /opt/emoncms/modules/backup/

to read

usb=$(ls $disk_id | grep ‘usb-Generic’)

it should work.

Just note, you will need to undo this before you are able to update the backup module again.

Thank you Brian! After an initial attempt using Git, I went ahead and did exactly what you suggest about half an hour ago, and the import worked a treat :slight_smile:

However, I wouldn’t have known to undo it for future updates to work though - so double-thanks for that. I made a copy of the file first though :wink:

It would be nice to know how to have done it properly though, via Git…
I created my own fork, edited it and committed it back to my private repo. Now though, how would I apply the update on the EmonPi in order to test it? And then how would I revert back to the master Emoncms release afterwards?

If you want to play be my guest :grinning:

First an explanation of terms

  • upstream is the original emoncms repo you forked.
  • origin is your fork of the upstream
  • local is the repo on your machine

However because the original clone was done direct from the upstream, it calls itself origin in this case (git doesn’t make anything easy - trust me). We won’t bother creating the link though - it doesn’t matter here. It does matter (a bit) if you are doing development work.

First part right, create a fork. Ideally then create your own branch on that fork - if you subsequently want to create a PR (Pull Request) to submit something you have done to the main emoncms repo, this makes it much easier.

To use your repo, you first need to add it to your local machine in the same directory the original is in.

git remote add myrepo https://github.com/YOUR_NAME/backup.git

The ‘myrepo’ can be any name but not one of the 3 above (they have special meaning) git remote -v should look similar to this.

$ git remote -v
myrepo  https://github.com/borpin/backup.git (fetch)
myrepo  https://github.com/borpin/backup.git (push)
origin  https://github.com/emoncms/backup.git (fetch)
origin  https://github.com/emoncms/backup.git (push)

Then the commands

git fetch myrepo
git checkout myrepo/BRANCH_NAME

You will get a message about detatched head - don’t worry about that.

git status

tells you the branch you are on and you are now using your code.

to go back simply do

git checkout origin/master

or

git checkout origin/stable

depending what branch you were on before you started messing about.

HTH

1 Like

Many thanks for taking the time and trouble to write that, Brian. I will master it, but I may need to go and have a little lie down for a bit first :wink:

2 Likes