Last active
September 3, 2022 20:00
-
-
Save spoelstraethan/32f56345de28a7b47d9bf44f3a0bbc65 to your computer and use it in GitHub Desktop.
(WARNING: Work In Progress, ChromeOS breaks due to how holoinstall messes with the grub) Modified holoinstall to install on a Chromebook after running Chrx to set up dual boot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# HoloISO Installer v2 | |
# This defines all of the current variables. | |
CMD_PACMAN_INSTALL=(/usr/bin/pacman --noconfirm -S --needed --disable-download-timeout --overwrite="*") | |
CMD_PACMAN_UPDATE=(/usr/bin/pacman -Sy) | |
CPU_VENDOR=$(cat /proc/cpuinfo | grep 'vendor' | uniq | cut -c 13-) | |
SYSTEM_LOCALE="${SYSTEM_LOCALE:-en_US.UTF-8 UTF-8}" | |
HOLO_INSTALL_DIR="${HOLO_INSTALL_DIR:-/mnt}" | |
# Internet connectivity check | |
sleep 2 | |
clear | |
wget -q --spider http://github.com | |
if [ $? -eq 0 ]; then | |
echo "Internet check passed" | |
sleep 2 | |
clear | |
else | |
echo -e "No Internet connection available, exiting\nUse iwctl util to connect WiFi" | |
echo 'Press any key to exit...'; read -k1 -s | |
exit | |
fi | |
# Checking if installer is up to date: | |
echo "Checking if installer is up to date..." | |
${CMD_PACMAN_UPDATE} | |
echo "Pacman DB update complete... Continuing in 2 seconds..." | |
sleep 2 | |
INSTALLER_UPD_QUERY=$(pacman -Qu | grep holoiso-install-script) | |
if [ -n "${INSTALLER_UPD_QUERY}" ]; then | |
pacman -S --noconfirm holoiso-install-script | |
sleep 2 | |
clear | |
echo "Installer updated. Please run holoinstall again." | |
echo 'Press any key to exit...'; read -k1 -s | |
exit | |
else | |
echo "Installer is up to date. Starting installation." | |
sleep 2 | |
clear | |
fi | |
# Update system time | |
if [ $(timedatectl status | grep -c "NTP service: active") -ne 1 ]; then | |
# If NTP is not active, enable it. | |
timedatectl set-ntp true | |
# Update the hardware clock. | |
hwclock --systohc | |
fi | |
if [[ "${CPU_VENDOR}" == "AuthenticAMD" ]]; then | |
UCODE_INSTALL_MSG="AMD CPU detected, installing AMD ucode..." | |
UCODE_INSTALL="amd-ucode" | |
else | |
UCODE_INSTALL_MSG="Intel CPU detected, installing Intel ucode..." | |
UCODE_INSTALL="intel-ucode" | |
fi | |
check_mount(){ | |
if [ $1 != 0 ]; then | |
echo "\nError: Something went wrong when mounting $2 partitions. Please try again!\n" | |
echo 'Press any key to exit...'; read -k1 -s | |
exit 1 | |
fi | |
} | |
check_download(){ | |
if [ $1 != 0 ]; then | |
echo "\nError: Something went wrong when $2.\nPlease make sure you have a stable internet connection!\n" | |
echo 'Press any key to exit...'; read -k1 -s | |
exit 1 | |
fi | |
} | |
partitioning(){ | |
lsblk -o NAME,MAJ:MIN,RM,SIZE,RO,TYPE,VENDOR,MODEL,SERIAL,MOUNTPOINT | |
read "?Enter your desired drive node here (for example, sda or nvme0n1): " DRIVEDEVICE | |
DEVICE="/dev/${DRIVEDEVICE}" | |
INSTALLDEVICE="${DEVICE}" | |
if [ ! -b $DEVICE ]; then | |
echo "$DEVICE not found! Installation Aborted!" | |
exit 1 | |
fi | |
lsblk $DEVICE | head -n2 | tail -n1 | grep disk > /dev/null 2>&1 | |
if [ $? != 0 ]; then | |
echo "$DEVICE is not disk type! Installation Aborted!" | |
echo "\nNote: If you wish to preform partition install.\nPlease specify the disk drive node first then select \"2\" for partition install." | |
exit 1 | |
fi | |
echo "1) Erase your drive\n2) Install alongside existing OS/Partition\nType 1 or 2: " | |
read "?Your choice is: " install | |
case $install in | |
1) | |
destructive=true | |
# Umount twice to fully umount the broken install of steam os 3 before installing. | |
umount $INSTALLDEVICE* > /dev/null 2>&1 | |
umount $INSTALLDEVICE* > /dev/null 2>&1 | |
echo "\n\nWARNING: The following drive is going to be erased fully. ALL DATA ON DRIVE $DEVICE WILL BE LOST!\n" | |
lsblk -o NAME,MAJ:MIN,RM,SIZE,RO,TYPE,VENDOR,MODEL,SERIAL,MOUNTPOINT $DEVICE | |
echo -n "\nErase $DEVICE and begin installation(y/n): " | |
read ANS | |
case $ANS in | |
y | Y) | |
echo "\nWiping partitions..." | |
sfdisk --delete ${DEVICE} | |
wipefs -a ${DEVICE} | |
echo "\nCreating new gpt partitions..." | |
parted ${DEVICE} mklabel gpt | |
;; | |
n | N) | |
echo "\nNothing has been written.\nYou canceled the destructive install, please try again" | |
exit 1 | |
;; | |
*) | |
echo "\nInvalid options.\nNothing has been written.\nYou canceled the destructive install, please try again" | |
exit 1 | |
;; | |
esac | |
;; | |
2) | |
echo "\nHoloISO will be installed alongside existing OS/Partition.\nPlease make sure there are more than 24 GB on the >>END<< of free(unallocate) space available\n" | |
parted $DEVICE print free | |
echo "HoloISO will be installed on the following free(unallocate) space.\n" | |
parted $DEVICE print free | tail -n2 | grep "Free Space" | |
if [ $? != 0 ]; then | |
echo "Error! No Free Space found on the end of the disk.\nNothing has been written.\nYou canceled the non-destructive install, please try again" | |
exit 1 | |
fi | |
echo -n "\nDoes this look reasonable(y/n): " | |
read ANS | |
case $ANS in | |
y | Y) | |
echo "\nBeginning installation..." | |
;; | |
n | N) | |
echo "\nNothing has been written.\nYou canceled the non-destructive install, please try again" | |
exit 1 | |
;; | |
*) | |
echo "\nInvalid options.\nNothing has been written.\nYou canceled the non-destructive install, please try again" | |
exit 1 | |
;; | |
esac | |
;; | |
*) | |
echo "Invalid options.\nNothing has been written. please try again" | |
exit 1 | |
;; | |
esac | |
numPartitions=$(grep -c ${DRIVEDEVICE}'[0-9]' /proc/partitions) | |
echo ${DEVICE} | grep -q -P "^/dev/(nvme|loop|mmcblk)" | |
if [ $? -eq 0 ]; then | |
INSTALLDEVICE="${DEVICE}p" | |
numPartitions=$(grep -c ${DRIVEDEVICE}p /proc/partitions) | |
fi | |
efiPartNum=12 #$(expr $numPartitions + 1) | |
rootPartNum=7 #$(expr $numPartitions + 2) | |
homePartNum=13 #$(expr $numPartitions + 3) | |
echo "\nCalculating start and end of free space..." | |
rootStart=$(parted ${DEVICE} unit MB print | grep -E '^\s7' | awk '{print $2}' | sed s/MB//) | |
rootEnd=$(parted ${DEVICE} unit MB print | grep -E '^\s7' | awk '{print $3}' | sed s/MB//) | |
echo "\nCreating partitions..." | |
parted ${DEVICE} mkpart primary btrfs ${rootStart}M ${rootEnd}M | |
root_partition="${INSTALLDEVICE}${rootPartNum}" | |
efi_partition="${INSTALLDEVICE}${efiPartNum}" | |
mkfs -t btrfs -f ${root_partition} | |
echo "\nPartitioning complete, mounting and pacstrapping..." | |
} | |
base_os_install() { | |
sleep 1 | |
clear | |
partitioning | |
#fi | |
# Actual installer below: | |
echo "${UCODE_INSTALL_MSG}" | |
sleep 1 | |
clear | |
mount -t btrfs -o subvol=/,compress-force=zstd:1,discard,noatime,nodiratime ${root_partition} ${HOLO_INSTALL_DIR} | |
check_mount $? root | |
${CMD_MOUNT_BOOT} | |
check_mount $? boot | |
pacstrap ${HOLO_INSTALL_DIR} --disable-download-timeout base base-devel ${UCODE_INSTALL} linux-holoiso linux-holoiso-headers linux-neptune linux-neptune-headers linux-firmware | |
check_download $? "installing base package" | |
echo "Pacstrap complete. Rebuilding kernel modules." | |
sleep 2 | |
clear | |
arch-chroot ${HOLO_INSTALL_DIR} depmod -a $(ls /lib/modules) | |
arch-chroot ${HOLO_INSTALL_DIR} mkinitcpio -P | |
sleep 1 | |
clear | |
echo "\nBase system installation done, generating fstab..." | |
genfstab -U -p /mnt >> /mnt/etc/fstab | |
cp /etc/pacman.conf /mnt/etc/pacman.conf | |
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist | |
sleep 1 | |
clear | |
read "?Enter hostname for this installation: " HOLOHOSTNAME | |
echo ${HOLOHOSTNAME} > ${HOLO_INSTALL_DIR}/etc/hostname | |
# Setup password for root | |
while true; do | |
echo -n "Enter \"root\" password for this installation(will not echo): " | |
read -s ROOTPASS | |
echo | |
echo -n "Enter \"root\" password for this installation(again): " | |
read -s ROOTPASS_CONF | |
echo | |
if [ $ROOTPASS = $ROOTPASS_CONF ]; then | |
break | |
fi | |
echo "Error: Password does not match." | |
done | |
# Create user | |
while true; do | |
read "?Enter username for this installation: " HOLOUSER | |
if [ $HOLOUSER = "root" ]; then | |
echo "User \"root\" already exists!" | |
else | |
break | |
fi | |
done | |
# Setup password for user | |
while true; do | |
echo -n "Enter \"$HOLOUSER\" password for this installation(will not echo): " | |
read -s HOLOPASS | |
echo | |
echo -n "Enter \"$HOLOUSER\" password for this installation(again): " | |
read -s HOLOPASS_CONF | |
echo | |
if [ $HOLOPASS = $HOLOPASS_CONF ]; then | |
break | |
fi | |
echo "Error: Password does not match." | |
done | |
echo "\nCreating user ${HOLOUSER}..." | |
echo -e "${ROOTPASS}\n${ROOTPASS}" | arch-chroot ${HOLO_INSTALL_DIR} passwd root | |
arch-chroot ${HOLO_INSTALL_DIR} useradd --create-home ${HOLOUSER} | |
echo -e "${HOLOPASS}\n${HOLOPASS}" | arch-chroot ${HOLO_INSTALL_DIR} passwd ${HOLOUSER} | |
echo "${HOLOUSER} ALL=(root) NOPASSWD:ALL" > ${HOLO_INSTALL_DIR}/etc/sudoers.d/${HOLOUSER} | |
chmod 0440 ${HOLO_INSTALL_DIR}/etc/sudoers.d/${HOLOUSER} | |
echo "127.0.1.1 ${HOLOHOSTNAME}" >> ${HOLO_INSTALL_DIR}/etc/hosts | |
sleep 1 | |
clear | |
echo "\nInstalling bootloader..." | |
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_UPDATE} | |
mkdir ${HOLO_INSTALL_DIR}/boot/efi | |
mount -t vfat ${efi_partition} ${HOLO_INSTALL_DIR}/boot/efi | |
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_INSTALL} core/grub efibootmgr inetutils mkinitcpio neofetch networkmanager sddm-wayland | |
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 | |
cp /etc/holoinstall/10_linux ${HOLO_INSTALL_DIR}/etc/grub.d/10_linux | |
cp /etc/holoinstall/grubdefault ${HOLO_INSTALL_DIR}/etc/default/grub | |
arch-chroot ${HOLO_INSTALL_DIR} grub-mkconfig -o /boot/grub/grub.cfg | |
sleep 1 | |
clear | |
echo "\nSetting up locale..." | |
echo "${SYSTEM_LOCALE}" >> ${HOLO_INSTALL_DIR}/etc/locale.gen | |
arch-chroot ${HOLO_INSTALL_DIR} locale-gen | |
echo "LANG=$(echo ${SYSTEM_LOCALE} | cut -d' ' -f1)" > ${HOLO_INSTALL_DIR}/etc/locale.conf | |
} | |
full_install() { | |
sleep 1 | |
clear | |
echo "Installing full SteamOS 3..." | |
sleep 1 | |
# The actual installation begins here: | |
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_UPDATE} | |
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_INSTALL} holoiso-main holoiso-updateclient wireplumber | |
check_download $? "installing full SteamOS 3" | |
sleep 1 | |
clear | |
while true | |
do | |
echo "Please choose your current GPU:" | |
echo "1) AMD: Will install Gamescope with Mangohud and FSR support" | |
echo "2) Intel: Will install Gamescope with Mangohud and FSR or NIR support" | |
echo "3) NVIDIA (9xx+ only): Will install proprietary drivers and Gamescope with Mangohud and NIR support" | |
read "?Enter your choice here: " HOLO_GPU_TYPE | |
if [[ "${HOLO_GPU_TYPE}" == "1" ]]; then | |
echo "Installing gamescope for AMD GPUs..." | |
GAMESCOPE_INSTALL=(/usr/bin/pacman --noconfirm -S --needed --overwrite="*" holoiso/vulkan-radeon holoiso/lib32-vulkan-radeon holoiso/gamescope holoiso/mesa holoiso/lib32-mesa) | |
break | |
elif [[ "${HOLO_GPU_TYPE}" == "2" ]]; then | |
echo "Installing gamescope for Intel GPUs..." | |
sed -i 's/linux-firmware/linux-firmware gamescope vulkan-intel lib32-vulkan-intel mesa lib32-mesa/g' ${HOLO_INSTALL_DIR}/etc/pacman.conf | |
GAMESCOPE_INSTALL=(/usr/bin/pacman --noconfirm -S --needed --overwrite="*" extra/vulkan-intel multilib/lib32-vulkan-intel extra/mesa multilib/lib32-mesa holo/gamescope) | |
break | |
elif [[ "${HOLO_GPU_TYPE}" == "3" ]]; then | |
echo "Installing gamescope for NVIDIA GPUs..." | |
GAMESCOPE_INSTALL=(/usr/bin/pacman --noconfirm -S --needed --overwrite="*" holoiso/nvidia-utils holoiso/lib32-nvidia-utils holoiso/nvidia-dkms holoiso/opencl-nvidia holoiso/gamescope) | |
sed -i 's/splash/splash nvidia-drm.modeset=1/g' ${HOLO_INSTALL_DIR}/etc/default/grub | |
arch-chroot ${HOLO_INSTALL_DIR} grub-mkconfig -o /boot/grub/grub.cfg | |
break | |
else | |
echo -e "You have made an invalid selection, please try again...\n" | |
fi | |
done | |
sleep 1 | |
clear | |
echo "\nConfiguring Steam Deck UI by default..." | |
arch-chroot ${HOLO_INSTALL_DIR} ${GAMESCOPE_INSTALL} | |
cp /etc/holoinstall/steamos-gamemode.desktop /mnt/home/${HOLOUSER}/Desktop/steamos-gamemode.desktop | |
arch-chroot ${HOLO_INSTALL_DIR} chmod +x /home/${HOLOUSER}/Desktop/steamos-gamemode.desktop | |
mkdir ${HOLO_INSTALL_DIR}/etc/sddm.conf.d | |
echo "[General]\nDisplayServer=wayland\n\n[Autologin]\nUser=${HOLOUSER}\nSession=gamescope-wayland.desktop" >> ${HOLO_INSTALL_DIR}/etc/sddm.conf.d/autologin.conf | |
mkdir /mnt/home/${HOLOUSER}/Desktop | |
arch-chroot ${HOLO_INSTALL_DIR} ln -s /usr/share/applications/steam.desktop /home/${HOLOUSER}/Desktop/steam.desktop | |
arch-chroot ${HOLO_INSTALL_DIR} chown -R ${HOLOUSER}:${HOLOUSER} /home/${HOLOUSER}/Desktop | |
arch-chroot ${HOLO_INSTALL_DIR} systemctl enable cups bluetooth sddm holoiso-reboot-tracker | |
arch-chroot ${HOLO_INSTALL_DIR} usermod -a -G rfkill ${HOLOUSER} | |
arch-chroot ${HOLO_INSTALL_DIR} usermod -a -G wheel ${HOLOUSER} | |
arch-chroot ${HOLO_INSTALL_DIR} sudo -u ${HOLOUSER} steam | |
arch-chroot ${HOLO_INSTALL_DIR} ${CMD_PACMAN_INSTALL} flatpak packagekit-qt5 rsync unzip vim | |
check_download $? "installing flatpak" | |
arch-chroot ${HOLO_INSTALL_DIR} flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
check_download $? "updating flatpak" | |
arch-chroot ${HOLO_INSTALL_DIR} echo "recoveryinit" > /root/.bashrc | |
sleep 1 | |
clear | |
} | |
# The installer itself. Good wuck. | |
echo "SteamOS 3 Installer" | |
echo "Start time: $(date)" | |
echo "Please choose installation type:" | |
echo "1) barebones: Barebones OS-only installation" | |
echo "2) deckperience: Full SteamOS 3 experience" | |
read "?Enter your choice here: " HOLO_INSTALL_TYPE | |
echo "" | |
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" | |
echo 'Press any key to exit...'; read -k1 -s | |
elif [[ "${HOLO_INSTALL_TYPE}" == "2" ]]; then | |
echo "Installing SteamOS, deckperience configuration..." | |
base_os_install | |
full_install | |
echo "Installation finished! You may reboot now, or type arch-chroot /mnt to make further changes" | |
echo 'Press any key to exit...'; read -k1 -s | |
else | |
echo "Invalid choice. Exiting installer..." | |
fi | |
echo "End time: $(date)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment