Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Set correct time
- timedatectl set-ntp true
- # Show disks
- lsblk
- # Disk setup
- echo -n "What is the install device: "
- read -r device
- echo "Installing to $device... (Enter to continue)"
- read -r _
- echo -n "Would you like to wipe and re-partition the disk $device?(Y/n): "
- read -r wipe
- if [ ! "$wipe" = "n" ]; then
- echo "[INFO]: Wiping the partition table..."
- wipefs -a -f "$device"
- sleep 1
- fi
- clear
- echo "Please create /boot /root partitions"
- # Run cfdisk for manual partitioning
- cfdisk "$device"
- clear
- lsblk "$device"
- echo ""
- echo "Now you will specify the partitions you have created"
- # Boot partition
- echo -n "Please enter boot partition (example: /dev/sda1): "
- read -r boot
- # Root partition
- echo -n "Please enter root partition (example: /dev/sda1): "
- read -r root
- # Swap partition
- echo -n "Did you create a swap partition?(y/N): "
- read -r swap_s
- if [ "$swap_s" = "y" ]; then
- echo -n "Please enter swap partition (example: /dev/sda3): "
- read -r swap
- fi
- # Home partition
- echo -n "Did you create a home partition?(y/N): "
- read -r home_s
- if [ "$home_s" = "y" ]; then
- echo -n "Please enter home partition (example: /dev/sda4): "
- read -r home
- fi
- # Create root partition
- echo "[INFO] Formatting root partition"
- mkfs.ext4 "$root"
- echo "[INFO] Mounting root partition"
- mount "$root" /mnt
- # Create the boot partition
- echo "Do you want to use efi or legacy bios? (e/L): "
- read -r bios_s
- if [ "$bios_s" = "e" ]; then # efi
- echo "[INFO] Formatting boot partition"
- mkfs.fat -F32 "$boot"
- echo "[INFO] Mounting boot partition"
- mkdir /mnt/boot/EFI
- mount "$boot" /mnt/boot/EFI
- else # legacy
- echo "[INFO] Formatting boot partition"
- mkfs.ext4 "$boot"
- echo "[INFO] Mounting boot partition"
- mkdir /mnt/boot
- mount "$boot" /mnt/boot
- fi
- # Create swap partition
- if [ "$swap_s" = "y" ]; then
- echo "[INFO] Creating swap partition"
- mkswap "$swap"
- echo "[INFO] Mounting swap partition"
- swapon "$swap"
- fi
- # Create home partition
- if [ "$home_s" = "y" ]; then
- echo "[INFO] Creating home partition"
- mkfs.ext4 "$home"
- echo "[INFO] Mounting home partition"
- mkdir /mnt/home
- mount "$home" /mnt/home
- fi
- # Install
- echo "[INFO] Installing required packages"
- pacstrap /mnt base base-devel linux linux-firmware git vim
- # Generate fstab entries for mounted partitions
- echo "[INFO] Generating fstab entries for mounted partitions"
- genfstab -U /mnt >> /mnt/etc/fstab
- # Change root directory to arch
- echo "[INFO] Change arch root directory to /mnt"
- arch-chroot /mnt
- # Set zoneinfo
- echo "Please enter you zoneinfo (example /usr/share/zoneinfo/Europe/Warsaw): "
- read -r zoneinfo
- ln -sf "$zoneinfo" /etc/localtime
- # Sync hardware clock
- echo "[INFO] Setting hardware clock"
- hwclock --systohc
- echo "Please configure you locale, press ENTER to continue"
- read -r _
- # Set locale
- vim /etc/locale.gen
- echo "Press ENTER to continue"
- read -r _
- echo "Please enter locale that you specified (example: en_US.UTF-8): "
- read -r locale
- echo "[INFO] Setting locale"
- echo "LANG=$locale" >> /etc/locale.conf
- # Generate locales
- echo "[INFO] Generating locales"
- locale-gen
- # Set keyboard
- echo "Do you want to set keyboard layout? (y/N): "
- read -r keyboard_s
- if [ "$keyboard_s" = "y" ]; then
- echo "Do you want to see all possible keyboard layouts? (y/N): "
- read -r layouts_s
- if [ "$layouts_s" = "y" ]; then
- localectl list-keymaps
- fi
- echo "Please enter you keymap (example: us): "
- read -r keymap
- echo "[INFO] Setting new keymap"
- loocalectl set-keymap --noconvert "$keymap"
- fi
- # Hostname
- echo "Do you want to change hostname? (Y/n): "
- read -r keyboard_s
- if [ ! "$keyboard_s" = "n" ]; then
- echo "Please enter your hostname: "
- read -r new_hostname
- echo "[INFO] Setting new hostname"
- echo "$new_hostname" > /etc/hostname
- fi
- # Root password
- echo "Do you want to change root password? (Y/n): "
- read -r root_s
- if [ ! "$root_s" = "n" ]; then
- echo "[INFO] Setting root password"
- passwd
- fi
- # Install network manager and grub
- echo "[INFO] Installing networkmanager and grub"
- pacman -S networkmanager grub
- # Start network manager on start
- echo "[INFO] Setting network manager to run on start"
- systemctl enable NetworkManager
- # Configure grub
- echo "[INFO] Configuring grub"
- if [ "$bios_s" = "e" ]; then # efi bios
- pacman -S efibootmgr
- grub-instalol --target=x86_64-efit --efi-directory=/boot/EFI --bootloader-id=GRUB
- grub-mkconfig -o /boot/grub/grub.cfg
- else # legacy bios
- grub-install "$device"
- grub-mkconfig -o /boot/grub/grub.cfg
- fi
- # end
- echo "Installation has finished, you can now unmount and reboot"
- echo "Look if there were any errors, GL&HF"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement