aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-08-02 16:29:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-08-02 16:29:23 -0300
commit1a627790377ef0f75c53d20a7f7b31cb44306b41 (patch)
tree7703c74f7274cbec3bd4cf4c75a651342b4b02db
parente6afb5bcb9a73b4583386b3320e47d3025eb7930 (diff)
downloadhttruta-1a627790377ef0f75c53d20a7f7b31cb44306b41.tar.gz
httruta-1a627790377ef0f75c53d20a7f7b31cb44306b41.tar.bz2
Correctly check if URL was downloaded
-rw-r--r--lib/httracker/functions17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions
index 56db0f6..f43dae7 100644
--- a/lib/httracker/functions
+++ b/lib/httracker/functions
@@ -45,6 +45,9 @@ function httracker_get {
# Basic options
httracker_opts
+ # Log options
+ OPTS="$OPTS --file-log $LOG"
+
# Additional options
if [ "`whoami`" == "root" ]; then
OPTS="$OPTS --user $USER"
@@ -57,13 +60,7 @@ function httracker_get {
fi
# Get each URL
- httrack ${OPTS} ${url} | tee $LOG
-
- # Fix permissions again
- if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then
- echo "Fixing $TARGET permissions again..."
- chown -R $USER.$GROUP $TARGET/
- fi
+ httrack ${OPTS} ${url}
if [ "$?" == "0" ]; then
# Mark as downloaded
@@ -72,6 +69,12 @@ function httracker_get {
echo "Error fetching $url."
rm -rf $TARGET
fi
+
+ # Fix permissions again
+ if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then
+ echo "Fixing $TARGET permissions again..."
+ chown -R $USER.$GROUP $TARGET/
+ fi
}
# Download URLs, incremental mode