diff options
Diffstat (limited to 'remote/modules/partitioner/partitioner.sh')
-rwxr-xr-x | remote/modules/partitioner/partitioner.sh | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/remote/modules/partitioner/partitioner.sh b/remote/modules/partitioner/partitioner.sh index 05160630..5822851a 100755 --- a/remote/modules/partitioner/partitioner.sh +++ b/remote/modules/partitioner/partitioner.sh @@ -172,25 +172,29 @@ if [ $SLX_DELETE_PARTITION_TABLE = "yes" ]; then fi done sfdisk -q -f /dev/$SLX_CHOOSEN_DISK < /tmp/partitiontable.tmp > /dev/null - rm -f /tmp/partitiontable.tmp -# stopped here!!! -elif [ $(sfdisk -d /dev/$SLX_CHOOSEN_DISK | grep $SLX_CHOOSEN_DISK'1' | tr -s ' ' | cut -d ' ' -f7 | cut -d '=' -f2) = 'ee' ]; then + # rm -f /tmp/partitiontable.tmp +elif [ $(sfdisk -d /dev/$SLX_CHOOSEN_DISK 2> /dev/null | grep $SLX_CHOOSEN_DISK'1' | tr -s ' ' | cut -d ' ' -f7 | cut -d '=' -f2) = 'ee' ]; then + # finding existent partitions in GPT - for PART in $PARTS; do - for (( i = 1; i < $(($COUNTER-1)); i++ )); do - if [ $i -ne 4 ]; then - if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/exists?"]} -ne 1 ]; then - sgdisk /dev/$SLX_CHOOSEN_DISK -i $i | grep "unique GUID" | cut -d ' ' -f4 | grep '${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}000000-0000-0000-0000-000000000000' - if [ $? -eq 0 ]; then - echo "the partition $PART is the ${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]} partition." - PARTTBL["$SLX_CHOOSEN_DISK$COUNTER/exists?"]=1 - break; - fi - fi + echo 'GPT' + PARTS=$(cat $PARTITIONSPATH | grep -e $SLX_CHOOSEN_DISK[0-9] | tr -s ' ' | cut -d ' ' -f5) # this line fix the empty PARTS error, continue from here + echo $PARTS + for PART in $PARTS; do + for (( i = 1; i < $(($COUNTER-1)); i++ )); do + if [ $i -ne 4 ]; then + if [ ${PARTTBL["$SLX_CHOOSEN_DISK$i/exists?"]} -ne 1 ]; then + echo "sgdisk /dev/$SLX_CHOOSEN_DISK -i $i | grep \"unique GUID\" | cut -d ' ' -f4 | grep '${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}000000-0000-0000-0000-000000000000'" + sgdisk /dev/$SLX_CHOOSEN_DISK -i $i | grep "unique GUID" | cut -d ' ' -f4 | grep '${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}000000-0000-0000-0000-000000000000' + if [ $? -eq 0 ]; then + echo "the partition $PART is the ${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]} partition." + PARTTBL["$SLX_CHOOSEN_DISK$COUNTER/exists?"]=1 + echo 'boa tarde1' fi - i=$(($i+1)) - done - done + fi + fi + i=$(($i+1)) + done + done else # finding existent partitions in MS-DOS for PART in $PARTS; do @@ -208,12 +212,18 @@ else fi DIALOGSTR="New partitions created:\n\n" -if [ $SLX_PARTITION_TYPE = GPT ]; then - sgdisk -g /dev/$SLX_CHOOSEN_DISK\ - -t 1:"$SCRATCHID"000000-0000-0000-0000-000000000000\ - -t 2:"$HOMEID"000000-0000-0000-0000-000000000000\ - -t 3:"$DNBD3ID"000000-0000-0000-0000-000000000000\ - -t 4:"$BOOTID"000000-0000-0000-0000-000000000000 > /dev/null +echo "SLX_PARTITION_TYPE = "$SLX_PARTITION_TYPE +if [ $SLX_PARTITION_TYPE = 'GPT' ]; then + # create the command that will convert the MSDOS type to GPT and change the unique GUIDs + CMD="sgdisk -g /dev/$SLX_CHOOSEN_DISK" + for (( i = 1; i < $COUNTER; i++ )); do + if [ $i -ne 4 ]; then + CMD=$CMD" -u "$i":"${PARTTBL["$SLX_CHOOSEN_DISK$i/id"]}"000000-0000-0000-0000-000000000000" + CMD=$CMD" -c "$i":\""${PARTTBL["$SLX_CHOOSEN_DISK$i/mountpoint"]}"\"" + fi + done + CMD=$CMD" > /dev/null" + $CMD for (( i = 1; i < $COUNTER; i++ )); do if [ $i -ne 4 ]; then |