From: Guido Trotter Date: Wed, 22 Oct 2008 14:09:28 +0000 (+0000) Subject: instance debootstrap: enable export X-Git-Tag: v0.6~7 X-Git-Url: http://git.equinoxoli.org/?p=ext%2Finstance-debootstrap.git;a=commitdiff_plain;h=1c7f28c8841515a7908702fc8b1e7010c40e6e8d instance debootstrap: enable export Avoid exporting swap devices Reviewed-by: iustinp --- diff --git a/common.sh b/common.sh index 5595bb7..6241937 100644 --- a/common.sh +++ b/common.sh @@ -61,7 +61,14 @@ get_api10_arguments() { log_error "At least one disk is needed" exit 1 fi - blockdev=$DISK_0_PATH + if [ "$SCRIPT_NAME" = "export" ]; then + if [ -z "$EXPORT_DEVICE" ]; then + log_error "Missing OS API Variable EXPORT_DEVICE" + fi + blockdev=$EXPORT_DEVICE + else + blockdev=$DISK_0_PATH + fi if [ "$SCRIPT_NAME" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then log_error "Missing OS API Variable OLD_INSTANCE_NAME" fi @@ -73,8 +80,8 @@ if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then get_api5_arguments elif [ "$OS_API_VERSION" = "10" ]; then get_api10_arguments - if [ $SCRIPT_NAME = "import" -o $SCRIPT_NAME = "export" ]; then - log_error "import/export still not compatible with API version 10" + if [ $SCRIPT_NAME = "import" ]; then + log_error "import still not compatible with API version 10" exit 1 fi else diff --git a/export b/export index ff1b3c1..fea95de 100755 --- a/export +++ b/export @@ -21,4 +21,9 @@ set -e . common.sh -dump -0 -q -f - "$blockdev" +vol_type=$($VOL_ID -t $blockdev) + +if [ "$vol_type" = "ext3" -o "$vol_type" = "ext2" ]; then + dump -0 -q -f - "$blockdev" +fi +