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

Re: r41007 - in trunk/packages/partman/partman-crypto: . debian

On Thu, Sep 28, 2006 at 12:05:59PM +0200, Frans Pop wrote:
Please try to avoid hardcoded paths in scripts. In recent commits I noticed quite a few of them.

For example, to check for the availability of an executable, the following construct is preferred:
  if type <executable> >/dev/null 2>&1; then

For executing programs/scripts, just calling the executable is preferred (without path).

Random idea: if a program is executed and some lib(s) is/are missing, there'll be an error loading shared libraries and 127 will be the return value. If the program doesn't exist, the return value from the shell will also be 127.

So, instead of checking all the libs for the programs (cryptsetup, dmsetup) that were downloaded....how about something like this:

cryptsetup > /dev/null 2>&1
if [ $? -gt 1 ]; then
	# error

Is this a daft idea? :)

David Härdeman

Reply to: