Topic: Filtering files based on the way sorcery should treat them
fact\filter |
volatiles |
configs |
excluded |
protected |
file is installed |
yes |
yes |
yes |
yes |
file is dispelled |
yes |
only if unmodified 1 |
no |
no |
file's md5 matters |
no |
yes |
no |
*yes |
Problem:
Currently sorcery has two of these files, excluded and protected. Neither are documented significantly and they leave a lot to be desired.
Proposed Spec:
Currently there are system level filter files in /var/lib/sorcery. Each line is a single pattern, each pattern will be matched against a filename's full path with $INSTALL_ROOT stripped off. A pattern such as "^/etc" would match any file in /etc. Filter functions to filter in or out files will be utilized in sorcery depending on whats required.
With the Installed Grimoire it will now be possible for each spell to define their own specific files to exclude/protect/etc. These files will only effect their respective spell. These files will also be bundled with cache tarballs (as will the whole installed grimoire) and the Improved_Resurrect code may utilize some of these files.
Here are the following filter files, again these are lists of regular expressions, one per line, a file is said to "match" if it is described by any regular expression in the filter file:
- excluded: any file matched will not be included in the install log, and thus will not be tracked (if excluded by a single spell, the files may be owned by another spell), also, not that it matters extensively, but any file matched will also not be dispelled.
- protected: any file matched will not be dispeled under any circumstances, this means, if the spell that owns them is dispelled, these files will become aliens, use of this particular filter should be reserved for things that if accidentally removed could break the system irrecoverably, or cause sorcery or the script that is supposed to replace said file from functioning. An example of this would be "cp" or "install", why this would be an issue is left as an exercise to the reader.
- volatiles: any file matched will be ignored by cleanse --fix and its subsequent checks. An example would be /usr/share/info/dir which is changed by every spell that installs an info page. See bug 7545 for more information.
- configs: This describes a file as a "configuration" file, namely, things in /etc that the administrator will freely modify. Another example is a hi-score file. These files will be handled specially
# on dispel if the file is modified, the user will have the option (default to no) to remove the file # on resurrect, the file will not be replaced if it already exists (there may be a user query about this, but the default will be to leave the file as is unless it doesnt exist). see bug 7550 for more information.
I'll make some remarks about the relationship between these files: # Volatile and config files should probably be nearly an identical set. Ive decided to keep them seperate because its just as easy codewise to do it this way, and it will provide greater flexibility in the future. However one has to be aware that marking a file as a config file is NOT sufficient for getting cleanse to ignore it and funny things might happen if you dont. #Adding things to the protected/volatile/config list is useless if the file is in excluded (it wont be tracked). #On dispel protected files are kept from being removed #There currently is no way to negate a pattern in the system level filter files.
Comments below the line please.
I would just note that if you put file under the configs, sorcery won't ( and can't ) stop the spell itself to overwrite it's configs upon recast.
also depends on your settings (1)
