Using the diskless package for nfsroot systems. | ||
---|---|---|
Prev |
When a file is copied, its details will be stored in .config.new, and .config.new is renamed to .config.all at the end of successful completion. This use of 2 files is so installed files can still be tracked even if installation fails.
The status information for each file contains two sets of the following fields, separated by '=':
1 - 12: output from lstat($file);
13: extra information depending on file type, eg MD5sum for normal files.
14: file type, as I couldn't work out how to extract it from fields 1 to 12.
The first set contains information about the source the last time the file was installed. This is used to determine if the destination file has changed. The second set contains information about the source file the last time the installation was run. This is used to determine if the source file has changed. If the first set is a '*' then this file was never formally installed. If the second set is a '*', then it is taken to be the same as the first set.
The reason two sets of data are required (and not just one like for dpkg conf files) is that the time and date of the files is taken into consideration, and it is important that the reference date for the destination remains the same unless it is updated.
Consider this worse case example: The source file and destination file are modified to have the same date and time (ie coincidence). The user runs the installation program but chooses not to update the file. The installation can:
don't update the reference. This means on the next install both files have a status of "newer", and you will always be prompted if you want to replace the destination file, increasing the risk of saying yes by mistake.
update the reference to the new date and time of the source. This might look OK, but it now both files have a status of "same". This means if the source file is changed, it will overwrite the destination, no questions asked.
save two references, one is the reference to the source when it was last installed, and one is the reference to the source now. This is a combination of the above two methods, and is what my program does. This means the source file will get a status of "same", but the destination file will continue to get a status of "newer".
As from autoinstall.pm::doit:
| <---------------- SOURCE FILE -----------------------> | DST FILE | deleted | created | same | newer(1)| older(1)| changed | ---------+---------+---------+------+---------+---------+---------+ deleted | ASK | REPLACE | NOP | ASK | ASK | ASK | created | ------- | ASK | --- | ----- | ------ | ------- | same | REPLACE | ------- | NOP | REPLACE | REPLACE | REPLACE | newer(1) | ASK | ------- | NOP | ASK | ASK | ASK | older(1) | ASK | ------- | NOP | ASK | ASK | ASK | changed | ASK | ------- | NOP | ASK | ASK | ASK | -------------------------------------------------------------------
Note: As of version 0.1.8 the date/time comparison has been disabled, since it was no longer required and broke when the source is controlled by CVS.
Table 6-1. Source File
deleted | means the file is listed in .config.all but not there. |
created | means the source file exists but not listed in .config.all (as it is not listed, there is nothing to compare it with). |
same | source file not modified since last copied. |
newer | source file is newer then reference. |
older | source file is older then reference. |
changed | source file has been determined different then reference by some other check (eg file size). |
Table 6-2. Destination File
deleted | means the file is not there. |
created | means the destination file exists but not listed in .config.all (as it is not listed, there is nothing to compare it with). |
same | destination file not modified since last copied. |
newer | destination file is newer then reference. |
older | destination file is older then reference. |
changed | destination file has been determined different then reference by some other check (eg file size). |
Table 6-3. Options
ASK | ask user what to do. If the old file is required, the new one will be renamed to end with .ai-new; if the new file is required, the old file will be renamed to end in .ai-old; in any case the user will only be asked ONCE for each file. |
REPLACE | Replace destination file, if exists. |
NOP | don't do anything. |