From d6c942f7df420fe41112fb4fd95651be4f79438f Mon Sep 17 00:00:00 2001 From: proledatarian Date: Tue, 15 Feb 2022 17:00:02 +0000 Subject: [PATCH] Cleaning up and adding documentation. --- install.sh | 140 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 58 deletions(-) diff --git a/install.sh b/install.sh index 95d7849..8aae166 100644 --- a/install.sh +++ b/install.sh @@ -21,12 +21,13 @@ echo read -p "Do you want to continue? Type [Y]es or [N]o. " -n 1 -r echo # (optional) move to a new line if [[ ! $REPLY =~ ^[Yy]$ ]] -then +thenarne exit 1 fi echo # Selecting disk. +echo "1. PARTITIONING" echo "Please select a disk to partition:" echo @@ -45,6 +46,7 @@ do break done +echo # Separate values by spaces. IFS=' ' @@ -56,10 +58,13 @@ szmn="${array[1]%?}" # Setting partition size. echo "Your system partition has a size of $szmn GB." -echo "What size should your root partition have?" +echo "What size should your root partition have (GB) ?" read szrt echo +echo "2. ENCRYPTION" +echo + # Setting encryption password. echo "Choose a strong password for encrypting the primary partition:" while [ -z "$pwcr" ]; do @@ -79,11 +84,17 @@ break done echo +echo "3. HOSTNAME" +echo + # Setting hostname. echo "Before installing the system, please enter a hostname:" read host echo +echo "4. ROOT PASSWORD" +echo + # Setting root password. echo "Choose a password for the root account:" while [ -z "$pwr" ]; do @@ -103,8 +114,11 @@ break done echo +echo "4. USER" +echo + # Setting username -echo "And please enter a username:" +echo "Please enter a username:" read user echo @@ -126,8 +140,9 @@ fi break done +echo -echo "System is getting installed.." +echo "5. INSTALLING SYSTEM.." echo # Starting partitioning. @@ -164,7 +179,6 @@ main=${dev}2 # Encrypting partition. echo "Encrypting system partition. This might take a while." echo - echo -en "$pwcr\n$pwcr" | cryptsetup -c aes-xts-plain -s 512 luksFormat /dev/$main && echo "Partition successfully encrypted." echo @@ -179,9 +193,6 @@ echo lsblk | grep "$dev" echo -# Lol, this part: -#main=$( /mnt/etc/fstab && echo "Installed fstab." +echo # Setting hostname. -echo $host > /mnt/etc/hostname -echo "Hostname set." +echo "Setting hostname" +echo $host > /mnt/etc/hostname && +echo "Done." +echo # Setting locale. echo "Setting and generating locale." -echo #localegen=$(cat /mnt/etc/locale.gen) cat </mnt/etc/locale.gen en_US.UTF-8 UTF-8 @@ -271,42 +272,47 @@ en_US.UTF-8 UTF-8 EOF #echo "${localegen}" >>/mnt/etc/locale.gen arch-chroot /mnt locale-gen -echo "LANG=en_US.UTF-8" >/mnt/etc/locale.conf +echo "LANG=en_US.UTF-8" >/mnt/etc/locale.conf && #echo "LANG=de_DE.UTF-8" >/mnt/etc/locale.conf -echo "KEYMAP=de-latin1" > /mnt/etc/vconsole.conf -echo +echo "KEYMAP=de-latin1" > /mnt/etc/vconsole.conf && echo "Done." +echo # Editing mkinitcpio.conf. echo "Editing /etc/mkinitcpio.conf." echo sed -i '7s/.*/MODULES=(ext4)/' /mnt/etc/mkinitcpio.conf && sed -i '52s/.*/HOOKS=(base udev autodetect modconf block keyboard keymap encrypt lvm2 filesystems fsck shutdown)/' /mnt/etc/mkinitcpio.conf && -echo echo "Done." +echo # Creating inital ramdisk. echo "Creating inital ramdisk for linux-zen." -echo arch-chroot /mnt mkinitcpio -p linux-zen && echo "Done." +echo # Enable network and display manager. echo "Enabling Networkmanager and display manager (sddm)." -echo arch-chroot /mnt systemctl enable NetworkManager sddm && -echo echo "Done." +echo # Set root password echo "Setting root password:" echo -en "$pwrt\n$pwrt" | arch-chroot /mnt passwd +echo "Done." +echo # Install bootloader. -arch-chroot /mnt bootctl install +echo "Installing systemd-boot." +arch-chroot /mnt bootctl install && +echo "Done." +echo # Set bootloader entry. -cat << EOF > /mnt/boot/loader/entries/arch.conf +echo "Setting up bootloader." +cat << EOF > /mnt/boot/loader/entries/arch.conf && title Arch Linux linux /vmlinuz-linux-zen #initrd /amd-ucode.img @@ -320,7 +326,7 @@ options init=/usr/lib/systemd/systemd EOF # Set bootloader fallback entry. -cat << EOF > /mnt/boot/loader/entries/arch-fallback.conf +cat << EOF > /mnt/boot/loader/entries/arch-fallback.conf && title Arch Linux Fallback linux /vmlinuz-linux initrd /initramfs-linux-fallback.img @@ -331,18 +337,16 @@ options init=/usr/lib/systemd/systemd EOF # Set bootloader. -echo "timeout 1" >> /mnt/boot/loader/loader.conf -echo "default arch.conf" >> /mnt/boot/loader/loader.conf +echo "timeout 1" >> /mnt/boot/loader/loader.conf && +echo "default arch.conf" >> /mnt/boot/loader/loader.conf && +echo "Done." +echo -# Set X locale. -arch-chroot /mnt localectl --no-convert set-keymap de-latin1-nodeadkeys +# Set X locale and keyboard alyout. +echo "Setting locale and keyboard layout." +arch-chroot /mnt localectl --no-convert set-keymap de-latin1-nodeadkeys && -# Set username, password and group. -arch-chroot /mnt useradd -m $user && -echo -en "$pwur\n$pwur" | arch-chroot /mnt passwd $user && -arch-chroot /mnt gpasswd -a $user wheel - -cat << EOF > /mnt//etc/X11/xorg.conf.d/00-keyboard.conf +cat << EOF > /mnt//etc/X11/xorg.conf.d/00-keyboard.conf && # Written by systemd-localed(8), read by systemd-localed and Xorg. It's # probably wise not to edit this file manually. Use localectl(1) to # instruct systemd-localed to update it. @@ -354,15 +358,35 @@ Section "InputClass" Option "XkbVariant" "deadgraveacute" EndSection EOF +echo "Done." +echo +# Set username, password and group. +echo "Adding user." +arch-chroot /mnt useradd -m $user && +echo -en "$pwur\n$pwur" | arch-chroot /mnt passwd $user && +arch-chroot /mnt gpasswd -a $user wheel && sed -i '82s/.*/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers +echo "Done." +echo -mkdir /mnt/etc/sddm.conf.d +# Enabling sddm auto-login. +echo "Enabling auto-login." +mkdir /mnt/etc/sddm.conf.d && +cat << EOF > /mnt/etc/sddm.conf.d/autologin.conf +[Autologin] +User=$user +Session=plasma +EOF +echo "Done." +echo -echo "[Autologin]" >> /mnt/etc/sddm.conf.d/autologin.conf -echo "User=$user" >> /mnt/etc/sddm.conf.d/autologin.conf -echo "Session=plasma" >> /mnt/etc/sddm.conf.d/autologin.conf +# Unmounting and rebooting. +echo "Unmounting system." +umount /mnt/boot && +umount /mnt/home &&# +echo "Done." +echo -umount /mnt/boot -umount /mnt/home +echo "Rebooting" reboot