Date: Tue, 27 Nov 2012 13:16:22 +0100 From: Luca Ferrari <fluca1978@infinito.it> To: freebsd-stable@freebsd.org Subject: Re: simple patch for portsnap to use wget Message-ID: <CAKoxK%2B4KsdMRj2YYPGvSFZTiuQXOeP2%2B9ArkC2gCLVb5DFCb1g@mail.gmail.com> In-Reply-To: <CAKoxK%2B5qivgzMzkOQo7JYOQGAKwyWAf8xfUUR=g5SvpguM2W7Q@mail.gmail.com> References: <CAKoxK%2B5iy2R7=cZp38xKZpTbgFd0aZ3H28tVmPnuPR01w=pO4A@mail.gmail.com> <CAPJF9wnoTCjNM76M-=DdC85P75niKH%2Bta0Vk8X7HORGvT=LLcQ@mail.gmail.com> <CAKoxK%2B5yrsfnMQG5LnJ2%2BFWMH6PDcWmZhKVrKpxkutHpb=MdNA@mail.gmail.com> <CAKoxK%2B5qivgzMzkOQo7JYOQGAKwyWAf8xfUUR=g5SvpguM2W7Q@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
I did a little review and now it is possible to specify to use wget or
not using the portsnap.conf file, as well as the option to ingore
certificate checking even if I don't believe this is correct.
Therefore portsnap with this patch could work with either wget or
phttpget, even if I'm not able to test if the laminating is still
correct for phttpget (someone could test please?).
Regards,
Luca
[-- Attachment #2 --]
36a37,46
>
> # Enable this option if you want portsnap to use wget(1)
> # instead of the standard phttpget program to download
> # all the required files.
> WGET_ENABLE="YES"
>
> # If using wget(1) and dealing with sites with self-signed certificates
> # turn on this option to allow wget(1) to skip checking the certificate.
> # WARNING: this could be a risky way of updating the system!!!!
> #WGET_CHECK_CERTIFICATES="YES"
\ No newline at end of file
[-- Attachment #3 --]
195a196,206
> # handling wget specific extension
> for wgetX in WGET_ENABLE WGET_CHECK_CERTIFICATES; do
> eval _=\$${wgetX}
> if [ -z "${_}" ]; then
> eval ${wgetX}=`grep "^${wgetX}=" "${CONFFILE}" |
> cut -f 2- -d '=' | tail -1 | tr '[:lower:]' '[:upper:]'`
> fi
> done
>
>
>
268c279,298
< PHTTPGET=/usr/libexec/phttpget
---
>
> # do we need the usage of wget(1) instead of the
> # default phttpget?
> if [ "${WGET_ENABLE}" = "YES" ]
> then
> PHTTPGET=/usr/local/bin/wget
> PHTTPGET_OPTS=""
>
> # skip checking certificates, really dangerous!
> if [ ! -z "${WGET_CHECK_CERTIFICATES}" -a "${WGET_CHECK_CERTIFICATES}" = "NO" ]
> then
> PHTTPGET_OPTS="${PHTTPGET_OPTS} --no-check-certificate "
> echo "WARNING: check of certificates is disabled as specified by option WGET_CHECK_CERTIFICATES in $CONFFILE"
> fi
> else
> PHTTPGET=/usr/libexec/phttpget
> fi
>
> check_downloader
> echo "Will use [$PHTTPGET] as downloader"
687,690c717,722
< tr '|' '-' < patchlist |
< lam -s "tp/" - -s ".gz" |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${STATSREDIR} | fetch_progress
---
>
> for current_file in `tr '|' '-' < patchlist | lam -s "tp/" - -s ".gz"`
> do
> echo ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVERNAME}/${current_file} > /dev/null 2>&1
> done
>
721,724c753,760
< echo ${NDEBUG} "metadata files... "
< lam -s "f/" - -s ".gz" < filelist |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${QUIETREDIR}
---
> echo ${NDEBUG} "metadata files..."
>
> # fetch metadata files using wget behind a proxy
> for current_file in `cat filelist`
> do
> echo ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVERNAME}/f/${current_file}.gz > /dev/null 2>&1
> done
>
763,765c799,804
< tr '|' '-' < patchlist | lam -s "bp/" - |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${STATSREDIR} | fetch_progress
---
>
> # fetch metadata files using wget behind a proxy
> for current_file in `tr '|' '-' < patchlist | lam -s "bp/" - -s ".gz"`
> do
> echo ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVERNAME}/${current_file} > /dev/null 2>&1
> done
794,796c833,837
< lam -s "f/" - -s ".gz" < filelist |
< xargs ${XARGST} ${PHTTPGET} ${SERVERNAME} \
< 2>${QUIETREDIR}
---
> # fetch metadata files using wget behind a proxy
> for current_file in `lam -s "f/" - -s ".gz" < filelist`
> do
> ${PHTTPGET} ${PHTTPGET_OPTS} ${SERVERNAME}/${current_file} > /dev/null 2>&1
> done
997a1039,1079
> # check that the downloader program is set into the variable PHTTPGET
> # and that is executable (in the case of wget(1) it must be available on
> # the system.
> #
> # In the case the downloader program is not usable the program will be aborted
> # with the following exit codes:
> # 99 = PHTTPGET internal variable not set
> # 98 = program does not exist
> # 97 = program is not executable
> #
> #
> check_downloader(){
> should_exit=0
>
> if [ -z "${PHTTPGET}" ]
> then
> echo "The downloader program is not set into the PHTTPGET variable!"
> should_exit=99
> else
> if [ ! -f "${PHTTPGET}" ]
> then
> echo "The downloader program $PHTTPGET does not exists!"
> echo "See here: " `whereis "$PHTTPGET"`
> should_exit=98
> else
> if [ ! -x "${PHTTPGET}" ]
> then
> echo "The downloader program $PHTTPGET is not executable!"
> should_exit=97
> fi
> fi
> fi
>
> if [ $should_exit -gt 0 ]
> then
> echo "portsnap cannot continue, sorry"
> exit $should_exit
> fi
> }
>
>
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKoxK%2B4KsdMRj2YYPGvSFZTiuQXOeP2%2B9ArkC2gCLVb5DFCb1g>
