Cleaning up and adding documentation.
This commit is contained in:
parent
fb7e77c25f
commit
d6c942f7df
140
install.sh
140
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=$(</tmp/dev)2 && i=( $(lsblk | grep "$main" | tail -n+1 | awk '{print $4}') ) && szmn="${i%?}"
|
||||
|
||||
# Creating physical volume.
|
||||
echo "Creating physical volume."
|
||||
pvcreate /dev/mapper/lvm &&
|
||||
|
@ -194,20 +205,13 @@ echo
|
|||
|
||||
# Creating logical volumes.
|
||||
echo "Creating logical volumes for root and home."
|
||||
echo
|
||||
|
||||
lvcreate -L ${szrt}G -n root main &&
|
||||
lvcreate -l 100%FREE -n home main &&
|
||||
echo
|
||||
|
||||
echo "Logical volumes successfully created."
|
||||
echo
|
||||
|
||||
echo "Creating the filesystem."
|
||||
echo
|
||||
|
||||
boot=${dev}1
|
||||
|
||||
mkfs.fat -F 32 -n UEFI /dev/$boot &&
|
||||
echo "Filesystem for boot successfully created."
|
||||
echo
|
||||
|
@ -218,37 +222,32 @@ echo
|
|||
|
||||
mkfs.ext4 -L home /dev/mapper/main-home &&
|
||||
echo "Filesystem for home successfully created."
|
||||
echo "Done."
|
||||
echo
|
||||
|
||||
echo "Mounting.."
|
||||
echo
|
||||
|
||||
mount /dev/mapper/main-root /mnt
|
||||
mkdir /mnt/boot
|
||||
mkdir /mnt/home
|
||||
mount /dev/$boot /mnt/boot
|
||||
mount /dev/mapper/main-home /mnt/home
|
||||
|
||||
mount /dev/mapper/main-root /mnt &&
|
||||
mkdir /mnt/boot &&
|
||||
mkdir /mnt/home &&
|
||||
mount /dev/$boot /mnt/boot &&
|
||||
mount /dev/mapper/main-home /mnt/home &&
|
||||
echo "Mounting complete."
|
||||
echo
|
||||
|
||||
lsblk
|
||||
lsblk | grep "$dev"
|
||||
echo
|
||||
|
||||
# Updating mirrors using reflector.
|
||||
echo "Updating mirrors.."
|
||||
echo
|
||||
reflector --verbose --latest 10 --country Germany --age 24 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
|
||||
reflector --verbose --latest 10 --country Germany --age 24 --protocol https --sort rate --save /etc/pacman.d/mirrorlist &&
|
||||
#reflector --verbose --latest 10 --age 24 --protocol https --sort rate --save /etc/pacman.d/mirrorlist &&
|
||||
echo
|
||||
echo "Done."
|
||||
echo
|
||||
|
||||
# Installing base system.
|
||||
echo "Installing basic packages.."
|
||||
echo
|
||||
#pacstrap /mnt base base-devel firefox konsole linux linux-firmware linux-zen lvm2 networkmanager nano plasma-desktop sddm sddm-kcm &&
|
||||
pacstrap /mnt base firefox konsole linux linux-firmware linux-zen lvm2 nano networkmanager plasma-desktop sddm sddm-kcm sudo &&
|
||||
echo
|
||||
echo "Base system installed."
|
||||
echo
|
||||
|
||||
|
@ -256,14 +255,16 @@ echo
|
|||
echo "Generating fstab."
|
||||
genfstab -Up /mnt > /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 <<EOF >/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
|
||||
|
|
Loading…
Reference in New Issue