diff --git a/README.md b/README.md index 511d834..dabe221 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# trolley-arch-install -an automated arch install tool forked from microarch that installs plain old arch +# ezArch +An easy way to get Arch installed on your machine! + +## Contents +This script consists of two parts: +- ezarch.sh: installs the base system to your hard disk +- ezarch-chroot.sh: does post-setup of your newly installed arch system + +## Get Started +To get started, `git clone https://github.com/piotr25691/ezarch` and run `ezarch.sh`. + +Be aware that this will wipe your drive clean, so check if you got backups, or that you don't need stuff currently on your hard disk. + +## Requirements +This script requires an IDE, SCSI or SATA disk, MMC storage is not supported.

+ +### Enjoy using Arch btw! \ No newline at end of file diff --git a/ezarch-chroot.sh b/ezarch-chroot.sh new file mode 100644 index 0000000..5f0a5e2 --- /dev/null +++ b/ezarch-chroot.sh @@ -0,0 +1,54 @@ +#!/bin/bash +DEV=$1 + +# Install the GRUB bootloader +# This is the part that allows you to boot into the system. +pacman --noconfirm -Sy grub efibootmgr +if [ -e /sys/firmware/efi/efivars ] +then + grub-install --target=x86_64-efi --force $DEV +else + grub-install --target=i386-pc --force $DEV +fi +grub-mkconfig -o /boot/grub/grub.cfg + +# Ask for and set up the root password. +# Please pick something secure, or you'll get kids fucking around in your computer. +echo "Please enter your root password: " +read -s ROOTPASS +echo "root:$ROOTPASS" | chpasswd + +# Ask and setup the username and password of the regular user. +# This user will have sudo privileges, so please set up a secure password if you don't want kids fucking around in your computer. +read -p "Enter the username of your user: " USERNAME +useradd -m $USERNAME +usermod -aG wheel $USERNAME +echo "Please enter your user password: " +read -s USERPASS +echo "$USERNAME:$USERPASS" | chpasswd + + +# Enable wheel privileges for sudo +# They are disabled by default. +sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //g' /etc/sudoers + +# Create symlinks to micro +# The default text editor of choice in ezArch is Micro. +# If you want to go back to Nano, or use Vim, delete the symlinks and install the corresponding package. +ln -s $(which micro) /bin/nano +ln -s $(which micro) /bin/vim + +# Delete GRUB after setup +# GRUB packages are not needed after setup, so they will be deleted to save space. +pacman --noconfirm -R grub efibootmgr + +# Enable network services +# These services will allow you to connect to the internet. +systemctl enable dhcpcd +systemctl enable iwd +systemctl enable NetworkManager + +# Remove the chroot file +# This also saves space. +rm -rf /ezarch-chroot.sh +exit diff --git a/ezarch.sh b/ezarch.sh new file mode 100644 index 0000000..b93f6c3 --- /dev/null +++ b/ezarch.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# ezArch - An easy way to get Arch installed on your machine! +# +# This script consists of two parts: +# - ezarch.sh: installs the base system to your hard disk +# - ezarch-chroot.sh: does post-setup of your newly installed arch system +# +# To get started, run ezarch.sh +# Be aware that this will wipe your drive clean, so check if you got backups, +# or that you don't need stuff currently on your hard disk. +# +# This script requires an IDE, SCSI or SATA disk, MMC storage is not supported. +# +# Enjoy using Arch btw! + +# Prompt the user to select the device to install Arch on +# Blind assumptions caused the script to try install to a non-writable device, hence why this has been implemented. +lsblk +echo Please enter the device name to use... +read DEV + +# Ask the user for the hostname +# The hostname is the name used to identify the device on your network. +# In case of home networks, this does not really matter, but you can still name your device here. +read -p "Please enter a hostname to use: " HOSTNAME + +# Determine BIOS/UEFI mode, and partition the drive appropriately +# In the older versions of this script, only BIOS was supported. +if [ -e /sys/firmware/efi/efivars ] +then + parted ${DEV} \ mklabel gpt \ mkpart primary 1 120M \ mkpart primary 120M 100% -s + mkfs.vfat ${DEV}1 + mkfs.btrfs -f ${DEV}2 + mount -o compress-force=zstd:15 ${DEV}2 /mnt + mkdir -p /mnt/boot/efi + mkdir /mnt/etc + mount ${DEV}1 /mnt/boot/efi +else + parted ${DEV} \ mklabel msdos \ mkpart primary 1 120M \ mkpart primary 120M 100% -s + mkfs.vfat ${DEV}1 + mkfs.btrfs -f ${DEV}2 + mount -o compress-force=zstd:15 ${DEV}2 /mnt + mkdir /mnt/boot + mkdir /mnt/etc + mount ${DEV}1 /mnt/boot +fi + +# Add BTRFS to /etc/mkinitcpio.conf +# This script uses the BTRFS filesystem to allow you to save some storage. +# If you want to use EXT4 instead, look somewhere. +echo "HOOKS=(base udev autodetect modconf block filesystems fsck btrfs)" >> /mnt/etc/mkinitcpio.conf + +# Install the system +# This installs the bare minimum of packages required to install Arch. +# You can add any additional dependencies yourself afterwards. +pacstrap /mnt linux-hardened linux-firmware pacman dhcpcd sed which micro systemd-sysvcompat pam sudo gzip networkmanager iwd btrfs-progs + + +# Set up the previously selected hostname +echo $HOSTNAME >> /mnt/etc/hostname + +# Generate /etc/fstab +# This file determines the mount points and other stuff necessary for Arch to use your drive. +genfstab -U /mnt >> /mnt/etc/fstab + +# Start post-setup tasks +cp ./ezarch-chroot.sh /mnt +arch-chroot /mnt ./ezarch-chroot.sh $DEV + +# Setup is finished +# You can reboot after seeing this message, only if no commands errored out. +echo "You have successfully installed Arch Linux on your computer. You may now reboot." diff --git a/trolley-arch-chroot.sh b/trolley-arch-chroot.sh deleted file mode 100755 index a1ae4d5..0000000 --- a/trolley-arch-chroot.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -DEV=$1 - -# install grub -pacman --noconfirm -Sy grub efibootmgr -if [ -e /sys/firmware/efi/efivars ] -then - grub-install --target=x86_64-efi --force $DEV -else - grub-install --target=i386-pc --force $DEV -fi -grub-mkconfig -o /boot/grub/grub.cfg -# set up root password -echo "Please enter your root password: " -read -s ROOTPASS -echo "root:$ROOTPASS" | chpasswd -# set up normal user -read -p "Enter the username of your user: " USERNAME -useradd -m $USERNAME -usermod -aG wheel $USERNAME -echo "Please enter your user password: " -read -s USERPASS -echo "$USERNAME:$USERPASS" | chpasswd -# set up sudo -sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //g' /etc/sudoers -# create symlinks for compatibility with micro -ln -s $(which micro) /bin/nano -ln -s $(which micro) /bin/vim -# delete grub after config -pacman --noconfirm -R grub efibootmgr -# enable the network -systemctl enable dhcpcd -systemctl enable iwd -systemctl enable NetworkManager -# remove chroot file after install -rm -rf /trolley-arch-chroot.sh -exit diff --git a/trolley-arch.sh b/trolley-arch.sh deleted file mode 100755 index 5c3c10c..0000000 --- a/trolley-arch.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -lsblk -echo Please enter the device name to use... -read DEV - -# ask for hostname -read -p "Please enter a hostname to use: " HOSTNAME - -# check boot mode and create paritions appropriately -if [ -e /sys/firmware/efi/efivars ] -then - parted ${DEV} \ mklabel gpt \ mkpart primary 1 120M \ mkpart primary 120M 100% -s - mkfs.vfat ${DEV}1 - mkfs.btrfs -f ${DEV}2 - mount -o compress-force=zstd:15 ${DEV}2 /mnt - mkdir -p /mnt/boot/efi - mkdir /mnt/etc - mount ${DEV}1 /mnt/boot/efi -else - parted ${DEV} \ mklabel msdos \ mkpart primary 1 120M \ mkpart primary 120M 100% -s - mkfs.vfat ${DEV}1 - mkfs.btrfs -f ${DEV}2 - mount -o compress-force=zstd:15 ${DEV}2 /mnt - mkdir /mnt/boot - mkdir /mnt/etc - mount ${DEV}1 /mnt/boot -fi -# add btrfs to mknitcpio -echo "HOOKS=(base udev autodetect modconf block filesystems fsck btrfs)" >> /mnt/etc/mkinitcpio.conf -# install the system -pacstrap /mnt linux-hardened linux-firmware pacman dhcpcd sed which micro systemd-sysvcompat pam sudo gzip networkmanager iwd btrfs-progs -# set the hostname -echo $HOSTNAME >> /mnt/etc/hostname -# generate fstab -genfstab -U /mnt >> /mnt/etc/fstab -# perform chroot tasks -cp ./trolley-arch-chroot.sh /mnt -arch-chroot /mnt ./trolley-arch-chroot.sh $DEV -echo "You have successfully installed Arch Linux on your computer. You may now reboot."