Merge pull request #32 from Pato05/3.0

holoinstall: interactive disk selection
This commit is contained in:
Adam Jafarov 2022-05-06 17:40:10 +03:00 committed by GitHub
commit b54537e465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,20 +24,50 @@ else
UCODE_INSTALL="intel-ucode"
fi
base_os_install() {
lsblk
read "?Enter your desired drive node here (for example, sda or nvme0n1): " DRIVEDEVICE
select_disk() {
local ALLDISKS=(`lsblk -o NAME,TYPE -lnp | grep disk | awk '{ print $1 }'`)
i=1
for disk in $ALLDISKS; do
echo "${i}. ${disk}"
i=$((i+1))
done
read "?Enter your desired disk number here (or, if not available, enter the disk's name manually): " DISKNO
read "?WARNING: This drive is going to be erased fully. Press enter to continue, or CTRL+Z to terminate"
DEVICE="/dev/${DRIVEDEVICE}"
INSTALLDEVICE="${DEVICE}"
echo ${DEVICE} | grep -q -P "^/dev/(nvme|loop|mmcblk)"
if [ $? -eq 0 ]; then
INSTALLDEVICE="${DEVICE}p"
# if $DISKNO is numeric
if [[ "$DISKNO" == <-> ]]; then
DISKNO=$((DISKNO-1))
DEVICE="${ALLDISKS:${DISKNO}}"
else
if [[ "$DISKNO" =~ "^/dev/" ]]; then
DEVICE="$DISKNO"
else
DEVICE="/dev/$DISKNO"
fi
fi
echo "\nCreating partitions..."
echo -n "${DEVICE}"
}
base_os_install() {
DEVICE=`select_disk`
if [ -z "${DEVICE}" ]; then
echo "Exiting..."
exit 0
fi
if ! [ -b "${DEVICE}" ]; then
echo "${DEVICE} is not a block device. Exiting..."
exit 1
fi
INSTALL_DEVICE="${DEVICE}"
if echo ${DEVICE} | grep -q -P "^/dev/(nvme|loop|mmcblk)"; then
INSTALL_DEVICE="${DEVICE}p"
fi
echo "\nPartitioning drive..."
sfdisk --delete ${DEVICE}
wipefs -a ${DEVICE}
parted ${DEVICE} mklabel gpt
@ -45,13 +75,13 @@ base_os_install() {
parted ${DEVICE} set 1 boot on
parted ${DEVICE} set 1 esp on
parted ${DEVICE} mkpart primary btrfs 256M 100%
root_partition="${INSTALLDEVICE}2"
mkfs -t vfat ${INSTALLDEVICE}1
fatlabel ${INSTALLDEVICE}1 HOLOEFI
root_partition="${INSTALL_DEVICE}2"
mkfs -t vfat ${INSTALL_DEVICE}1
fatlabel ${INSTALL_DEVICE}1 HOLOEFI
mkfs -t btrfs -f ${root_partition}
btrfs filesystem label ${root_partition} holo-root
echo "\nPartition creating complete, mounting and pacstrapping..."
echo "\nPartitioning complete, mounting and pacstrapping..."
echo "${UCODE_INSTALL_MSG}"
mount -t btrfs -o subvol=/,compress-force=zstd:1,discard,noatime,nodiratime ${root_partition} ${HOLO_INSTALL_DIR}
pacstrap -i ${HOLO_INSTALL_DIR} base base-devel ${UCODE_INSTALL} core/linux core/linux-headers linux-neptune linux-neptune-headers linux-firmware
@ -82,7 +112,7 @@ base_os_install() {
echo "\nInstalling bootloader..."
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_UPDATE}
mkdir ${HOLO_INSTALL_DIR}/boot/efi
mount -t vfat ${INSTALLDEVICE}1 ${HOLO_INSTALL_DIR}/boot/efi
mount -t vfat ${INSTALL_DEVICE}1 ${HOLO_INSTALL_DIR}/boot/efi
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_INSTALL} core/grub efibootmgr inetutils mkinitcpio neofetch networkmanager sddm
arch-chroot ${HOLO_INSTALL_DIR} systemctl enable NetworkManager systemd-timesyncd
arch-chroot ${HOLO_INSTALL_DIR} grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=holo --removable
@ -134,6 +164,7 @@ full_install() {
}
# The installer itself. Good wuck.
select_disk
echo "SteamOS 3 Installer, version SteamOS_Holo_RC1-20220505_0837_amdgpu-x86_64"
echo "Start time: $(date)"
echo "Please choose installation type:"
@ -141,7 +172,7 @@ echo "1) barebones: Barebones OS-only installation"
echo "2) deckperience: Full SteamOS 3 experience"
read "?Enter your choice here: " HOLO_INSTALL_TYPE
if [[ "${HOLO_INSTALL_TYPE}" == "1" ]]; then
if [[ "${HOLO_INSTALL_TYPE}" == "1" ]] || [[ "${HOLO_INSTALL_TYPE}" == "barebones" ]]; then
echo "Installing SteamOS, barebones configuration..."
base_os_install
echo "Installation finished! You may reboot now, or type arch-chroot /mnt to make further changes"
@ -152,7 +183,7 @@ elif [[ "${HOLO_INSTALL_TYPE}" == "cockpenisyiff" ]]; then
gamescope_only_install
echo "Installation finished! You may reboot now, or type arch-chroot /mnt to make further changes"
elif [[ "${HOLO_INSTALL_TYPE}" == "2" ]]; then
elif [[ "${HOLO_INSTALL_TYPE}" == "2" ]] || [[ "${HOLO_INSTALL_TYPE}" == "deckperience" ]]; then
echo "Installing SteamOS, deckperience configuration..."
base_os_install
full_install