Changes the export file format so that the first
line indicates whether the device being exported or
imported is a swap device or an ext* filesystem.
If it's a swap device, it's just recreated on import;
there's no reason to retain its contents.
WARNING: This makes previous gnt-backup filesystem exports
incompatible unless they are modified so that their first
line contains "ext3" or "ext4".
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
CLEANUP+=("losetup -d $blockdev")
fi
+# There's no reason to try to export a swap device's
+# contents, we just want to recreate it.
+if vol_type=$($VOL_TYPE $blockdev); then
+ if [ "$vol_type" = "swap" ]; then
+ echo swap
+ exit 0
+ fi
+fi
+
if [ "$PARTITION_STYLE" = "none" ]; then
filesystem_dev=$blockdev
elif [ "$PARTITION_STYLE" = "msdos" ]; then
vol_type=$($VOL_TYPE $filesystem_dev)
if [ "${vol_type:0:3}" = "ext" ]; then
+ echo $vol_type
dump -0 -q -f - "$filesystem_dev"
else
echo "Can't dump partition of type ${vol_type}!" >&2
#!/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
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