summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Affonso Xavier de Morais2014-07-10 15:30:54 +0200
committerMichael Pereira Neves2014-10-28 14:14:49 +0100
commit204407a78146bf002f86b5002764201619d929db (patch)
tree87808ebdafb6a4c564b2f665faaa3d60ea07a0a1
parent[partitioner] added support to GTP and other few improvements. (diff)
downloadtm-scripts-204407a78146bf002f86b5002764201619d929db.tar.gz
tm-scripts-204407a78146bf002f86b5002764201619d929db.tar.xz
tm-scripts-204407a78146bf002f86b5002764201619d929db.zip
[partitioner] using extended partitions
-rwxr-xr-xremote/modules/partitioner/dialog.sh38
-rwxr-xr-xremote/modules/partitioner/partitioner.sh16
-rw-r--r--remote/modules/partitioner/partitions17
3 files changed, 8 insertions, 63 deletions
diff --git a/remote/modules/partitioner/dialog.sh b/remote/modules/partitioner/dialog.sh
deleted file mode 100755
index 45b122c5..00000000
--- a/remote/modules/partitioner/dialog.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-PARTITIONSPATH="/proc/partitions"
-CONFIGPATH="./config"
-DEFPARTSIZE=5 #in GB
-DEFSCRATCHID=44
-DEFHOMEID=45
-DEFDNBD3ID=46
-DEFBOOTID=47
-
-. $CONFIGPATH
-# picking disk that will be used
-test $CHOSENDISK
-if [ $? -eq 1 ]; then
- DISKS=$(cat $PARTITIONSPATH | tr -s ' ' | cut -d ' ' -f5 | grep -e "[a-z]$")
- STR="This computer has the following partitions:\n"
- for disk in $DISKS; do
- DISKSIZE=$(cat $PARTITIONSPATH | grep -e $disk$ | tr -s ' ' | cut -d ' ' -f4)
- PARTS=$(cat $PARTITIONSPATH | grep -e $disk[0-9] | tr -s ' ' | cut -d ' ' -f5)
- GBSIZE=$(echo "scale=2; $DISKSIZE/1024/1024" | bc -l)
- STR=$STR"$disk $DISKSIZE Bytes ($GBSIZE GB)\n"
- USED=0
- for PART in $PARTS; do
- PARTSIZE=$(cat $PARTITIONSPATH | grep -e $PART$ | tr -s ' ' | cut -d ' ' -f4)
- USED=$(($USED+$PARTSIZE))
- GBSIZE=$(echo "scale=2; $PARTSIZE/1024/1024" | bc -l)
- STR=$STR" $PART $PARTSIZE ($GBSIZE GB)\n"
- done
- STR=$STR" ----------\n"
- FREESPACE=$(($DISKSIZE-$USED))
- GBSIZE=$(echo "scale=2; $USED/1024/1024" | bc -l)
- STR=$STR" Used $USED ($GBSIZE GB)\n"
- GBSIZE=$(echo "scale=2; $FREESPACE/1024/1024" | bc -l)
- STR=$STR" Free $FREESPACE ($GBSIZE GB)\n\n"
- done
-fi
-# echo $STR
-CHOSENDISK=$(dialog --no-collapse --cr-wrap --inputbox "$STR" 0 0 $(echo $DISKS | cut -f1) 3>&1 1>&2 2>&3)
diff --git a/remote/modules/partitioner/partitioner.sh b/remote/modules/partitioner/partitioner.sh
index 19d594a1..122eabd6 100755
--- a/remote/modules/partitioner/partitioner.sh
+++ b/remote/modules/partitioner/partitioner.sh
@@ -169,7 +169,6 @@ fi
SECTORSIZE=512
# delete partition table
-echo "apaga"
sgdisk -Z /dev/$CHOSENDISK > /dev/null 2> /dev/null
# constructing the sfdisk input file
@@ -183,21 +182,22 @@ START3=$(($START2+$SIZE2))
SIZE3=$(($DNBD3SIZE/$SECTORSIZE))
START4=$(($START3+$SIZE3))
-SIZE4=$(($BOOTSIZE/$SECTORSIZE))
-echo "cria sfdisk"
+START5=$(($START4+$START1))
+SIZE5=$(($BOOTSIZE/$SECTORSIZE))
+
echo "unit: sectors
/dev/"$CHOSENDISK"1 : start= "$START1", size= "$SIZE1", Id= "$SCRATCHID"
/dev/"$CHOSENDISK"2 : start= "$START2", size= "$SIZE2", Id= "$HOMEID"
/dev/"$CHOSENDISK"3 : start= "$START3", size= "$SIZE3", Id= "$DNBD3ID"
-/dev/"$CHOSENDISK"4 : start= "$START4", size= "$SIZE4", Id= "$BOOTID," bootable
- "> /tmp/emptydisk.tmp
-sfdisk -q -f /dev/$CHOSENDISK < /tmp/emptydisk.tmp > /dev/null
-rm -f /tmp/emptydisk.tmp
+/dev/"$CHOSENDISK"4 : start= "$START4", size= "$(($DISKSIZE/512-1))", Id= 5
+/dev/"$CHOSENDISK"4 : start= "$START5", size= "$SIZE5", Id= "$BOOTID", bootable
+ "> /tmp/partitiontable.tmp
+sfdisk -q -f /dev/$CHOSENDISK < /tmp/partitiontable.tmp > /dev/null
+rm -f /tmp/partitiontable.tmp
if [ $PARTITIONTYPE = GPT ]; then
- echo "converte e aplica GUID"
sgdisk -g /dev/$CHOSENDISK\
-t 1:"$SCRATCHID"000000-0000-0000-0000-000000000000\
-t 2:"$HOMEID"000000-0000-0000-0000-000000000000\
diff --git a/remote/modules/partitioner/partitions b/remote/modules/partitioner/partitions
deleted file mode 100644
index 8ec007ff..00000000
--- a/remote/modules/partitioner/partitions
+++ /dev/null
@@ -1,17 +0,0 @@
-major minor #blocks name
-
- 8 0 488386584 sda
- 8 1 1 sda1
- 8 2 27343872 sda2
- 8 3 45898437 sda3
- 8 4 52928512 sda4
- 8 5 345713664 sda5
- 8 6 8226816 sda6
- 11 0 1048575 sr0
- 8 0 386584 sdb
- 8 1 1 sdb1
- 8 2 343872 sdb2
- 8 3 45898437 sdb3
- 8 0 1838584 vda
- 8 1 1 vda1
- 8 2 27343872 vda2 \ No newline at end of file