Skip to content

Change how files are saved

raphink edited this page Jan 4, 2013 · 1 revision

It is possible to change how files are saved either by passing certain flags to aug_init, or by setting the node /augeas/save prior to calling aug_save. The possible values for /augeas/save are listed in /augeas/version/save and are

overwrite
overwrite files in place (this is the default)
backup
replace the original file with the new file, save a copy of the original file by adding the extension .augsave. If the file that Augeas is reading is actually a symlink, the backup will be put next to the target of the symlink.
newfile
save changes next to the original file in a file with extension .augnew
noop
do not make any changes in the file system. Go through the motions of saving, and in particular, report what files will need to be written out in /augeas/events/saved

Finding out what files were modified

Augeas lists which files were saved in /augeas/events/saved; there is one such entry for each file that was saved. The values of those nodes are the paths in the Augeas tree. For example, if the file /etc/hosts was changed in the file system, there will be one node /augeas/events/saved with value /files/etc/hosts