--purge-old=0 \
--index \
--cookies=1 \
- --path ${target}"
+ --path ${TARGET}"
}
# Download URLs, mirror mode
local url="$1"
local hash="`echo $1 | sha1sum | cut -d ' ' -f 1`"
- # Set target
- target="$MIRRORS/$hash"
-
- # Make sure that target exists
- mkdir -p $target
+ # Set target and make sure it exists
+ TARGET="$MIRRORS/$hash"
+ mkdir -p $TARGET
# We already got this one
- if [ -f "$target/ok" ]; then
+ if [ -f "$TARGET/ok" ]; then
return
fi
# Fix permissions
if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then
- chown -R $USER.$GROUP $target/
+ chown -R $USER.$GROUP $TARGET/
fi
# Get each URL
if [ "$?" == "0" ]; then
# Mark as downloaded
- touch $target/ok
+ touch $TARGET/ok
else
echo "Error fetching $url."
- rm -rf $target
+ rm -rf $TARGET
fi
}
# Download URLs, incremental mode
function httracker_get_incremental {
- # Create target dir
+ # Create TARGET dir
year=`date +%Y`
month=`date +%m`
day=`date +%d`
- target=${MIRRORDIR}/${year}/${month}
- sudo -u ${USER} mkdir -p ${target}
+ TARGET=${MIRRORDIR}/${year}/${month}
+ sudo -u ${USER} mkdir -p ${TARGET}
# Basic options
httracker_opts