Support multiple files in one command line
This commit is contained in:
parent
053d79d158
commit
e16d3ea4ca
|
@ -5,8 +5,8 @@
|
||||||
# extra utility script - if a file does not exist in our mirror and
|
# extra utility script - if a file does not exist in our mirror and
|
||||||
# we've been told to use an http mirror, go grab it from there
|
# we've been told to use an http mirror, go grab it from there
|
||||||
#
|
#
|
||||||
# Takes 1 parameters: the the full path to the file (relative to the
|
# Takes <n> parameters: the full path to the files required (relative
|
||||||
# base dir of the mirror)
|
# to the base dir of the mirror)
|
||||||
#
|
#
|
||||||
# The MIRROR env var must be set
|
# The MIRROR env var must be set
|
||||||
# If we want to be able to download, HTTPMIRROR mus be set too
|
# If we want to be able to download, HTTPMIRROR mus be set too
|
||||||
|
@ -14,25 +14,21 @@
|
||||||
set -e
|
set -e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
WANTED=$1
|
|
||||||
|
|
||||||
if [ "$MIRROR"x = ""x ] ; then
|
if [ "$MIRROR"x = ""x ] ; then
|
||||||
echo $0: MIRROR not set
|
echo $0: MIRROR not set
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$MIRROR/$WANTED" ] ; then
|
for WANTED in $@; do
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# else
|
if [ ! -e "$MIRROR/$WANTED" ] ; then
|
||||||
|
DIR=$(dirname "$WANTED")
|
||||||
DIR=$(dirname "$WANTED")
|
mkdir -p "$MIRROR/$DIR"
|
||||||
mkdir -p "$MIRROR/$DIR"
|
wget -o /tmp/log "$HTTPMIRROR/$WANTED" -O "$MIRROR/$WANTED"
|
||||||
wget -o /tmp/log "$HTTPMIRROR/$WANTED" -O "$MIRROR/$WANTED"
|
|
||||||
|
|
||||||
# Check that the file is non-zero in size
|
|
||||||
if [ -e "$MIRROR/$WANTED" ] && [ ! -s "$MIRROR/$WANTED" ] ; then
|
|
||||||
rm -f "$MIRROR/$WANTED"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Check that the file is non-zero in size
|
||||||
|
if [ -e "$MIRROR/$WANTED" ] && [ ! -s "$MIRROR/$WANTED" ] ; then
|
||||||
|
rm -f "$MIRROR/$WANTED"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue