Libconf - Set of abstraction layers to the linux/unix configuration
use Libconf::Glueconf::Networking::Resolv;
my $resolv = new Libconf::Glueconf::Networking::Resolv({filename => '/etc/resolv.conf' });
push(@{$resolv->{nameserver}}, '192.168.76.7');
$resolv->{search}->[1] = 'foo';
$resolv->write_conf('/etc/resolv_modified');
#include <stdio.h>
#include "conf2xml.h"
#include <string.h>
int main (int argc, char **argv, char **env)
{
char *xml_string;
conf2xml_init();
xml_string = conf2xml("/etc/rc.conf", "Generic/Shell", "shell_style:true_bash,shell_command:/bin/bash");
FILE* output = fopen("/tmp/rc.xml", "w");
fwrite(xml_string, strlen(xml_string), 1, output);
// ... alter xml_string ...
xml2conf(xml_string, "./etc/rc.conf", NULL, NULL);
conf2xml_free();
return (0);
}
from conf2xml import *;
xml_string=conf2xml("/etc/passwd", "System/Passwd")
f=open("/tmp/passwd.xml", "w")
f.write(xml_string)
f.close
xml2conf(xml_string, "/tmp/passwd", "System/Passwd")
require conf2xml
xml=Conf2Xml.conf2xml("/etc/passwd", "System/Passwd");
Conf2Xml.xml2conf(xml, "/tmp/passwd", "System/Passwd");
The template list can be found in the Libconf::Glueconf manpage, or you can have a list by issuing on the command line :
libconf --command 'list_templates'