9db6c513c9
- Add install_station package with __init__.py and core modules - Include boot_manager.py for boot loader configuration (BootManager class with singleton pattern) - Add common.py with password strength validation utilities and ZFS dataset definitions - Add custom.py with Partitions class for disk partitioning management (1010 lines) - Establish foundation for GTK+ based GhostBSD installer application Modules added: - boot_manager: UEFI/BIOS boot manager selection with rEFInd and FreeBSD options - common: Password validation functions and deprecated decorator utility - custom: Comprehensive partition management with GTK+ interface
50 lines
1.1 KiB
Bash
Executable File
50 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Query a disk for partitions and display them
|
|
#############################
|
|
|
|
|
|
DISK="${1}"
|
|
TMPDIR=${TMPDIR:-"/tmp"}
|
|
# Display if this is GPT or MBR formatted
|
|
gpart show ${DISK} | grep "GPT" >/dev/null 2>/dev/null
|
|
if [ "$?" = "0" ] ; then
|
|
#echo "${1}-format: GPT"
|
|
TYPE="GPT"
|
|
else
|
|
#echo "${1}-format: MBR"
|
|
TYPE="MBR"
|
|
fi
|
|
|
|
if [ "$TYPE" = "MBR" ] ; then
|
|
sp="s"
|
|
else
|
|
sp="p"
|
|
fi
|
|
|
|
# Get a listing of partitions on this disk
|
|
gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | cut -d ' ' -f 4,3,5 >${TMPDIR}/disk-${DISK}
|
|
while read i
|
|
do
|
|
if [ ! -z "${i}" ] ; then
|
|
BLOCK="`echo ${i} | cut -d ' ' -f 1`"
|
|
if [ "${BLOCK}" -ge 2048 ] ; then
|
|
MB="`expr ${BLOCK} / 2048`"
|
|
else
|
|
MB="1"
|
|
fi
|
|
fi
|
|
if [ ! "${MB}" = "0" ] ; then
|
|
LABEL="`echo ${i} | cut -d ' ' -f 3`"
|
|
SLICE="`echo ${i} | cut -d ' ' -f 2`"
|
|
if [ "$SLICE" = '-' ] ; then
|
|
if [ ! "${MB}" = "1" ] ; then
|
|
echo "freespace ${MB} none"
|
|
fi
|
|
else
|
|
if [ ! -z "$SLICE" ] ; then
|
|
echo "${DISK}${sp}${SLICE} ${MB} ${LABEL} "
|
|
fi
|
|
fi
|
|
fi
|
|
done <${TMPDIR}/disk-${DISK}
|