diff options
| -rw-r--r-- | lib/httracker/functions | 24 | 
1 files changed, 11 insertions, 13 deletions
| diff --git a/lib/httracker/functions b/lib/httracker/functions index dcc8f4b..6d83b08 100644 --- a/lib/httracker/functions +++ b/lib/httracker/functions @@ -13,7 +13,7 @@ function httracker_opts {           --purge-old=0            \           --index                  \           --cookies=1              \ -         --path ${target}" +         --path ${TARGET}"  }  # Download URLs, mirror mode @@ -22,14 +22,12 @@ function httracker_get {    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 @@ -43,7 +41,7 @@ function httracker_get {    # Fix permissions    if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then -    chown -R $USER.$GROUP $target/ +    chown -R $USER.$GROUP $TARGET/    fi    # Get each URL @@ -51,21 +49,21 @@ function httracker_get {    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 | 
