Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refind #63

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
![](https://img.shields.io/github/stars/classy-giraffe/easy-arch?label=Stars)
![](https://img.shields.io/github/forks/classy-giraffe/easy-arch?label=Forks)

[easy-arch](https://github.com/classy-giraffe/easy-arch) is a **bash script** that boostraps [Arch Linux](https://archlinux.org/) with sane opinionated defaults.
[easy-arch](https://github.com/classy-giraffe/easy-arch) is a **bash script** that boostraps [Arch Linux](https://archlinux.org/) with sane opinionated defaults

- **BTRFS snapshots**: you will have a resilient setup that automatically takes snapshots of your volumes based on a weekly schedule
- **LUKS2 encryption**: your data will live on a LUKS2 partition protected by a password
Expand All @@ -11,15 +11,16 @@
- **VM additions**: the script automatically provides guest tools if it detects that a virtualized environment such as VMWare Workstation, VirtualBox, QEMU-KVM is being used
- **User account setup**: a default user account with sudo permissions can be configured in order to avoid hassle in the post installation phase
- **CI checks**: ShellChecker checks every PR periodically for bash syntax errors, bad coding practices, etc...
- **rEFInd**: this build supports rEFInd out of the box, instead of GRUB

## One-step Automated Install (shorter)

### `bash <(curl -sL bit.ly/easy-arch)`
### `bash <(curl -sL t.ly/ZFid7)`

## Alternative Methods (manual)
## Manual method

```bash
wget -O easy-arch.sh https://raw.githubusercontent.com/classy-giraffe/easy-arch/main/easy-arch.sh
curl -o easy-arch.sh https://raw.githubusercontent.com/classy-giraffe/easy-arch/refind/easy-arch.sh
chmod +x easy-arch.sh
bash easy-arch.sh
```
Expand Down
37 changes: 25 additions & 12 deletions easy-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ microcode_detector

# Pacstrap (setting up a base sytem onto the new root).
info_print "Installing the base system (it may take a while)."
pacstrap -K /mnt base "$kernel" "$microcode" linux-firmware "$kernel"-headers sbctl btrfs-progs grub grub-btrfs rsync efibootmgr snapper reflector snap-pac zram-generator sudo &>/dev/null
pacstrap -K /mnt base "$kernel" "$microcode" linux-firmware "$kernel"-headers btrfs-progs refind rsync efibootmgr snapper reflector snap-pac zram-generator sudo &>/dev/null

# Setting up the hostname.
echo "$hostname" > /mnt/etc/hostname
Expand Down Expand Up @@ -393,13 +393,8 @@ cat > /mnt/etc/mkinitcpio.conf <<EOF
HOOKS=(systemd autodetect keyboard sd-vconsole modconf block sd-encrypt filesystems)
EOF

# Setting up LUKS2 encryption in grub.
info_print "Setting up grub config."
UUID=$(blkid -s UUID -o value $CRYPTROOT)
sed -i "\,^GRUB_CMDLINE_LINUX=\"\",s,\",&rd.luks.name=$UUID=cryptroot root=$BTRFS," /mnt/etc/default/grub

# Configuring the system.
info_print "Configuring the system (timezone, system clock, initramfs, Snapper, GRUB)."
info_print "Configuring the system (timezone, system clock, initramfs, Snapper, rEFInd)."
arch-chroot /mnt /bin/bash -e <<EOF

# Setting up timezone.
Expand Down Expand Up @@ -427,14 +422,32 @@ arch-chroot /mnt /bin/bash -e <<EOF
mount -a &>/dev/null
chmod 750 /.snapshots

# Installing GRUB.
grub-install --target=x86_64-efi --efi-directory=/boot/ --bootloader-id=GRUB &>/dev/null
# Installing and configuring rEFInd.
refind-install &>/dev/null

# Creating grub config file.
grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
EOF

# Setting up rEFInd.
info_print "Setting up rEFInd."
UUID=$(blkid -s UUID -o value $CRYPTROOT)
rm -rf /mnt/boot/EFI/refind/refind.conf
cat > /mnt/boot/EFI/refind/refind.conf <<EOF
timeout 20
scan_all_linux_kernels off

menuentry "Arch Linux" {
icon /EFI/refind/icons/os_arch.png
volume "Arch Linux"
loader /vmlinuz-$kernel
initrd /initramfs-$kernel.img
options "rd.luks.name=$UUID=cryptroot root=$BTRFS rootflags=subvol=@ initrd=/$microcode.img quiet splash"
submenuentry "Boot using fallback initramfs" {
initrd /initramfs-$kernel-fallback.img
}
}
EOF


# Setting root password.
info_print "Setting root password."
echo "root:$rootpass" | arch-chroot /mnt chpasswd
Expand Down Expand Up @@ -479,7 +492,7 @@ sed -Ei 's/^#(Color)$/\1\nILoveCandy/;s/^#(ParallelDownloads).*/\1 = 10/' /mnt/e

# Enabling various services.
info_print "Enabling Reflector, automatic snapshots, BTRFS scrubbing and systemd-oomd."
services=(reflector.timer snapper-timeline.timer snapper-cleanup.timer btrfs-scrub@-.timer btrfs-scrub@home.timer btrfs-scrub@var-log.timer btrfs-scrub@\\x2esnapshots.timer grub-btrfsd.service systemd-oomd)
services=(reflector.timer snapper-timeline.timer snapper-cleanup.timer btrfs-scrub@-.timer btrfs-scrub@home.timer btrfs-scrub@var-log.timer btrfs-scrub@\\x2esnapshots.timer systemd-oomd)
for service in "${services[@]}"; do
systemctl enable "$service" --root=/mnt &>/dev/null
done
Expand Down