mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
More elegant way to detect MBR vs. GPT
Submitted by: nwhitehorn Approved by: imp
This commit is contained in:
parent
083cfea1ee
commit
5eea74f248
2 changed files with 3 additions and 14 deletions
|
|
@ -60,14 +60,8 @@ if [ "$?" != "0" ] ; then
|
|||
fi
|
||||
|
||||
# Display if this is GPT or MBR formatted
|
||||
gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
echo "${1}-format: GPT"
|
||||
TYPE="GPT"
|
||||
else
|
||||
echo "${1}-format: MBR"
|
||||
TYPE="MBR"
|
||||
fi
|
||||
TYPE=`gpart show ${1} | awk '/^=>/ { printf("%s",$5); }'`
|
||||
echo "${1}-format: $TYPE"
|
||||
|
||||
# Set some search flags
|
||||
PART="0"
|
||||
|
|
|
|||
|
|
@ -180,12 +180,7 @@ get_disk_partitions()
|
|||
return
|
||||
fi
|
||||
|
||||
gpart show ${1} | grep "MBR" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
type="MBR"
|
||||
else
|
||||
type="GPT"
|
||||
fi
|
||||
type=`gpart show ${1} | awk '/^=>/ { printf("%s",$5); }'`
|
||||
|
||||
SLICES="`gpart show ${1} | grep -v ${1} | grep -v ' free ' |tr -s '\t' ' ' | cut -d ' ' -f 4 | sed '/^$/d'`"
|
||||
for i in ${SLICES}
|
||||
|
|
|
|||
Loading…
Reference in a new issue