Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Backup from emonpi and restore to Ubuntu - Script cleanup

Tags: #<Tag:0x00007f1be260b148> #<Tag:0x00007f1be260afb8>

Hi all,
I’ve finally stopped tinkering with my live EmonPi and am setting up an EmonCMS install on an Ubuntu VM.
I’ve submitted a PR (https://github.com/openenergymonitor/EmonScripts/pull/123) to change the install scripts to use Python3 (in alignment with the update script) and also a tweak to the docs as I had been lazy when following the instructions and ended up wasting a whole load of time by not setting pi=0, hence hope to make it easier for the first time Linux installers.

After the install I imported the data from a backup and noticed a message stating “old image”, the backup came from an EmonPi with the 2019 SD install image, hence looked through the code further and found the following code which would naturally fail to give appropriate responses on a non SD image build:


I then looked through the rest of the script and found the only reference to image_versions and image_date were commented out:

It looks like this code is no longer required and could be removed. I’ve looked through all the other files within the module and cannot find any references to it (excluding the lookups shown above and in all the export and import scripts).
I’m going to submit a PR to correct the location for the module.json lookup in the emoncms-import.sh and wanted to see if you agree that its worth clearing out the old code at the same time?

I’ve dropped in a comment re the use of sudo and pip/pip3.

Thanks for the updates. I thought we’d managed to purge all python only install commands!

Have you tested it for a Pi install as other modules/scripts get added in a Pi environment so there is still a chance python is required somewhere.

Thanks Brian,
I’ve removed the sudo and kept python/ pip in the install as they are referenced elsewhere, for example pip is referenced in quite a few “.travis.yml” files and “emonpi/update/main.sh” I don’t know anything about yml and presume that the emonpi update is still used.
Any thoughts on removing the commented out “$image” section in emoncms-import.sh? If not, I’ll group this with the module.json change into a PR