hercules-team / augeas

A configuration editing tool and API
http://augeas.net/
GNU Lesser General Public License v2.1
486 stars 199 forks source link

User configuration #819

Open ModProg opened 1 year ago

ModProg commented 1 year ago

I'm unsure if this might be a non-goal of augeas, but I didn't read anything on this in the readme.

Example:

augtool> ls /files/etc/systemd/system/a.service
Unit/ = (none)
Service/ = (none)
augtool> ls /files/home/modprog/.config/systemd/user/a.service
augtool>

The identical file was placed in both locations. AFAICT this is not systemd specific, as none of the paths in https://augeas.net/stock_lenses.html mention home.

georgehansper commented 1 year ago

augeas loads a lot of files on startup, but not everything on the filesystem

Each lens (*.aug) includes a list of files and patterns which it will load automatically. A small number of lenses will load files from the users home directory, but even that may not be what you are looking for

It is possible to tell augtool exactly which file to load, and which lens to use, eg.

augtool --noload
augtool> transform Systemd incl /home/modprog/.config/systemd/user/a.service
augtool> load-file /home/modprog/.config/systemd/user/a.service
augtool> ls /files/home/modprog/.config/systemd/user/a.service
...

(you don't really need to use --noload it just makes the startup a bit faster)

I hope that helps

If you have augeas 1.14.0 or later, you can use augprint to print the required transform, load-file and example set statements for your particular use-case:

augprint --lens Systemd /home/modprog/.config/systemd/user/a.service

The --lens argument will use the specified lens and does not require it to be hard-coded into the *.aug lens file

I don't think the augeas.net website is being updated with any regularity. Please refer to the lens file itself if in doubt