Fix small bugs in func_download_pkgs

- If MISSING_FILES.DMP is left from a preceding attempt, it may
generate a false warning a bout missing files even if they could
all be downloaded.
- do not try to copy a modified file to SRC_ARCHIVE if it already
exists: it may belong to another user...
This commit is contained in:
Pierre Labastie 2022-04-01 10:18:15 +02:00
parent a2917edfa2
commit 8c2b505caf

View file

@ -3,6 +3,10 @@
#----------------------------#
get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
#----------------------------#
# Test if the packages must be downloaded
[ ! "$GETPKG" = "y" ] && return
local saveIFS=$IFS
local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE WGETPARAM
@ -13,9 +17,6 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
WGETPARAM+=" --tries ${RETRYDOWNLOADCNT}"
WGETPARAM+=" --timeout ${DOWNLOADTIMEOUT}"
# Test if the packages must be downloaded
[ ! "$GETPKG" = "y" ] && return
gs_wrt_message(){
echo "${RED}$1${OFF}"
echo "$1" >> MISSING_FILES.DMP
@ -27,6 +28,9 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
# Generate URLs file
create_urls
# Clean up leftovers from preceding attempts
>MISSING_FILES.DMP
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
for line in `cat urls.lst`; do
IFS=$saveIFS # Restore the system defaults
@ -110,6 +114,7 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -w ${SRC_ARCHIVE} ] &&
[ ! -f ${SRC_ARCHIVE}/$FILE ] &&
[ "$fromARCHIVE" = "0" ] ; then
echo "Storing file:<$FILE> in the package archive"
cp -f $FILE ${SRC_ARCHIVE}