The class Augeas provides bindings to augeas [augeas.net] library.
Augeas::open do |aug| aug.set("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT", "YES") unless aug.save raise IOError, "Failed to save changes" end end
firstboot = Augeas::open { |aug| aug.get("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT") }
Augeas::open do |aug| aug.rm("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT") unless aug.save raise IOError, "Failed to save changes" end end
By passing NO_MODL_AUTOLOAD
, no files are read on startup; that allows setting up a custom transform.
Augeas::open("/var/tmp/augeas-root", "/usr/local/share/mylenses", Augeas::NO_MODL_AUTOLOAD) do |aug| aug.transform(:lens => "Aliases.lns", :incl => "/etc/aliases") aug.load aug.get("/files/etc/aliases/*[name = 'postmaster']/value") end