[clug] Local configuration on a non-homogeneous LAN

Chris Smart clug at csmart.io
Fri Jun 21 22:27:26 UTC 2019


On Fri, 21 Jun 2019, at 23:41, Brenton Ross via linux wrote:
> 
> It occurs to me that a lot of software stores its user specific
> configurations in the ~/.config and ~/.local directories. If these are
> stored centrally then there could be conflicts when a user changes from
> one machine to another and the configuration data is then out of sync
> with the programs installed on the second machine.
> 
> Does anyone have any ideas on how to handle this ? 
> 

There hasn't traditionally been an agreed location for storing config in Linux, however the basedir spec from freedesktop is trying to address this[1].

"$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."

In theory you could try to set environment variables for each distro which changes these values to the distro's name (you could even add version). There are a few different locations where you could set this, for example:

/etc/profile.d/
/etc/environment
/etc/security/pam_env.conf

 e.g. on Fedora:

# cat > /etc/profile.d/basedir-overrides.sh << EOF
source /etc/os-release
export XDG_DATA_HOME="${HOME}/.config-${NAME,,}-${VERSION_ID}"
export XDG_CONFIG_HOME="${HOME}/.local-${NAME,,}-${VERSION_ID}/share"
EOF

This would set those locations to a distro-specific, e.g.

$ echo $XDG_DATA_HOME
/home/csmart/.config-fedora-30

$ echo $XDG_CONFIG_HOME
/home/csmart/.local-fedora-30/share

However, while I expect in general the desktops and a reasonable amount of software will respect that setting others won't.

Another idea might be to configure additional automounts for those XDG directory locations for each distro, which will store them in different locations in NFS.

You could also have different mount points for home for each distro but common mount points for top level dirs like ~/Documents, etc or just a ~/home/data-goes-here.

-c

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html



More information about the linux mailing list