summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaio Begotti <caio1982@mandriva.org>2009-02-03 18:35:15 +0000
committerCaio Begotti <caio1982@mandriva.org>2009-02-03 18:35:15 +0000
commit4564477dfdaa1b8486216f81e615311b84dad0a4 (patch)
tree9330daaa1899d7205769e7c3c6b83a5d9d132f20
parent2896f6a30146f5a67ea2813929a8f49eeb951472 (diff)
downloaddrakx-backup-do-not-use-4564477dfdaa1b8486216f81e615311b84dad0a4.tar
drakx-backup-do-not-use-4564477dfdaa1b8486216f81e615311b84dad0a4.tar.gz
drakx-backup-do-not-use-4564477dfdaa1b8486216f81e615311b84dad0a4.tar.bz2
drakx-backup-do-not-use-4564477dfdaa1b8486216f81e615311b84dad0a4.tar.xz
drakx-backup-do-not-use-4564477dfdaa1b8486216f81e615311b84dad0a4.zip
making it work with compressed images as well, by skipping the start of the image dump when dumping it and getting only its partition without needing the losetup hack
-rwxr-xr-xrescue/restore-image.sh15
1 files changed, 6 insertions, 9 deletions
diff --git a/rescue/restore-image.sh b/rescue/restore-image.sh
index 2fc6e0348..b713a932b 100755
--- a/rescue/restore-image.sh
+++ b/rescue/restore-image.sh
@@ -181,7 +181,11 @@ ${number}
83
w
EOF
+ else
+ rm -f /tmp/fdisk.log
fi
+ else
+ rm -f /tmp/fdisk.log
fi
echo "${disk}${number}"
@@ -207,18 +211,11 @@ function write_image()
*) uncomp=cat ;;
esac
- if [ -s /tmp/fdisk.log -a ${uncomp} = "cat" ]; then
- input=/dev/loop5
- losetup ${input} $images_dir/$image -o 32256
- else
- input=$images_dir/$image
- fi
-
# the actual dumping command, from image to disk
- $uncomp ${input} | dd of=/dev/$root bs=4M > /tmp/backup.out 2>&1>>/tmp/log &
+ ${uncomp} ${images_dir}/${image} | (dd of=/dev/null bs=1 count=32256 &>/dev/null; dd bs=4M of=/dev/${root} >/tmp/backup.out) &
sleep 3
- pid=$(ps ax | grep 'dd of' | grep -v grep | awk '{ print $1 }')
+ pid=$(ps ax | grep 'dd bs=4M of' | grep -v grep | awk '{ print $1 }')
total=1000
while [ true ]; do