diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-16 22:01:53 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-16 22:01:53 +0100 |
commit | a2338a2003b525467bbd07b60815a2f9dc083c9d (patch) | |
tree | af99b52a255c4e4381dc16d8c0c37e5f350cd56e /joes-arch-install-UEFI.sh | |
parent | New remote, modified readme (diff) | |
download | arch-installer-a2338a2003b525467bbd07b60815a2f9dc083c9d.tar.gz arch-installer-a2338a2003b525467bbd07b60815a2f9dc083c9d.tar.bz2 arch-installer-a2338a2003b525467bbd07b60815a2f9dc083c9d.tar.xz arch-installer-a2338a2003b525467bbd07b60815a2f9dc083c9d.tar.zst arch-installer-a2338a2003b525467bbd07b60815a2f9dc083c9d.zip |
Renamed main script
Diffstat (limited to 'joes-arch-install-UEFI.sh')
-rwxr-xr-x | joes-arch-install-UEFI.sh | 657 |
1 files changed, 657 insertions, 0 deletions
diff --git a/joes-arch-install-UEFI.sh b/joes-arch-install-UEFI.sh new file mode 100755 index 0000000..34ed2c9 --- /dev/null +++ b/joes-arch-install-UEFI.sh @@ -0,0 +1,657 @@ +#!/bin/bash + +answr="" +drvnm="" +rts="" +swps="" +rtpwd="" +rtrtpwd="walk" +usrpwd="" +usrusrpwd="fade" +hstnm="" +isusr="false" +somemore="false" +intelamdcpu="none" +intelamdgpu="none" + +clear +echo "#============ WELCOME ============#" +echo "# #" +echo "# Welcome to Joe's #" +echo "# ARCH LINUX #" +echo "# UEFI INSTALL SCRIPT #" +echo "# #" +echo "# (press [return] to begin...) #" +echo "# #" +echo "#=================================#" +read -r + +# ================================================================================================ # +# ======================================== ERRORS CHECK ========================================== # +# ================================================================================================ # + +if [ ! -r /sys/firmware/efi/efivars ]; then + clear + echo "X=X=X=X=X=X=X ERROR X=X=X=X=X=X=X=X" + echo "X X" + echo "X It seems that boot mode X" + echo "X is not set to UEFI X" + echo "X therefore Joe's script is X" + echo "X forced to abort X" + echo "X X" + echo "X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X" + sleep 6 + echo && echo + echo "Thank you for using Joe's Arch Linux UEFI install script." + sleep 1 + echo "Aborting..." + sleep 3 + clear + exit +fi +clear +echo "Verifying that your are connected to the Internet, please wait..." + +wget -q --spider https://google.com +tmpret=$? +if [ $tmpret -ne 0 ]; then + clear + echo "X=X=X=X=X=X=X ERROR X=X=X=X=X=X=X=X" + echo "X X" + echo "X It seems that your X" + echo "X terminal is not X" + echo "X connected to the Internet X" + echo "X therefore Joe's script is X" + echo "X forced to abort X" + echo "X X" + echo "X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X" + sleep 6 + echo && echo + echo "Thank you for using Joe's Arch Linux UEFI install script." + sleep 1 + echo "Aborting..." + sleep 3 + clear + exit +else + echo "Success!" + echo + echo "Press [retrun] key to continue" + read -r +fi + +# ================================================================================================ # +# ========================================= DISK SETUP =========================================== # +# ================================================================================================ # + +while [[ $answr != y && $answr != Y && $answr != yes && $answr != Yes && $answr != YES ]]; do + drvnm="" + swps="" + rts="" + clear + echo "#========= I. DISK SETUP =========#" + echo "# #" + echo "# Please choose wisely #" + echo "# #" + echo "# 1. Drive to be used #" + echo "# #" + echo "#=================================#" + while [[ $drvnm == "" || $drvnm -gt $(lsblk | grep -c disk) || $drvnm -le 0 ]]; do + echo && echo + dn=$(lsblk | grep -c disk) + id=1 + lsblk + echo && echo + echo "Please choose the drive on which Arch Linux shoud be installed:" + while [[ $dn != 0 ]]; do + echo "$id. $(lsblk | grep disk | awk '{print $1}' | sed -n "$id"p)" + ((dn--)) + ((id++)) + done + echo -n "> " + read -r drvnm + if [[ $drvnm == "" ]]; then + echo && echo + echo "Can't be empty, retrying..." + fi + if [[ $drvnm -gt $(lsblk | grep -c disk) ]]; then + echo && echo + echo "Illegal value, please choose something reasonable. Retrying..." + fi + if [[ $drvnm -lt 0 ]]; then + echo && echo + echo "Illegal value, please choose something reasonable. Retrying..." + fi + if [[ $drvnm == 0 ]]; then + echo && echo + echo "Illegal value, please choose something reasonable. Retrying..." + fi + done + drv="/dev/"$(lsblk | grep disk | awk '{print $1}' | sed -n "$drvnm"p) + clear + echo "#========= I. DISK SETUP =========#" + echo "# #" + echo "# Please choose wisely #" + echo "# #" + echo "# 2. swap partion size #" + echo "# #" + echo "#=================================#" + while [[ $swps == "" ]]; do + echo && echo + echo "Please enter your swap partition disired size:" + echo "_G" + echo -n "> " + read -r swps + if [[ $swps == "" ]]; then + echo && echo + echo "Can't be empty, retrying..." + fi + done + clear + echo "#========= I. DISK SETUP =========#" + echo "# #" + echo "# Please choose wisely #" + echo "# #" + echo "# 3. root partion size #" + echo "# #" + echo "#=================================#" + while [[ $rts == "" ]]; do + echo && echo + echo "Please enter your root partition disired size:" + echo "__G" + echo -n "> " + read -r rts + if [[ $rts == "" ]]; then + echo && echo + echo "Can't be empty, retrying..." + fi + done + btsze="128M" + rtsze=$rts"G" + swpsze=$swps"G" + clear + echo "#============= CONFIRM THIS IS CORRECT ===============#" + echo "# #" + echo "# DRIVE TO USE: $drv #" + echo "# #" + echo "# /boot/efi > BOOT partition size: $btsze #" + echo "# SWAP partition size: $swpsze #" + echo "# / > ROOT partition size: $rtsze #" + echo "# /home > HOME partition size: all that remains #" + echo "# #" + echo "#=====================================================#" + echo && echo + echo "Is that correct? [y/N]" + echo -n "> " + read -r answr + if [[ $answr != y && $answr != Y && $answr != yes && $answr != Yes && $answr != YES ]]; then + echo && echo + echo "Retrying..." + echo + echo "Press [retrun] key to continue" + read -r + fi +done + +# ================================================================================================ # +# ========================================= USERS SETUP ========================================== # +# ================================================================================================ # + +answr="n" + +while [ ! $rtrtpwd = "$rtpwd" ] || [ $rtpwd = "" ]; do + clear + echo "#======= II. USERS SETUP =========#" + echo "# #" + echo "# 1. root password #" + echo "# #" + echo "#=================================#" + echo && echo + echo "Enter your disired root password (can't be empty):" + echo -n "> " + read -r -s rtpwd + echo && echo + echo "Confirm root password:" + echo -n "> " + read -r -s rtrtpwd + if [ ! "$rtrtpwd" = "$rtpwd" ]; then + echo && echo + echo "Password mismatch, retrying..." + sleep 2 + fi + if [ "$rtpwd" = "" ]; then + echo && echo + echo "Password is empty, retrying..." + sleep 2 + fi +done + +clear +echo "#======= II. USERS SETUP =========#" +echo "# #" +echo "# 2. User add #" +echo "# #" +echo "#=================================#" +echo && echo +echo "Would you like to add a user to the system? [y/N]" +echo -n "> " +read -r answr +if [[ $answr == y || $answr == Y || $answr == yes || $answr == Yes || $answr == YES ]]; then + echo && echo + echo "Enter your desired username:" + echo -n "> " + read -r usr + isusr="true" + usr=$(echo "$usr" | tr '[:upper:]' '[:lower:]') + echo && echo + while [[ $usrusrpwd != "$usrpwd" || $usrpwd == "" ]]; do + echo "Enter your disired password for $usr (can't be empty):" + echo -n "> " + read -r -s usrpwd + echo && echo + echo "Confirm user password:" + echo -n "> " + read -r -s usrusrpwd + if [ ! "$usrusrpwd" = "$usrpwd" ]; then + echo && echo + echo "Password mismatch, retrying..." + sleep 2 + fi + if [ "$usrpwd" == "" ]; then + echo && echo + echo "Password is empty, retrying..." + sleep 2 + fi + done +fi +clear +echo "#======= II. USERS SETUP =========#" +echo "# #" +echo "# 3. hostname #" +echo "# #" +echo "#=================================#" +while [[ $hstnm == "" ]]; do + echo && echo + echo "Enter your disired hostname for this terminal (can't be empty):" + echo -n "> " + read -r hstnm + if [[ $hstnm == "" ]]; then + echo && echo + echo "Hostname is empty, retrying..." + sleep 2 + fi +done +answr="n" +clear +echo "#====== III. EXTRAS SETUP ========#" +echo "# #" +echo "# 1. More #" +echo "# #" +echo "#=================================#" +echo && echo +echo "Do you wish to install Xorg and gst-plugins as well? [y/N]" +echo -n "> " +read -r answr +if [[ $answr == y || $answr == Y || $answr == yes || $answr == Yes || $answr == YES ]]; then + somemore="true" +fi +clear +answr="" +lscpu | grep -q Intel +tmpret=$? +if [ $tmpret -eq 0 ]; then + intelamdcpu="intel" +fi +lscpu | grep -q AMD +tmpret=$? +if [ $tmpret -eq 0 ]; then + intelamdcpu="amd" +fi +lspci | grep -q Intel +tmpret=$? +if [ $tmpret -eq 0 ]; then + intelamdgpu="intel" +fi +lspci | grep -q AMD +tmpret=$? +if [ $tmpret -eq 0 ]; then + intelamdgpu="amd" +fi + +# ================================================================================================ # +# ===================================== THE ACTUAL INSTALL ======================================= # +# ================================================================================================ # + + +# ============================================================== # +# ========================== NTP DATE ========================== # +# ============================================================== # + + +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 1. Setting date #" +echo "# via ntp #" +echo "# #" +echo "#=================================#" +timedatectl set-ntp true +sleep 2 + +# ============================================================== # +# ==================== PARTITIONING DISK ======================= # +# ============================================================== # + +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 2. Partitionning #" +echo "# disk $drv #" +echo "# #" +echo "#=================================#" +echo && echo +dd if=/dev/zero of="$drv" bs=512 count=1 +sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | fdisk "$drv" +g # create a new GPT partition table +n # new partition (/dev/sdx1) +1 # partition number 1 + # first sector (2048) ++$btsze # boot size partition +Y # YES +n # new partition (/dev/sdx2) +2 # partition number 2 + # default start block ++$swpsze # swap size partition +Y # YES +n # new partition (/dev/sdx3) +3 # partition number 3 + # default start block ++$rtsze # root size partition +Y # YES +n # new partition (/dev/sdx4) +4 # partition number 4 + # default start block + # all that remains +t # change partition type +1 # part 1 +1 # EFI partition type +t # change partition type +2 # partition number 2 +19 # swap partition type +w # write the partition table and quit +EOF +mkswap "$drv""2" +mkfs.fat -F32 "$drv""1" +mkfs.ext4 "$drv""3" +mkfs.ext4 "$drv""4" +sleep 2 +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 3. Mounting partitions #" +echo "# #" +echo "#=================================#" +swapon "$drv""2" +mkdir /mnt/arch +mount "$drv""3" /mnt/arch +mkdir /mnt/arch/boot +mkdir /mnt/arch/boot/efi +mount "$drv""1" /mnt/arch/boot/efi +mkdir /mnt/arch/home +mount "$drv""4" /mnt/arch/home +sleep 2 +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 4. Installing base system #" +echo "# #" +echo "#=================================#" +pacstrap /mnt/arch base base-devel pacman-contrib +sleep 1 +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 4.5 Installing some extras #" +echo "# #" +echo "#=================================#" +pacstrap /mnt/arch zip unzip p7zip vim mc alsa-utils syslog-ng mtools dostools lsb-release ntfs-3g exfat-utils git zsh +pacstrap /mnt/arch ntp cronie +pacstrap /mnt/arch grub os-prober efibootmgr +sleep 1 +clear +echo "#====== IV. INSTALLING LINUX =====#" +echo "# #" +echo "# 5. Generating fstab #" +echo "# #" +echo "#=================================#" +genfstab -U /mnt/arch > /mnt/arch/etc/fstab +sleep 2 +clear +echo "#====== V. CONFIGURING LINUX =====#" +echo "# #" +echo "# 1. Now changing root #" +echo "# #" +echo "#=================================#" +sleep 2 +sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + clear + #===== V. CONFIGURING LINUX ======# + # # + # 2. Setting time zone # + # to Paris, France, # + # for this is my time zone. # + # Change this later accordingly # + # to your own time zone # + # (Joe didn't find a quick # + # and easy way to ask you # + # about your time zone, # + # Joe hopes your can understand) # + # # + #=================================# + ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime + sleep 8 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 3. Setting hardware clock # + # and ntp again # + # # + #=================================# + hwclock --systohc + ntpdate fr.pool.ntp.org + systemctl enable ntpd + sleep 1 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 4. Localization # + # (en_US.UTF-8) # + # # + #=================================# + sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen + locale-gen + echo "LANG=en_US.UTF-8" > /etc/locale.conf + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 5. Setting hostname # + # # + #=================================# + echo "$hstnm" > /etc/hostname + echo "127.0.0.1 localhost" > /etc/hosts + echo "::1 localhost" >> /etc/hosts + echo "127.0.1.1 $hstnm.localdomain $hstnm" >> /etc/hosts + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 6. Setting root password # + # # + #=================================# + passwd +"$rtpwd" +"$rtpwd" + sleep 2 + clear + #===== IV. CONFIGURING LINUX =====# + # # + # 7. Setting up network # + # # + #=================================# + pacman -S networkmanager + Y +EOF +sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + systemctl enable NetworkManager + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 8. journald stuff # + # # + #=================================# + sed 's/#ForwardToSyslog=no/ForwardToSyslog=yes/' /etc/systemd/journald.conf > /etc/systemd/journald.conf.42 + mv /etc/systemd/journald.conf.42 /etc/systemd/journald.conf + sleep 2 +EOF +if [[ $somemore == "true" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + clear + #===== V. CONFIGURING LINUX ======# + # # + # 9. Installing # + # some more utils # + # (gst plugins, xorg...) # + # # + #=================================# + pacman -S gst-plugins-{base,good,bad,ugly} gst-libav xorg-{server,xinit,apps} xf86-input-{mouse,keyboard} xdg-user-dirs mesa xf86-video-vesa + + Y +EOF +fi +if [[ $intelamdgpu == "intel" && $somemore == "true" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 9.5 Installing # + # some more utils # + # (xf86-video) # + # # + #=================================# + pacman -S xf86-video-intel + Y + sleep 2 +EOF +fi +if [[ $intelamdgpu == "amd" && $somemore == "true" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 9.5 Installing # + # some more utils # + # (xf86-video) # + # # + #=================================# + pacman -S xf86-video-amdgpu + Y +EOF +fi +if [[ $isusr == "true" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 10. Installing sudo # + # # + #=================================# + pacman -S sudo + Y +EOF +sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + sleep 2 + clear + #===== V. CONFIGURING LINUX ======# + # # + # 11. Generating user # + # # + #=================================# + useradd -m -g wheel -s /bin/zsh $usr + passwd $usr +$usrpwd +$usrpwd + sed 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers > /etc/sudoers.42 + mv /etc/sudoers.42 /etc/sudoers + sleep 2 + exit +EOF +fi +if [[ $intelamdcpu == "intel" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + clear + #===== V. CONFIGURING LINUX ======# + # # + # 12. Installing CPU # + # microcode # + # # + #=================================# + pacman -S intel-ucode + Y +EOF +fi +if [[ $intelamdcpu == "amd" ]]; then + sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + clear + #===== V. CONFIGURING LINUX ======# + # # + # 12. Installing CPU # + # microcode # + # # + #=================================# + pacman -S amd-ucode + Y +EOF +fi +sed -e 's/\s*\([\+0-9a-zA-Z \"=#()[]{}<>,:. - \_\/?!@$%^&~`*|]*\).*/\1/' << EOF | arch-chroot /mnt/arch + sleep 2 + clear + #===== VI. CONFIGURING BOOT ======# + # # + # 1. Generating Kernel image # + # # + #=================================# + mkinitcpio -p linux + sleep 1 + clear + #===== VI. CONFIGURING BOOT ======# + # # + # 2. Configuring GRUB # + # # + #=================================# + grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck + grub-mkconfig -o /boot/grub/grub.cfg + sleep 4 + exit +EOF +echo && echo +clear +echo "#========= WORK COMPLETE =========#" +echo "# #" +echo "# Your system should now #" +echo "# be installed. #" +echo "# Thank your for using Joe's #" +echo "# ARCH LINUX #" +echo "# UEFI INSTALL UTILITY #" +echo "# #" +echo "# Your system will now reboot #" +echo "# #" +echo "#=================================#" +echo && echo +sleep 10 +umount -R /mnt/arch +reboot |