SoftConf - Describe and apply Software Configuration changes to a filesystem.
distros
use SoftConf;
$c = SoftConf->new();
$conf = SoftConf->new(
$directive1 => { $target1 => $value1 },
$directive2 => {
$targetA => $valueA,
$targetB => $valueB
}
);
@can_do = $conf->directives;
@can_do = $conf->get; @targets = $conf->get($directive); $value = $conf->get($directive, $target);
$conf->set($directive, $target, $value); $conf->set($directive, $value); # sets all targets
$conf->remove($directive); $conf->remove($directive, $target);
$conf->merge($c);
$conf->base_dir("/cluster/machine/suse-9.1-i586/image");
$conf->rc_script_dir("/etc/init.d");
$conf->rc_start_dirs("/etc/rc.d/rc3.d");
$conf->rc_stop_dirs("/etc/rc.d/rc0.d", "/etc/rc.d/rc6.d");
$conf->search_dirs("/cluster/lib/Distro/RPM/image", "/");
$conf->peer_dirs("/cluster/machine/suse-9.1-i586/image",
"/cluster/machine/suse-9.1-i586/overlay/common");
$conf->doit();
This package provides the ``SoftConf'' object for use in modifying a filesystem tree. Capabilities include creating and removing files, links and directories, searching for and installing files into place, modifying files according to simple substitution rules, and enabling and disabling services.
SoftConf objects contain a set of directives (described below) which may contain one or more target/value pairs. The directive indicates the task to be done (install, delete, edit, etc.), the target specifies the pathname to act on, and the value indicates how to perform the task (file mode, make a backup, or do nothing at all).
SoftConf is primarily used by the Distro hierarchy.
$c = SoftConf->new(delete => {'/etc/mtab' => 1});
To clear the array, pass a single undefined argument.
To clear the array, pass a single undefined argument.
Any entry with an undefined value will be ignored.
"1" - delete the file or directory "2" - move to a backup copy "0" - skip the entry "ext" - extension to use for backup copy(???)
If the target is a directory, it will be recursively deleted, even if not empty.
Backup copies will named as the original file or directory with a ``.cit_orig'' extension. Backups will only be created once.
"1" - create the directory "0" - skip the entry "mode" - create with the given permissions (eg: "1777")
"1" - install the file or directory
"0" - skip the entry
"path" - copy from the given absolute path on the
current node instead of from the directories
listed by the search_dirs() method.
If the target is a directory, it will be copied recursively.
"1" - create the file "0" - skip the entry "mode" - create with the given permissions (eg: "0644")
If the file exists already and the value is a ``mode'', then the permissions will be changed to the specified mode.
Possible values are:
"0" - skip the entry "path" - real file to point to
Paths of the values may be absolute or relative.
"1" - service should be enabled
"0" - skip the entry
"-1" - service should be disabled, using a
link to /dev/null.
"Snn" - service should be enabled, using the
given startup sequence number.
shutdown will not be modified.
"Knn" - service should be enabled, using the
given shutdown sequence number.
startup will not be modified.
"Snn,Knn" - define both startup and shutdown numbers
Symlinks will be created in /etc/init.d, or whatever directory is appropriate for the given distribution.
If startup and shutdown sequence numbers are not given, SoftConf (and the Distro libs) will try to determine what to use. This will be based on links already in place on the current node, and clues in the init scripts themselves. As a fallback, it will be started after, and stopped before, all existing services.
Possible values are:
"1" - strip all lines from the file "0" - skip this entry, leaving file as is "regex" - strip lines matching the regular expression.
Do not include leading and trailing ``/'' (or other quote operators) in your regex. Anchors, embeded control chars like ``(?i)'' are allowed.
Possible values are:
"0" - skip this entry "string" - text to add to the end of the file
Files that don't already exist will be created.
Possible values are:
"0" - skip this entry "1" - modify the file
In the future, this directive may be updated to perform more generic modifications of files. In the meantime, the following simple keyword substitutions are made:
CIT_HOME_HERE - The top level CIT install directory
eg. "/cluster"
CLUSTER_NAME_HERE - Identifying name for the system
eg. "ACME"
DISTRO_DIR_HERE - Directory where image, overlays
and individual node dirs can be found
eg. "/cluster/machine/suse-9.1-i586"
Distro
Filesys::Clone
distro_mgr
build_distro