pkgmk: add support for curl
See FS#1060, https://crux.nu/bugs/index.php?do=details&task_id=1060 New variables in /etc/pkgmk.conf: PKGMK_DOWNLOAD_PROG="" (curl or wget) PKGMK_CURL_OPTS="" (parameters for curl, when using curl)
This commit is contained in:
parent
bf4255e16b
commit
3d1855e7d2
@ -86,6 +86,9 @@ MD5 checksum of source files.
|
|||||||
.B "/etc/pkgmk.conf"
|
.B "/etc/pkgmk.conf"
|
||||||
Global package make configuration.
|
Global package make configuration.
|
||||||
.TP
|
.TP
|
||||||
|
.B "curl"
|
||||||
|
Used by pkgmk to download source code.
|
||||||
|
.TP
|
||||||
.B "wget"
|
.B "wget"
|
||||||
Used by pkgmk to download source code.
|
Used by pkgmk to download source code.
|
||||||
.SH EXIT CODES
|
.SH EXIT CODES
|
||||||
@ -120,7 +123,7 @@ An error occured while running the build function.
|
|||||||
.B 9
|
.B 9
|
||||||
An error occured while installing the package via pkgadd.
|
An error occured while installing the package via pkgadd.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
pkgmk.conf(5), pkgadd(8), pkgrm(8), pkginfo(8), rejmerge(8), wget(1)
|
pkgmk.conf(5), pkgadd(8), pkgrm(8), pkginfo(8), rejmerge(8), curl(1), wget(1)
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
pkgmk (pkgutils) is Copyright (c) 2000-2005 Per Liden and Copyright (c) 2006-2013 CRUX team (http://crux.nu).
|
pkgmk (pkgutils) is Copyright (c) 2000-2005 Per Liden and Copyright (c) 2006-2013 CRUX team (http://crux.nu).
|
||||||
pkgmk (pkgutils) is licensed through the GNU General Public License.
|
pkgmk (pkgutils) is licensed through the GNU General Public License.
|
||||||
|
@ -30,6 +30,7 @@ esac
|
|||||||
# PKGMK_IGNORE_FOOTPRINT="no"
|
# PKGMK_IGNORE_FOOTPRINT="no"
|
||||||
# PKGMK_IGNORE_NEW="no"
|
# PKGMK_IGNORE_NEW="no"
|
||||||
# PKGMK_NO_STRIP="no"
|
# PKGMK_NO_STRIP="no"
|
||||||
|
# PKGMK_DOWNLOAD_PROG="wget"
|
||||||
# PKGMK_WGET_OPTS=""
|
# PKGMK_WGET_OPTS=""
|
||||||
# PKGMK_COMPRESSION_MODE="gz"
|
# PKGMK_COMPRESSION_MODE="gz"
|
||||||
|
|
||||||
|
@ -44,6 +44,16 @@ Set directory for building packages.
|
|||||||
.br
|
.br
|
||||||
Default: '\fBfoo\fP/work', where \fBfoo\fP is the directory of the Pkgfile.
|
Default: '\fBfoo\fP/work', where \fBfoo\fP is the directory of the Pkgfile.
|
||||||
.TP
|
.TP
|
||||||
|
\fBPKGMK_DOWNLOAD_PROG='STRING'\fP
|
||||||
|
Use specified program to download source archives. Valid strings are curl and wget.
|
||||||
|
.br
|
||||||
|
Default: 'wget'
|
||||||
|
.br
|
||||||
|
.TP
|
||||||
|
\fBPKGMK_CURL_OPTS='STRING'\fP
|
||||||
|
Additional options for curl(1), which is used by pkgmk to download all files.
|
||||||
|
.br
|
||||||
|
.TP
|
||||||
\fBPKGMK_WGET_OPTS='STRING'\fP
|
\fBPKGMK_WGET_OPTS='STRING'\fP
|
||||||
Additional options for wget(1), which is used by pkgmk to download all files.
|
Additional options for wget(1), which is used by pkgmk to download all files.
|
||||||
.br
|
.br
|
||||||
|
34
pkgmk.in
34
pkgmk.in
@ -97,20 +97,32 @@ check_file() {
|
|||||||
download_file() {
|
download_file() {
|
||||||
info "Downloading '$1'."
|
info "Downloading '$1'."
|
||||||
|
|
||||||
if [ ! "`type -p wget`" ]; then
|
PKGMK_DOWNLOAD_PROG=${PKGMK_DOWNLOAD_PROG:-wget}
|
||||||
error "Command 'wget' not found."
|
if [ ! "`type -p ${PKGMK_DOWNLOAD_PROG}`" ]; then
|
||||||
|
error "Command '${PKGMK_DOWNLOAD_PROG}' not found."
|
||||||
exit $E_GENERAL
|
exit $E_GENERAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOCAL_FILENAME=`get_filename $1`
|
LOCAL_FILENAME=`get_filename $1`
|
||||||
LOCAL_FILENAME_PARTIAL="$LOCAL_FILENAME.partial"
|
LOCAL_FILENAME_PARTIAL="$LOCAL_FILENAME.partial"
|
||||||
DOWNLOAD_OPTS="--passive-ftp --no-directories --tries=3 --waitretry=3 \
|
|
||||||
--directory-prefix=$PKGMK_SOURCE_DIR \
|
case ${PKGMK_DOWNLOAD_PROG} in
|
||||||
--output-document=$LOCAL_FILENAME_PARTIAL --no-check-certificate"
|
curl)
|
||||||
|
RESUME_CMD="-C -"
|
||||||
|
DOWNLOAD_OPTS="-L --fail --ftp-pasv --retry 3 --retry-delay 3 \
|
||||||
|
-o $LOCAL_FILENAME_PARTIAL --insecure $PKGMK_CURL_OPTS"
|
||||||
|
;;
|
||||||
|
wget)
|
||||||
|
RESUME_CMD="-c"
|
||||||
|
DOWNLOAD_OPTS="--passive-ftp --no-directories --tries=3 --waitretry=3 \
|
||||||
|
--directory-prefix=$PKGMK_SOURCE_DIR \
|
||||||
|
--output-document=$LOCAL_FILENAME_PARTIAL --no-check-certificate $PKGMK_WGET_OPTS"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -f "$LOCAL_FILENAME_PARTIAL" ]; then
|
if [ -f "$LOCAL_FILENAME_PARTIAL" ]; then
|
||||||
info "Partial download found, trying to resume"
|
info "Partial download found, trying to resume"
|
||||||
RESUME_CMD="-c"
|
RESUME_OPTS="$RESUME_CMD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
error=1
|
error=1
|
||||||
@ -118,7 +130,7 @@ download_file() {
|
|||||||
BASENAME=`get_basename $1`
|
BASENAME=`get_basename $1`
|
||||||
for REPO in ${PKGMK_SOURCE_MIRRORS[@]}; do
|
for REPO in ${PKGMK_SOURCE_MIRRORS[@]}; do
|
||||||
REPO="`echo $REPO | sed 's|/$||'`"
|
REPO="`echo $REPO | sed 's|/$||'`"
|
||||||
wget $RESUME_CMD $DOWNLOAD_OPTS $PKGMK_WGET_OPTS $REPO/$BASENAME
|
$PKGMK_DOWNLOAD_PROG $DOWNLOAD_OPTS $RESUME_OPTS $REPO/$BASENAME
|
||||||
error=$?
|
error=$?
|
||||||
if [ $error == 0 ]; then
|
if [ $error == 0 ]; then
|
||||||
break
|
break
|
||||||
@ -127,19 +139,19 @@ download_file() {
|
|||||||
|
|
||||||
if [ $error != 0 ]; then
|
if [ $error != 0 ]; then
|
||||||
while true; do
|
while true; do
|
||||||
wget $RESUME_CMD $DOWNLOAD_OPTS $PKGMK_WGET_OPTS $1
|
$PKGMK_DOWNLOAD_PROG $DOWNLOAD_OPTS $RESUME_OPTS $1
|
||||||
error=$?
|
error=$?
|
||||||
if [ $error != 0 ] && [ "$RESUME_CMD" ]; then
|
if [ $error != 0 ] && [ "$RESUME_OPTS" ]; then
|
||||||
info "Partial download failed, restarting"
|
info "Partial download failed, restarting"
|
||||||
rm -f "$LOCAL_FILENAME_PARTIAL"
|
rm -f "$LOCAL_FILENAME_PARTIAL"
|
||||||
RESUME_CMD=""
|
RESUME_OPTS=""
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $error != 0 ]; then
|
if [ $error != 0 -o ! -f "$LOCAL_FILENAME_PARTIAL" ]; then
|
||||||
error "Downloading '$1' failed."
|
error "Downloading '$1' failed."
|
||||||
exit $E_DOWNLOAD
|
exit $E_DOWNLOAD
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user