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

Re: Pre-Depends of #CDD#-common meta packages from cdd-common



On Fri, Jun 11, 2004 at 05:50:44PM +0200, Frank Küster wrote:
> In this particular case, wouldn't it be possible to defer any
> questioning in config if the needed commands are not available?
> 
> if command $NEEDED_COMMAND >/dev/null 2>&1; then
>    db_input ...
> else
>   # wait until we are called again from postinst, 
>   # then the command will be available
> fi
> 
> (besides that I don't know whether "command" is a bashism)

I think you might have wanted 'command -v', and that's indeed not
portable. base-passwd.postinst does this:

# A cut-down version of 'which' from debianutils.
searchpath () {
        PROGRAM="$1"
        IFS_SAVE="$IFS"
        IFS=:
        RET=1
        for ELEMENT in $PATH; do
                if [ -z "$ELEMENT" ]; then
                        ELEMENT=.
                fi
                if [ -f "$ELEMENT/$PROGRAM" ] && \
                   [ -x "$ELEMENT/$PROGRAM" ]; then
                        RET=0
                        break
                fi
        done
        IFS="$IFS_SAVE"
        return "$RET"
}

...

if searchpath nscd; then ...; fi

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: