First pass at drive partitioning.
This commit is contained in:
parent
a7d5c3ab8c
commit
f0997a73ae
@ -27,7 +27,7 @@ trap cleanup EXIT # make sure the script cleans up after itself before closing.
|
|||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if [[ $mounted -eq 0 ]]; then
|
if [[ $mounted -eq 0 ]]; then
|
||||||
umount -R /mnt
|
umount -R /mnt || echo "Warning: Failed to unmount /mnt"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -58,13 +58,13 @@ menulist() {
|
|||||||
# returns: selected tag
|
# returns: selected tag
|
||||||
local instructions="${1}"
|
local instructions="${1}"
|
||||||
shift
|
shift
|
||||||
dialog --title "$(gettext "Stormux X86_64 Installer")" \
|
dialog --title "Stormux X86_64 Installer" \
|
||||||
--backtitle "$(gettext "Use the up and down arrow keys to find the option you want, then press enter to select it.")" \
|
--backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
|
||||||
--clear \
|
--clear \
|
||||||
--cancel-label "$(gettext "Exit")" \
|
--cancel-label "Exit" \
|
||||||
--ok-label "$(gettext "Continue")" \
|
--ok-label "Continue" \
|
||||||
--no-tags \
|
--no-tags \
|
||||||
--menu "$(gettext "${instructions}")" 0 0 0 "$@" --stdout
|
--menu "${instructions}" 0 0 0 "$@" --stdout
|
||||||
local code=$?
|
local code=$?
|
||||||
[[ $code -eq 1 ]] && exit 0
|
[[ $code -eq 1 ]] && exit 0
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ yesno() {
|
|||||||
# Returns: 0 yes, or 1 no
|
# Returns: 0 yes, or 1 no
|
||||||
# Args: Question to user.
|
# Args: Question to user.
|
||||||
dialog --clear --title "Stormux X86_64 Installer" \
|
dialog --clear --title "Stormux X86_64 Installer" \
|
||||||
--backtitle "$(gettext "Press 'Enter' for \"yes\" or 'Escape' for \"no\".")" --yesno "$*" -1 -1 --stdout
|
--backtitle "Press 'Enter' for \"yes\" or 'Escape' for \"no\"." --yesno "$*" -1 -1 --stdout
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,28 @@ answer="$(yesno "Have you created your own disk layout and mounted it at /mnt?")
|
|||||||
if [[ $answer -eq 1 ]]; then
|
if [[ $answer -eq 1 ]]; then
|
||||||
msgbox "Stormux can format a drive for you. Keep in mind that all data on the selected drive will be lost, including any other operating system that may be installed. To cancel, press control+c."
|
msgbox "Stormux can format a drive for you. Keep in mind that all data on the selected drive will be lost, including any other operating system that may be installed. To cancel, press control+c."
|
||||||
mapfile -t driveList < <(lsblk -l -d -o 'PATH,SiZE' | tail -n +2 | tr -s '[:space:]' | tr '[:space:]' $'\n')
|
mapfile -t driveList < <(lsblk -l -d -o 'PATH,SiZE' | tail -n +2 | tr -s '[:space:]' | tr '[:space:]' $'\n')
|
||||||
drive=$(menulist "Select a drive for the installation." "${driveList[@]}")
|
drive=$(menulist "Select a drive for the installation." "${driveList[@]}" --stdout)
|
||||||
|
# Check if the system is using UEFI
|
||||||
|
if [ -d /sys/firmware/efi ]; then
|
||||||
|
echo "UEFI detected. Setting up GPT partition table."
|
||||||
|
parted -s "$drive" mklabel gpt
|
||||||
|
parted -s "$drive" mkpart primary fat32 1MiB 512MiB
|
||||||
|
parted -s "$drive" set 1 esp on
|
||||||
|
parted -s "$drive" mkpart primary ext4 512MiB 100%
|
||||||
|
mkfs.fat -F32 "${drive}1"
|
||||||
|
mkfs.ext4 "${drive}2"
|
||||||
|
mount "${drive}2" /mnt
|
||||||
|
mkdir -p /mnt/boot
|
||||||
|
mount "${drive}1" /mnt/boot
|
||||||
|
else
|
||||||
|
echo "BIOS detected. Setting up MBR partition table."
|
||||||
|
parted -s "$drive" mklabel msdos
|
||||||
|
parted -s "$drive" mkpart primary ext4 1MiB 100MiB
|
||||||
|
parted -s "$drive" set 1 boot on
|
||||||
|
mkfs.ext4 "${drive}1"
|
||||||
|
mount "${drive}1" /mnt
|
||||||
|
mounted=0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
language=$(menulist "Select the System Language" \
|
language=$(menulist "Select the System Language" \
|
||||||
|
Loading…
Reference in New Issue
Block a user