Next Previous Contents

7. Directory Listings

Directory listings are used to monitor the contend of a directory. The config file contains the list of all the files in the directory as well as their properties including the links of symbolic links. sysf can then be used to check that none of the files have been modified but also that no files has been added or removed from the directory. Directory listings are particularly useful to maintain the rc.d directories.

The difference between a directory entry and a directory listing entry is that a directory entry describes the properties of a directory (ownership, modes ...) while a directory listing describes the content of a directory. The same directory can have a sysf entry both as a directory and as a directory listing (one will have to use two different entry name and config names for them).

7.1 Directory lists file syntax

An entry for a directory listing in the sysf.conf file looks like this:

ENTRY_NAME = GROUP SYSTEM_FILE CONFIG_NAME g[OTHER_FLAGS];
where SYSTEM_FILE is the path of the system directory and g is the flag that states that the entry is a directory listing. Other flags can be set has well.

The config file lists all the files in the directory with their properties in the following format:

FILENAME = OWNER_UID GROUP_GID MODE FILE_TYPE SIZE CHECK_SUM [LINK];
where

7.2 Directory lists examples

In the example below we show a few typical entries for directory lists in the sysf.conf file. The directory rc2.d and rc3.d are directory lists with the flag r set so that .DIST files are not created by the command first_install and OS_install. The flag I indicates that an auxiliary command must be executed by sysf. (It is given in the case study section below. It starts and stops the different services as the symbolic links are added or removed)

In our example, the directory etc is maintained using both a directory entry and a directory list entry. The entry etc_D maintains the properties of the directory while etc_DL maintains its content.

rc2.d        =  rc      /etc/rc2.d              rc2.d grI;
rc3.d        =  rc      /etc/rc3.d              rc3.d grI;
etc_D        =  etc     /etc                    etc_D  d;
etc_DL       =  etc     /etc                    etc_DL g;

We given below a short extract from a possible config file etc_DL. The file .pwd.lock is completely ignored. The content (size and check sum) of the passwd file are ignored so that changes made by users don't show up (this is maybe not a good idea). The file /etc/rc.local is a symbolic link to rc.d/rc.local and resolv.conf is a regular file with the md5 check sum f0c2d408cdd2b94066487ae60dceb82c.

.pwd.lock = 0 0 600 "fI" 0 1;
X11 = 0 0 755 "d" 0 0;
passwd = 0 0 644 "f0" 0 0;
rc.local = 0 0 777 "l" 0 0 "rc.d/rc.local";
resolv.conf = 0 0 644 "f" 88 "f0c2d408cdd2b94066487ae60dceb82c";

The config files for directory lists should not be created by hand but rather initialised with the sysf commands new, makegroup or makedef.

7.3 Auxiliary commands.

When the sysf command is install, first_install or OS_install and when an entry has the flag I set in the sysf.conf file, the auxiliary command named after the entry name for the directory list is executed for each modified entries. The auxiliary command is never executed for the sysf command that do not modify the system file.

The auxiliary command is executed when a member of a directory lists must be created or removed. It is executed for every type of entry even when sysf is unable to update a given type of entry (like creating a non existing regular file). When an entry needs to be modified, (when the entry has changed) the auxiliary command is executed first before trying to remove the entry and once after trying to create the new entry.

The arguments of the auxiliary commands are as follow:

    AUX_COM SYSTEM_FILE TYPE ACTION ECHO_ON SYSF_COMMAND
where

When a file is removed, the auxiliary command is executed with the ACTION set to REMOVE before the file is actually removed.

When a file is created, the auxiliary command is executed with the ACTION set to CREATE after the file has been created.

When a file is modified the auxiliary command is executed with the ACTION set to REMOVE before the file is changed and again with the ACTION set to CREATE after the change.


Next Previous Contents