From 4564477dfdaa1b8486216f81e615311b84dad0a4 Mon Sep 17 00:00:00 2001 From: Caio Begotti Date: Tue, 3 Feb 2009 18:35:15 +0000 Subject: 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 --- rescue/restore-image.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'rescue/restore-image.sh') 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 -- cgit v1.2.1