Last active
February 22, 2021 06:50
-
-
Save fanfan54old/b3430f29eef98c8b82b0de87d12d63bc to your computer and use it in GitHub Desktop.
Custom, hard-coded installation script for Arch Linux with KDE on my DELL XPS 15 9560 (with the built-in Killer 1535 wifi card)
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/bash | |
| # Author: fanfan54 (https://gist.github.com/fanfan54/b3430f29eef98c8b82b0de87d12d63bc) | |
| # Licensed under the GNU GPL v3.0 license | |
| # Version 6 (first working version) | |
| # TODO Add sources for all the commands | |
| echo "[i] Starting custom install script for Arch Linux with KDE on my DELL XPS 15 9560..." | |
| echo "[i] THIS IS AN INTERACTIVE SCRIPT, IT IS NOT COMPLETELY AUTOMATED! Passwords will be prompted during setup!" | |
| echo "[i] Starting in 3 seconds..." | |
| sleep 3 | |
| echo "> Loading french (AZERTY) keys..." | |
| loadkeys fr-latin9 | |
| echo "> Enabling auto time update via NTP..." | |
| timedatectl set-ntp true | |
| echo "> Setting timezone to Europe/Paris..." | |
| timedatectl set-timezone Europe/Paris | |
| echo "[i] No need to create the physical GPT partitions, they'll be already here. But we have to format them" | |
| # Removed this part, as it will re-create a partition (and change its UUID, thus breaking boot, because the partition UUID has been hardcoded in the kernel boot args) | |
| # echo "> luksFormat" | |
| # cryptsetup luksFormat /dev/nvme0n1p3 | |
| echo "> open cryptlvm" | |
| cryptsetup open /dev/nvme0n1p3 cryptlvm | |
| echo "> pvcreate" | |
| pvcreate /dev/mapper/cryptlvm | |
| echo "> vgcreate..." | |
| vgcreate ARCHVG /dev/mapper/cryptlvm | |
| echo "> lvcreate" | |
| lvcreate -L 20G ARCHVG -n SWAPLV | |
| lvcreate -L 70G ARCHVG -n ROOTLV | |
| lvcreate -l 100%FREE ARCHVG -n HOMELV | |
| echo "[i] Done LVM, sleeping for 10 seconds" | |
| sleep 10 | |
| echo "> formatting partitions and swap" | |
| mkfs.ext4 /dev/nvme0n1p2 | |
| mkfs.ext4 /dev/ARCHVG/ROOTLV | |
| mkfs.ext4 /dev/ARCHVG/HOMELV | |
| mkswap /dev/ARCHVG/SWAPLV | |
| echo "> mounting root" | |
| mount /dev/ARCHVG/ROOTLV /mnt | |
| echo "> mounting home" | |
| mkdir /mnt/home | |
| mount /dev/ARCHVG/HOMELV /mnt/home | |
| echo "> swapon" | |
| swapon /dev/ARCHVG/SWAPLV | |
| echo "> mounting /boot" | |
| mkdir /mnt/boot | |
| mount /dev/nvme0n1p2 /mnt/boot | |
| echo "> mounting efi" | |
| mkdir /mnt/boot/efi | |
| mount /dev/nvme0n1p1 /mnt/boot/efi | |
| echo "> Setting mirror list to use archlinux.fr only..." | |
| echo "Server = http://mir.archlinux.fr/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist | |
| echo "[i] Done formatting and mounting, sleeping for 10 seconds" | |
| sleep 10 | |
| echo "> first pacstrap (base, base-devel, pacman-contrib)" | |
| pacstrap /mnt base base-devel pacman-contrib | |
| echo "> extra pacstrap" | |
| pacstrap /mnt linux linux-firmware mkinitcpio lvm2 dhcpcd wpa_supplicant zip unzip p7zip vim mc alsa-utils syslog-ng mtools dosfstools lsb-release ntfs-3g exfat-utils bash-completion wget | |
| echo "[i] Done downloading base and extra, sleeping for 10 seconds" | |
| sleep 10 | |
| echo "> Acquiring the custom mkinitcpio.conf..." | |
| rm -f /mnt/etc/mkinitcpio.conf | |
| wget -qO/mnt/etc/mkinitcpio.conf https://gist.github.com/fanfan54/4054c76dfe2040cca27a7aa1cb9c51e9/raw/10947960d42a313824c4c3c9e5b67639f250d3c2/arch_install_script_ap20xps_mkinitcpio.conf | |
| chmod 644 /mnt/etc/mkinitcpio.conf | |
| echo "> genfstab" | |
| genfstab -U -p /mnt >> /mnt/etc/fstab | |
| echo "> pacstrap grub" | |
| pacstrap /mnt grub os-prober efibootmgr | |
| echo "> Mounting /hostlvm (workaround for a lvm2 bug)..." | |
| mkdir /mnt/hostlvm | |
| mount --bind /run/lvm /mnt/hostlvm | |
| echo "[i] Done the pre-chroot part, small sleep of 10 seconds..." | |
| sleep 10 | |
| echo "> Acquiring the chroot install script and running it in chroot..." | |
| wget -qO/mnt/root/mychroot.sh https://gist.github.com/fanfan54/8fec2cd13bf7d992f7c064d5d0381ec5/raw/5460a943c551422d69db8556e3bcd67ab1f0715c/arch_install_script_ap20xps_chroot.sh | |
| chmod +x /mnt/root/mychroot.sh | |
| echo "> Going to chroot" | |
| arch-chroot /mnt /root/mychroot.sh | |
| echo "> Deleting junk files..." | |
| rm -f /mnt/root/mychroot.sh | |
| echo "> Unmounting" | |
| umount -r /mnt | |
| echo "[DONE] Script finished, you can reboot." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment