Not sure if I should be commenting here or there, so I’ll start here.
This ties in with what i have been doing regards a emoncms install script and the updater script.
I share your reasoning and have some suggestions of my own regarding simplifying the standard locations.
However! IMO the pi user folder is NOT the place to put this stuff and with the needs of the emonSD filestructure and non-pi installs this is unlikely to become THE standard. Once you factor out the emonSD/Pi users, RPi users that use a different username and non-pi installs this actually caters for quite a small group of users.
My efforts have been to move away from any rasperrypi/raspbian or pi user configuration, in fact I avoid using any user directories altogether. Even if we try to expand inclusion to RPi users that choose to change their RPi username by editing all guides to use /home/pi
instead of /home/<username>
or something similar, every command they encounter needs editing, they cannot just copy and paste. Likewise instructions, guides and forum comment like “usually found in the users home directory” or " usually found at /home/pi or what ever your username you use" are not as good as “you WILL find it at x/y.z”.
The use of a hidden folder or file in the users home folder is usually done for user specific settings and files that are positioned as such to over rule the defaults, if you delete a user, the lost settings and files should not affect any softwares for other users.
Do you also intend to move the mysql tables? If so do you intend to edit the mysql default location for all users/databases or specific to the emoncms table(s) or use symlinks?
The emonPi already uses a different location for the data files, settings.php and mysql tables etc but not the same as you suggest here, it would be good to try and unify rather than add another structure.
Since the RO filesystem of the emonSD/Pi dictates the datafiles settings and tables must go to a writable location, which must be a separate partition to allow it to be mounted RW and the FS RO, it might make sense to follow this directive by way of a new root folder /data and to hold the data, settings and tables there, but with symlinks to the “correct” locations, ie the tables and data files remain under /var/lib (although the phpfina and phptimeseries data should be sub-foldered /var/lib/emoncms as they are emoncms specific files, this would match other services like /var/lib/mysql).
IMO we should try to resolve to a fixed location for the settings.php file that is outside, outside the emoncms folder rather than a list of possible locations that are biased to the pi username. Not only do the checks add to the processing load every time the settings file is accessed, it is also very open to issues arising from multiple settings.php files eg a user may want to experiment and to do so makes a copy of their settings.php file in their home/user folder, which if they are using the default pi username, could mean emoncms will find that copy before the one they are editing in the emoncms folder so no changes will take effect.
Maybe this is an opportunity to change the settings.php file name too, it’s name doesn’t tie it in with emoncms at all, so from that prospective the emoncms folder is the best and possibly the only place it should be located. even calling it emoncms_settings.php would be a big step forward, however I would like to see some form of instancing so if you have multiple emoncms installs it is clear which settings file belongs to which instance, again, the obvious place would be the emoncms folder it relates to, but I agree it would be better placed elsewhere, but in a sub-folder or with a name that ties it back to it’s instance.
Whilst writing the installer and updater I have also decided the non-www modules need to be located in a single folder, for operational/security reasons this must not be in the /var/www path, but nor should it be in the users home directory. I have been installing this folder to /srv which is also the preferred location for emonhub and any other non-packaged softwares.
In short. I think the default Linux installation should follow Linux filesystem guideline as close as possible, when these agreed standard locations are used throughout, then backup routines and any other interaction with the emoncms filesystem will be easily performed, documented and supported. To that we can add a further optional layer of “move and symlink” of the essential variable parts (tables, settings and datafiles etc) to a root folder eg /data, this would allow users such as yourself to find all the files in one location and since this /data folder can just as easily be a mounted partition, it would be the default for an emonSD/Pi type install.
All installs would then have the files in the “correct” locations and meet the demands of the RO image and those that want a single location for back up purposes or even just for HDD or USB stick (for data only) solution.
a couple of links re linux FS structure
http://www.pathname.com/fhs/pub/fhs-2.3.html
https://wiki.debian.org/FilesystemHierarchyStandard