From fd6e1a73e9d9352e1bcc7948103d9177b209abda Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Tue, 2 Apr 2024 19:38:13 +0100 Subject: [PATCH] Properly mantain Arch Linux, new script, and fastest mirror selector --- README.md | 14 ++++++++++---- home.nix | 15 ++++++++++----- scripts/archInstall.sh | 10 ++++++++++ 3 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 scripts/archInstall.sh diff --git a/README.md b/README.md index c5cab451..f2812277 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,18 @@ curl -L https://raw.githubusercontent.com/TrudeEH/dotfiles/main/install.sh | bas ``` ## Dependencies -- Nix (installed automatically) +- Nix (installed automatically) ## Custom commands -- `extract` Extract compressed files -- `update` Update Nix and the OS. -- `reload` Rebuild the config after changing it. +- `extract` Extract compressed files +- `update` Update Nix and the OS. +- `reload` Rebuild the config after changing it. + +## Scripts +- `archinstall` Install Arch Linux from the liveCD. +```sh +curl -L https://raw.githubusercontent.com/TrudeEH/dotfiles/main/scripts/archinstall.sh | bash +``` ## Supported distros - Debian diff --git a/home.nix b/home.nix index fb7b448c..79a9cc67 100644 --- a/home.nix +++ b/home.nix @@ -89,12 +89,17 @@ echo "Updating Arch..." sudo pacman -Syu sudo pacman -Rsn $(pacman -Qdtq) - if p c pacman-contrib &>/dev/null; then - paccache -rk1 - else - sudo pacman -S pacman-contrib - paccache -rk1 + echo "Selecting the fastest mirrors..." + if [ ! "$(command -v reflector)" ]; then + sudo pacman -Syu --noconfirm reflector fi + reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist + echo "Cleaning pacman cache..." + if [ ! "$(command -v paccache)" ]; then + sudo pacman -Syu --noconfirm pacman-contrib + fi + paccache -rk1 + echo "Cleaning old logs..." sudo journalctl --vacuum-time=7d elif [ "$(grep -Ei 'fedora' /etc/*release)" ]; then echo "Updating Fedora..." diff --git a/scripts/archInstall.sh b/scripts/archInstall.sh new file mode 100644 index 00000000..8cf3018c --- /dev/null +++ b/scripts/archInstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Script to install Arch Linux from the liveCD. + +echo "[+] Installing dependencies..." +pacman -Sy --noconfirm curl reflector archlinux-keyring + +echo "[+] Selecting the fastest mirrors..." +reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist + +archinstall