I have attached a patch for jigdo-lite that makes it use fuseiso and 
fusermount to scan files in iso images directly, i f those programs can 
be found and an iso image is to be scanned.
Jigdo should suggest or recommend fuseiso if this patch is applied.
Subject: Scan iso images directly using fuseiso and fusermount, if available
Author: Arnold Metselaar <arnold.met...@gmail.com>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=138520
--- a/scripts/jigdo-lite
+++ b/scripts/jigdo-lite
@@ -61,6 +61,34 @@
 strNotEmpty() { test "x$1" != "x"; }
 #______________________________________________________________________
 
+# $jigdoFile: name of jigdo-file program, possibly with path
+# $image: image filename
+# $jigdoF: name of .jigdo file
+# $template: template filename
+# $hasFuseIso: 0 if fuseiso and fusermount are available, 1 otherwise
+# $1: file or directory to scan
+scanFile() {
+  tmpMnt="`dirname $template`/tmpMnt"
+  toScan="$1"
+  if test -f "$1" -a $hasFuseIso = 0 ; then
+    if fuseiso -p "$1" "$tmpMnt" 2>&1 >/dev/null; then
+      echo Scanning iso image...
+      toScan="$tmpMnt"
+    else
+      # apparently not an iso image
+      tmpMnt=""
+    fi
+  fi
+  $jigdoFile make-image --image="$image" --jigdo="$jigdoF" \
+      --template="$template" $jigdoOpts "$toScan"
+  result=$?
+  if strNotEmpty "$tmpMnt"; then
+    fusermount -u -q "$tmpMnt"
+  fi
+  return $result
+}
+#______________________________________________________________________
+
 # fetch <URL>...
 # Download a file, storing it in the current dir
 fetch() {
@@ -345,8 +373,7 @@
     if $batch; then return 0; fi
     # Retrieve template if necessary, then supply files
     fetchTemplate || return 1
-    $jigdoFile make-image --image="$image" --jigdo="$jigdoF" \
-      --template="$template" $jigdoOpts "$opt_filesToScan"
+    scanFile "$opt_filesToScan"
     jigdoErr="$?"
     if test "$jigdoErr" -eq 0 -a -r "$image"; then
       finished
@@ -367,8 +394,14 @@
     if $windows; then
     echo "again. Enter the path to the old CD ROM's contents (e.g. \`d:\\')."
     else
-    echo "again. Mount the old CD ROM and enter the path it is mounted under"
-    echo "(e.g. \`/mnt/cdrom')."
+      if test $hasFuseIso = 0 ; then
+        echo "again. If you still have the image of the old CD-ROM, enter the name"
+        echo "it is stored under, otherwise mount the old CD ROM and enter"
+        echo "the path it is mounted under (e.g. \`/mnt/cdrom')."
+      else
+        echo "again. Mount the old CD ROM and enter the path it is mounted under"
+        echo "(e.g. \`/mnt/cdrom')."
+      fi
     fi
     echo "Alternatively, just press enter if you want to start downloading"
     echo "the remaining files."
@@ -408,8 +441,7 @@
 
     # Retrieve template if necessary, then supply files
     fetchTemplate || return 1
-    $jigdoFile make-image --image="$image" --jigdo="$jigdoF" \
-      --template="$template" $jigdoOpts "$filesToScan"
+    scanFile  "$filesToScan"
     jigdoErr="$?"
     if test "$jigdoErr" -eq 0 -a -r "$image"; then
       finished
@@ -535,8 +567,7 @@
     # Retrieve template if necessary, then supply files. One of the
     # two variables $filesToScan and $opt_filesToScan is always empty
     fetchTemplate || return 1
-    $jigdoFile make-image --image="$image" --jigdo="$jigdoF" \
-      --template="$template" $jigdoOpts "$filesToScan$opt_filesToScan"
+    scanFile "$filesToScan$opt_filesToScan"
     jigdoErr="$?"
     if test "$jigdoErr" -eq 0 -a -r "$image"; then
       finished
@@ -648,6 +679,7 @@
   done
   finished
 }
+
 #======================================================================
 
 echo
@@ -676,6 +708,9 @@
         which "$prog" >/dev/null \
             || echo "Could not find program \`$prog' - please install it!"
     done
+    which fuseiso > /dev/null && which fusermount > /dev/null
+    hasFuseIso=$?
+    echo hasFuseIso: $hasFuseIso
 fi
 
 userAgent="jigdo-lite/`$jigdoFile --version 2>/dev/null | ($readLine jf v ver; echo $ver)` (`wget --version 2>/dev/null | ($readLine ver; echo $ver)`; $OSTYPE)"

Reply via email to