[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 2 of 2] build: hd Image nicht hin und her Kopieren
- Date: Fri, 13 Aug 2010 15:08:29 +0200
- From: Andreas Freimuth <m.nemo@xxxxxxx>
- To: tyndur-devel@xxxxxxxxxx
- Subject: [tyndur-devel] [PATCH 2 of 2] build: hd Image nicht hin und her Kopieren
- Message-id: <6ca2b56d8d9139d0af0d.1281704909@laptop>
- In-reply-to: <patchbomb.1281704907@laptop>
* statt das hd-Image mit dd hin und her zu kopieren loop-devices
verwenden
Signed-off-by: MNemo <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`
- build/scripts/empty_file $PART_IMAGE $(($PART_SIZE * 512))
+ 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