aboutsummaryrefslogtreecommitdiff
path: root/lib/httracker/functions
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-25 23:26:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-25 23:26:23 -0300
commitf4243f4f2c6a97b7f226283d22d37c9a8a6266ea (patch)
tree00904758022b3ee2e0558ff2bcad4bc8d936a236 /lib/httracker/functions
parent5facaa065ba86bfdf6c540d039f908804757544e (diff)
downloadhttruta-f4243f4f2c6a97b7f226283d22d37c9a8a6266ea.tar.gz
httruta-f4243f4f2c6a97b7f226283d22d37c9a8a6266ea.tar.bz2
Fixing variable name
Diffstat (limited to 'lib/httracker/functions')
-rw-r--r--lib/httracker/functions24
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