Subject: Re: adding check for binary packages to audit-packages
To: Alistair Crooks <agc@pkgsrc.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 05/12/2005 09:48:02
On Thu, 12 May 2005, Alistair Crooks wrote:

> > The code for figuring out the fetch command and that complaint of unknown
> > fetch command probably should be done at pkgsrc build time of the package
> > and not needed in the end result script. Anyone want to improve that?
>
> No, it shouldn't be done like that - the way it is now allows people
> to use different FETCH_CMDs.  Please don't try to change this.

Have a look at end resulting script:

utility=`echo "/usr/bin/ftp" | /usr/bin/awk '{ print $1 }'`
case "$utility" in
*curl)  /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*ftp)   /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*wget)  /usr/bin/ftp ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*fetch) /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;

And the template:

utility=`echo "@FETCH_CMD@" | @AWK@ '{ print $1 }'`
case "$utility" in
*curl)  @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*ftp)   @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*wget)  @FETCH_CMD@ ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*fetch) @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;


The utility is hard-coded once you install as shown above.

Notice that curl, wget, fetch would never match in examples (using default
ftp) as this was implemented.

I haven't checked but maybe it should do:

: ${FETCH_CMD=@FETCH_CMD@}

And then change the remainder s/@FETCH_CMD@/${FETCH_COMMAND}/

 Jeremy C. Reed

 	  	 	 BSD News, BSD tutorials, BSD links
	  	 	 http://www.bsdnewsletter.com/