]> gitweb.fluxo.info Git - httruta.git/commitdiff
Correctly check if URL was downloaded
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Aug 2015 19:29:23 +0000 (16:29 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Aug 2015 19:29:23 +0000 (16:29 -0300)
lib/httracker/functions

index 56db0f62adcfbe489636a40c1c1cbe13856cb2c1..f43dae7099d1d6dbb488a5e270e7e51576ea9bd7 100644 (file)
@@ -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