summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Affonso Xavier de Morais2014-09-04 15:33:05 +0200
committerMichael Pereira Neves2014-10-28 14:14:50 +0100
commit8a4371379854de23034d67c3dfc835f6c70d0937 (patch)
tree7cc009e7050fd73e451a473f8a86043445ab51c1
parent[setup_partitions] reworked setup partitions script, testing needed (diff)
downloadtm-scripts-8a4371379854de23034d67c3dfc835f6c70d0937.tar.gz
tm-scripts-8a4371379854de23034d67c3dfc835f6c70d0937.tar.xz
tm-scripts-8a4371379854de23034d67c3dfc835f6c70d0937.zip
[partitioner] changed the way GPT partitions are created.
-rwxr-xr-xserver/modules/partitioner/opt/openslx/scripts/partitioner56
1 files changed, 29 insertions, 27 deletions
diff --git a/server/modules/partitioner/opt/openslx/scripts/partitioner b/server/modules/partitioner/opt/openslx/scripts/partitioner
index 75ac7105..23e90b18 100755
--- a/server/modules/partitioner/opt/openslx/scripts/partitioner
+++ b/server/modules/partitioner/opt/openslx/scripts/partitioner
@@ -174,42 +174,21 @@ if [ $SLX_DELETE_PARTITION_TABLE = "yes" ]; then
# delete partition table
sgdisk -Z /dev/$SLX_CHOOSEN_DISK > /dev/null 2> /dev/null # erase all partitions
- # constructing the sfdisk input file
- echo "unit: sectors
- "> /tmp/partitiontable.tmp
-
- START=$((1*1024*1024/$SECTORSIZE))
- for (( i = 1; i < $COUNTER; i++ )); do
- if [ $i -ne 4 ]; then
- SIZE=$((${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024/$SECTORSIZE))
- ID=${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}
- if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/bootable"]} -eq 1 ]; then
- echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$SIZE", Id= "$ID", bootable " >> /tmp/partitiontable.tmp
- else
- echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$SIZE", Id= "$ID >> /tmp/partitiontable.tmp
- fi
- START=$(($START+$SIZE+1*1024*1024/$SECTORSIZE))
- else
- echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$(($DISKSIZE/$SECTORSIZE-1))", Id= 5" >> /tmp/partitiontable.tmp
- START=$(($START+1*1024*1024/$SECTORSIZE))
- fi
- done
- sfdisk -q -f /dev/$SLX_CHOOSEN_DISK < /tmp/partitiontable.tmp > /dev/null 2> /dev/null
- # rm -f /tmp/partitiontable.tmp
- #------
if [ $SLX_PARTITION_TYPE = 'GPT' ]; then
- # create the command (CMD) that will convert the MSDOS type to GPT, change the unique GUIDs and set the bootable flags.
DIALOGSTR="Creating Partitions...\n\n"
echo "0" | dialog --gauge "$DIALOGSTR" 0 0 0
- sgdisk /dev/$SLX_CHOOSEN_DISK -g >/dev/null 2>/dev/null
- for (( i = 1; i < $COUNTER; i++ )); do
+ for (( i = 1; i < $COUNTER; i++ )); do # loop that will create each GPT partition, change GUIDS, change names, and set bootable flags.
if [ $i -ne 4 ]; then
+ sgdisk /dev/$SLX_CHOOSEN_DISK -n $i:0:+${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}G 2> /dev/null > /dev/null
# dialog --msgbox "$DIALOGSTR" 0 0
- if [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" != "82" ] && [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" != "83" ]; then
+ if [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "82" ] || [ "${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}" = "83" ]; then
+ sgdisk /dev/$SLX_CHOOSEN_DISK -t $i:${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}00
+ else
sgdisk /dev/$SLX_CHOOSEN_DISK -t $i:${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}000000-0000-0000-0000-000000000000\
sgdisk /dev/$SLX_CHOOSEN_DISK -c $i:\"${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]}\" >/dev/null 2>/dev/null
fi
if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/bootable"]} -eq 1 ]; then
+ # set the bootable flag
sgdisk /dev/$SLX_CHOOSEN_DISK -A $i:set:2 >/dev/null 2>/dev/null
fi
SIZE=$((${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024))
@@ -228,6 +207,29 @@ if [ $SLX_DELETE_PARTITION_TABLE = "yes" ]; then
fi
done
else
+ # constructing the sfdisk input file
+ echo "unit: sectors
+ "> /tmp/partitiontable.tmp
+
+ START=$((1*1024*1024/$SECTORSIZE))
+ for (( i = 1; i < $COUNTER; i++ )); do
+ if [ $i -ne 4 ]; then
+ SIZE=$((${PARTTBL["$SLX_CHOOSEN_DISK$i/size"]}*1024*1024*1024/$SECTORSIZE))
+ ID=${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}
+ if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/bootable"]} -eq 1 ]; then
+ echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$SIZE", Id= "$ID", bootable " >> /tmp/partitiontable.tmp
+ else
+ echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$SIZE", Id= "$ID >> /tmp/partitiontable.tmp
+ fi
+ START=$(($START+$SIZE+1*1024*1024/$SECTORSIZE))
+ else
+ echo "/dev/"$SLX_CHOOSEN_DISK$i" : start= "$START", size= "$(($DISKSIZE/$SECTORSIZE-1))", Id= 5" >> /tmp/partitiontable.tmp
+ START=$(($START+1*1024*1024/$SECTORSIZE))
+ fi
+ done
+ sfdisk -q -f /dev/$SLX_CHOOSEN_DISK < /tmp/partitiontable.tmp > /dev/null 2> /dev/null
+ # rm -f /tmp/partitiontable.tmp
+
DIALOGSTR="Creating Partitions...\n\n"
for (( i = 1; i < $COUNTER; i++ )); do
if [ $i -lt 4 ]; then