Merge pull request 'fix partitioning for mmcblk and nvme devices' (#1) from pixrobot/os-installer:main into main
Reviewed-on: https://centrifuge.hectabit.org/EvolutionOS/os-installer/pulls/1
This commit is contained in:
commit
aab7f8efea
25
installer.sh
25
installer.sh
|
@ -47,6 +47,17 @@ insmod /root/vfat-modules/vfat.ko.zst
|
||||||
dialog --title "Welcome" --msgbox "Welcome to the EvolutionOS installer! \n\nThis installer is meant to be straightforward, no need for technical skill. \n\nPress enter to select buttons, tab to move between text boxes, and left / right to move between buttons." 0 0
|
dialog --title "Welcome" --msgbox "Welcome to the EvolutionOS installer! \n\nThis installer is meant to be straightforward, no need for technical skill. \n\nPress enter to select buttons, tab to move between text boxes, and left / right to move between buttons." 0 0
|
||||||
choice=$(dialog --menu "Select an installation drive:" 20 60 10 $(create_menu $(parted -l | grep -oE '^Disk /dev/[a-zA-Z0-9]+' | cut -d' ' -f2- | cut -c 6-)) 2>&1 >/dev/tty)
|
choice=$(dialog --menu "Select an installation drive:" 20 60 10 $(create_menu $(parted -l | grep -oE '^Disk /dev/[a-zA-Z0-9]+' | cut -d' ' -f2- | cut -c 6-)) 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
if [[ ${choice} =~ "nvme" ]]; then
|
||||||
|
part1="p1"
|
||||||
|
part2="p2"
|
||||||
|
elif [[ ${choice} =~ "mmcblk" ]]; then
|
||||||
|
part1="p1"
|
||||||
|
part2="p2"
|
||||||
|
else
|
||||||
|
part1="1"
|
||||||
|
part2="2"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$(cat /sys/block/${choice}/ro)" = "1" ]]; then
|
if [[ "$(cat /sys/block/${choice}/ro)" = "1" ]]; then
|
||||||
dialog --title "Scan disk" --msgbox "You are not able to install evolutionOS on a non-writable disk" 0 0
|
dialog --title "Scan disk" --msgbox "You are not able to install evolutionOS on a non-writable disk" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
|
@ -68,37 +79,37 @@ if [[ $? = 0 ]]; then
|
||||||
filesystem=$(dialog --menu "Select a filesystem:" 0 0 0 "ext4" "Fast basic filesystem (recommended)" "btrfs" "Great for data recovery and servers" 2>&1 >/dev/tty)
|
filesystem=$(dialog --menu "Select a filesystem:" 0 0 0 "ext4" "Fast basic filesystem (recommended)" "btrfs" "Great for data recovery and servers" 2>&1 >/dev/tty)
|
||||||
if [[ $uefi = true ]]; then
|
if [[ $uefi = true ]]; then
|
||||||
if [[ "$filesystem" = "ext4" ]]; then
|
if [[ "$filesystem" = "ext4" ]]; then
|
||||||
mkfs.ext4 /dev/${choice}2 | dialog --title "Creating file system..." --programbox 24 80
|
mkfs.ext4 /dev/${choice}${part2} | dialog --title "Creating file system..." --programbox 24 80
|
||||||
else
|
else
|
||||||
mkfs.btrfs -f /dev/${choice}2 | dialog --title "Creating file system..." --programbox 24 80
|
mkfs.btrfs -f /dev/${choice}${part2} | dialog --title "Creating file system..." --programbox 24 80
|
||||||
fi
|
fi
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Formatting failed!" 0 0
|
dialog --msgbox "Formatting failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
fi
|
fi
|
||||||
mkfs.fat -v -F 32 /dev/${choice}1 | dialog --title "Creating boot partition..." --programbox 24 80
|
mkfs.fat -v -F 32 /dev/${choice}${part1} | dialog --title "Creating boot partition..." --programbox 24 80
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Formatting failed!" 0 0
|
dialog --msgbox "Formatting failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
fi
|
fi
|
||||||
mount /dev/${choice}2 /mnt
|
mount /dev/${choice}${part2} /mnt
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Mounting failed!" 0 0
|
dialog --msgbox "Mounting failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
fi
|
fi
|
||||||
mkdir -p /mnt/boot/efi
|
mkdir -p /mnt/boot/efi
|
||||||
sh -c "mount /dev/${choice}1 /mnt/boot/efi"
|
sh -c "mount /dev/${choice}${part1} /mnt/boot/efi"
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Mounting ESP failed!" 0 0
|
dialog --msgbox "Mounting ESP failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mkfs.$filesystem /dev/${choice}1 | dialog --title "Creating file system..." --programbox 24 80
|
mkfs.$filesystem /dev/${choice}${part1} | dialog --title "Creating file system..." --programbox 24 80
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Formatting failed!" 0 0
|
dialog --msgbox "Formatting failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
fi
|
fi
|
||||||
mount /dev/${choice}1 /mnt
|
mount /dev/${choice}${part1} /mnt
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
dialog --msgbox "Mounting failed!" 0 0
|
dialog --msgbox "Mounting failed!" 0 0
|
||||||
failinstall
|
failinstall
|
||||||
|
|
Reference in New Issue