Answering @borpinâs comments on github here to try and keep discussion in one place (ref Revise mariadb ProtectHome fix by pb66 ¡ Pull Request #104 ¡ openenergymonitor/emonpi ¡ GitHub)
Could you check for the location of the mysql database and only introduce the change if it is located in home?
I did consider that but did not want to over complicate things at this point,
Just thinking that the update script is the same however the emoncms instance has been installed. Having installed via the script, I think this update would introduce an override that was not required.
Iâm thinking that if a new update script isnât introduced with the new install script, then the old one will at the very least require serious review as there are going to be other anomalies too.
This is simply a PR to remove the unnecessary code in the install and since we already have so many redundant files in the various repos, I modified the required fix to existing images to not use another file as the need for the fix should be short lived, no more.
Running an old (current) update script on a newly installed (via new script) image would indeed add the âfixâ without need, but that hopefully will not be a possibility, having installed via a script, the latest update method will (hopefully) have been installed and therefore be recognised as a new style install and run a new style update (script or function) rather than every line in the updater needing individual qualification. But who knows?
Or check and see if the newer /var/opt/emon/ location exists and not install the override if it does?
No not really, this either setâs that path in concrete, introducing a hardcoded path again, Or a more complex arrangement is needed to check the installer config and get the actual install path.
There are other issues caused by the mysql location, rather than burn time and effort trying to get a sticky plaster perfectly fitted, it would make much more sense to correct the issue. ie undo the edits made to the mysql config and add a symlink to where it should be located so that all the old links and paths work, this gets things back as close as possible to âstockâ whilst still supporting RO installs.
If all the Oct 2018 image has different is fstab mounts the partitions RW, maybe those âoct 2018â changes should now be added to the build guide and the emonpi updater too. It seems a fairly trivial task to get the pre-Oct2018 images (and docs) up to Oct2018 spec, then finish the job properly by putting the mysql folder location and config paths back as stock.
This way moving forward, all mysql installs across all updated images would be the same and correct, no patches needed!
[edit] I have added another PR for a simple test to check if the /home/pi/data path is used in the mysql config as this is more accurate than just seeing if the mysql folder exists on that path. (Glyn had already merged the previous PR before I added this).