Add an example about how to run hooks
[ext/instance-debootstrap.git] / import
diff --git a/import b/import
index d89fb17..2d9b58e 100755 (executable)
--- a/import
+++ b/import
@@ -21,10 +21,6 @@ set -e
 
 . common.sh
 
-CLEANUP=( )
-
-trap cleanup EXIT
-
 # If the target device is not a real block device we'll first losetup it.
 # This is needed for file disks.
 if [ ! -b $blockdev ]; then
@@ -46,11 +42,11 @@ else
 fi
 
 mke2fs -Fjq $filesystem_dev
-root_uuid=$($VOL_ID -u $filesystem_dev )
+root_uuid=$($VOL_ID $filesystem_dev )
 
 if [ -n "$swapdev" ]; then
   mkswap $swapdev
-  swap_uuid=$($VOL_ID -u $swapdev || true )
+  swap_uuid=$($VOL_ID $swapdev || true )
 fi
 
 TMPDIR=`mktemp -d` || exit 1
@@ -65,7 +61,7 @@ rm -f $TMPDIR/etc/udev/rules.d/z*_persistent-net.rules
 # Fix /etc/fstab with the new volumes' UUIDs
 if [ -e $TMPDIR/etc/fstab ]; then
   ROOT_LINE="UUID=$root_uuid  /     ext3  defaults  0  1"
-  if [ -n "$swapdev" ]; then
+  if [ -n "$swapdev" -a -n "$swap_uuid" ]; then
     SWAP_LINE="UUID=$swap_uuid  swap  swap  defaults  0  0"
     cat $TMPDIR/etc/fstab | \
       sed -re "s#^(/dev/sda|UUID=[a-f0-9-]+)\s+/\s+.*\$#$ROOT_LINE#" \