[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: missing filename in install.sh



Referring to Adma's email and also a Later one from Luke.

Adam Thompson wrote:
(Applies to all versions of install.sh in trunk, confirmed in SVN revs 799 through 2896.)

Line 15 reads:
sed -i.orig "s|WORKING_DIR|$CWD|"
which does nothing except spit out a warning message.

INSTALL.manual instead lists the command:
sed -e "s|WORKING_DIR|$(pwd)|" ledgersmb-httpd.conf > ledgersmb-httpd-13.conf

@sbts wants to keep the "sed -i.orig" form because of its atomicity in case of interruption [from IRC chat 2010-feb-26].

For those that don't know I am sbts :-)
there was a second reason for wanting to keep this form of the sed command. It generates a backup of the file before editing, and is proof against multiple runs, especially if the file has been hand modified. Although as the script stands it copies the file to your apache config directory as the final step which is not completely proof against multiple runs.


I'll point out that for building distro pkgs, it might be better if the MD5 hash of a file doesn't change, i.e. using the redirection form instead. If installing from source, it doesn't matter much one way or the other. OTOH, in a pkg *sample* config files are usually stored under /usr/share/doc/* or something like that, and it's also possible to mark ledgersmb-httpd.conf as a config file so verification runs (e.g. rpm -V) don't bomb on it changing...

So, then line 15 should probably be changed to:
sed -i.orig "s|WORKING_DIR|$CWD|" ledgersmb-httpd.conf

I would propose a slightly more involved change that combines the best of both worlds.

1) in the src tree,
   rename ledgersmb-httpd.conf to ledgersmb-httpd.conf.sample
   and move it into /doc or similar
2) start by copying ledgersmb-httpd.conf.sample to
   /tmp/ledgersmb-$version-httpd.conf
3) if /etc/$ApacheConfigDir/ledgersmb-$version-httpd.conf does not exist
   move /tmp/ledgersmb-$version-httpd.conf to
   /etc/$ApacheConfigDir/ledgersmb-$version-httpd.conf
4) now we can modify the target file, preserving any user changes to
   any existing file.
   sed -i.orig "s|WORKING_DIR|$CWD|"
   /etc/$ApacheConfigDir/ledgersmb-$version-httpd.conf

At the same time as doing #1 I would suggest that other config files (ledgresmb.conf etc) should be treated in a similar fashion.


I'm just getting my toes wet with this project, so I can't offer any concrete opinion on whether INSTALL.manual and install.sh should match more precisely, or which version should prevail.

Personally I think the script and manual should use exactly the same paradigm. This ensures that regardless of which method a user chooses to use, (manual, or script), the end result is identical.

Regards
David Godfrey