handle swap partitions better during import/export
[ext/instance-debootstrap.git] / import
diff --git a/import b/import
index 2d9b58e..da482ba 100755 (executable)
--- a/import
+++ b/import
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # Copyright (C) 2007, 2008, 2009 Google Inc.
+# Portions Copyright 2013 Equinox Software, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,6 +30,14 @@ if [ ! -b $blockdev ]; then
   CLEANUP+=("losetup -d $blockdev")
 fi
 
+# First line in the dump contains the partion and/or 
+# filesystem type.
+read -r export_type
+if [ "$export_type" = "swap" ]; then
+  mkswap -f $blockdev
+  exit 0
+fi
+
 if [ "$PARTITION_STYLE" = "none" ]; then
   filesystem_dev=$blockdev
 elif [ "$PARTITION_STYLE" = "msdos" ]; then