Update partition-funcs.sh

This commit is contained in:
Quazz
2020-01-15 16:03:09 +01:00
committed by GitHub
parent 6f2f46af3b
commit 80e959a458

View File

@@ -509,13 +509,13 @@ processSfdisk() {
getPartitionTableType() {
local disk="$1"
[[ -z $disk ]] && handleError "No disk passed (${FUNCNAME[0]})\n Args Passed: $*"
#local mbr=$(yes '' | gdisk -l $disk | awk '/^\ *MBR:/{print $2}')
#local gpt=$(yes '' | gdisk -l $disk | awk '/^\ *GPT:/{print $5}')
#local mbr=$(yes '' | gdisk -l $disk | awk '/^[ ]*MBR:/{print $2}')
#local gpt=$(yes '' | gdisk -l $disk | awk '/^[ ]*GPT:/{print $5}')
sgdisk -v $disk >/dev/null 2>&1
status="$?"
[[ ! $status -eq 0 ]] && runFixparts "$disk"
local mbr=$(gdisk -l $disk | awk '/^\ *MBR:/{print $2}')
local gpt=$(gdisk -l $disk | awk '/^\ *GPT:/{print $2}')
local mbr=$(gdisk -l $disk | awk '/^[ ]*MBR:/{print $2}')
local gpt=$(gdisk -l $disk | awk '/^[ ]*GPT:/{print $2}')
local type=""
local mbrtype=""
local gpttype=""
@@ -572,11 +572,11 @@ getDesiredPartitionTableType() {
hasHybridMBR() {
local disk="$1"
[[ -z $disk ]] && handleError "No disk passed (${FUNCNAME[0]})\n Args Passed: $*"
#local mbr=$(yes '' | gdisk -l $disk | awk '/^\ *MBR:/{print $2}')
#local mbr=$(yes '' | gdisk -l $disk | awk '/^[ ]*MBR:/{print $2}')
sgdisk -v $disk >/dev/null 2>&1
status="$?"
[[ ! $status -eq 0 ]] && runFixparts "$disk"
local mbr=$(gdisk -l $disk | awk '/^\ *MBR:/{print $2}')
local mbr=$(gdisk -l $disk | awk '/^[ ]*MBR:/{print $2}')
[[ $mbr == hybrid ]] && echo 1 || echo 0
}
# $1 : device name of drive