dialog --title "Run as root" --msgbox "Please run the installer as root!"00
exit1
fi
if[[ -x /sys/firmware/efi ]];then
uefi=true
else
uefi=false
fi
dialog --clear --title "Launguage" --menu "Select a language:"155010"en_GB""English UK""en_US""English US"
if[[$?=1]];then
exit1
fi
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."00
get_disk_type(){
localdisk_name="$1"
if[["$disk_name"=~ ^sd.$ ]];then
echo"Hard Disk $(echo"${disk_name: -1}"| tr '[:lower:]''[:upper:]')"
dialog --title "Disk with Partitions" --yesno "The selected disk contains data. Do you want to wipe the disk?"850
response=$?
if["$response" -eq 0];then
# User chose Yes, proceed to wipe the disk
# Add your wipe disk command here
echo"Ok, continuing with: $choice"
break
else
# User chose No, return to the selection menu
continue
fi
else
# Disk has no partitions, continue with further actions
echo"Ok, continuing with: $choice"
# Add your additional actions here
# ...
fi
# Break out of the loop if the user didn't choose to wipe the disk and there are no partitions
break
done
for i in $(lsblk --list -o NAME /dev/$choice| awk 'NR>2');do
umount /dev/$i
done
sfdisk --delete /dev/$choice
wipefs -a /dev/$choice
sgdisk -Z /dev/$choice
dialog --yesno "Would you like to use the recommended disk partitioning?"00
if[[$?=0]];then
dialog --msgbox "Starting partitioning..."00
if[[$uefi=true]];then
sfdisk -X gpt -W always /dev/$choice <<EOF
, 200M
, ,
EOF
fdisk /dev/$choice <<EOF
t
1
EOF
part1=$(lsblk -n -o NAME --list /dev/$choice| sed -n '2p')
part2=$(lsblk -n -o NAME --list /dev/$choice| sed -n '3p')
mkfs.fat -F 32 /dev/$part1
dialog --clear --title "Filesystem Type" --menu "Select a filesystem:"000"ext4""Basic file system (recommended)""btrfs""Great for data recovery""xfs""High performence, but may need extra RAM" 2>/tmp/fileselect
dialog --clear --title "Filesystem Type" --menu "Select a filesystem:"000"ext4""Basic file system (recommended)""btrfs""Great for data recovery""xfs""High performence, but may need extra RAM" 2>/tmp/fileselect
if[[$?=1]];then
dialog --msgbox "Operation cancled"
exit1
fi
filesystem=$(cat /tmp/fileselect)
partmpt1=$(lsblk -n -o NAME --list /dev/$choice| sed -n '2p')
dialog --msgbox "Ok, you will be dropped into a CLI. Please mount the filesystem, when done, at \"/mnt/\". Note that anything except the default partition disk (ESP, Optional Swap, RootFS) is not offically supported and may not work. Enter exit when you are done."00
dialog --clear --title "Select install type" --menu "Which installation type would you like to you:"000"local""Install without internet""network""Download from internet" 2>/tmp/installtype
dialog --title "Password" --clear --insecure --passwordbox "Enter Admin (root) password. For security reasons, you cannot log in as admin. Press enter to submit."00 2>/tmp/rootpasswd
dialog --title "Username" --clear --inputbox "Enter shorthand username. This will be created as an super user (able to run as root)."00 2>/tmp/usershort