[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 2 of 2 v3] build: hd Image nicht hin und her Kopieren
- Date: Sun, 15 Aug 2010 21:13:34 +0200
- From: Andreas Freimuth <m.nemo@xxxxxxx>
- To: tyndur-devel@xxxxxxxxxx
- Subject: [tyndur-devel] [PATCH 2 of 2 v3] build: hd Image nicht hin und her Kopieren
- Message-id: <97379f786d5d40a26453.1281899614@laptop>
- In-reply-to: <patchbomb.1281899612@laptop>
* statt das hd-Image mit dd hin und her zu kopieren loop-devices
verwenden
Signed-off-by: Andreas Freimuth <m.nemo@xxxxxxx>
---
build/scripts/image_hd | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/build/scripts/image_hd b/build/scripts/image_hd
--- a/build/scripts/image_hd
+++ b/build/scripts/image_hd
@@ -69,14 +69,15 @@ PART_START=`echo $PARTITIONS | awk '{pri
PART_SIZE=`echo $PARTITIONS | awk '{print $2}'`
if [ $NEW -ne 0 ]; then
- PART_IMAGE=`mktemp`
- dd of=$PART_IMAGE bs=512 seek=$PART_SIZE count=0
+ LOOP_DEV=`$SUDO losetup -f $IMAGE_PATH --sizelimit $(($PART_SIZE * 512)) -o $(($PART_START * 512)) --show`
+ if [ $? -ne 0 ]; then
+ die "Loop Device konnte nicht angelegt werden"
+ fi
# Dateisystem erstellen
- $LOST_TOOLS_MKE2FS -F -q $PART_IMAGE || die "Dateisystem konnte nicht erstellt werden"
+ $SUDO $LOST_TOOLS_MKE2FS -T ext2 -F -q $LOOP_DEV || die "Dateisystem konnte nicht erstellt werden"
- dd if=$PART_IMAGE of=$IMAGE_PATH bs=512 seek=$PART_START count=$PART_SIZE
- rm $PART_IMAGE
+ $SUDO losetup -d $LOOP_DEV
fi
# Partition mounten