Normalize temporary working directory to not fail with relative directory path
authorMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 15:20:46 +0000 (17:20 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 15:22:46 +0000 (17:22 +0200)
When invoking "grml2is -t tmpdir ..." then the kernel and
initrd files receive a wrong leading directory path on the
resulting ISO, leading to a broken ISO. Since specifying
a relative path ("-t tmpdir" instead of "-t ${PWD}/tmpdir")
should be possible as well let's just normalize it.

grml2iso
grml2usb

index a2ef849..e84e267 100755 (executable)
--- a/grml2iso
+++ b/grml2iso
@@ -91,7 +91,7 @@ Options:
       r)   GRML2USB_OPTS+=(--remove-bootoption="$OPTARG");;
       p)   GRML2USB_OPTS+=("$OPTARG");;
       s)   URI="$OPTARG";;
       r)   GRML2USB_OPTS+=(--remove-bootoption="$OPTARG");;
       p)   GRML2USB_OPTS+=("$OPTARG");;
       s)   URI="$OPTARG";;
-      t)   WRKDIR="$OPTARG";;
+      t)   WRKDIR="$(readlink -f "$OPTARG")";;
       ?)   usage 2;;
     esac
   done
       ?)   usage 2;;
     esac
   done
index c696623..e2cffe8 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -1472,7 +1472,7 @@ def install(image, device):
         logging.info("Using %s as install base", image)
     else:
         logging.info("Using ISO %s", image)
         logging.info("Using %s as install base", image)
     else:
         logging.info("Using ISO %s", image)
-        iso_mountpoint = tempfile.mkdtemp(prefix="grml2usb", dir=options.tmpdir)
+        iso_mountpoint = tempfile.mkdtemp(prefix="grml2usb", dir=os.path.abspath(options.tmpdir))
         register_tmpfile(iso_mountpoint)
         remove_image_mountpoint = True
         try:
         register_tmpfile(iso_mountpoint)
         remove_image_mountpoint = True
         try: