diff --git a/README.md b/README.md index e4635ee..bc90c33 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ The scripts install lots of useful software. There are (4) main ways software is Pacman installs software from the "packages.conf" file. It installs software such as neovim, tmux, Go, Rust, Docker, Tailscale, Element, LibreOffice, etc. Tell me if you want other tools or submit a pull request. +Federated Computer's own packages, such as Federated Calendar, come from the `[federated]` repository on Federated Computer's Gitea. CoreDesktop adds it to /etc/pacman.conf and trusts its signing key (fingerprint `6AB7C080D87C74BEE3925A026329376994F18B4E`), so they install and update like any other pacman package. Federated Calendar is installed alongside GNOME Calendar and can invite people to events on your Core's Nextcloud calendars. + ### AUR Yay is installed as is the way AUR packages are installed and maintained. Examples include the Helium Browser and Winboat. Helium is made the default browser once; you can choose another in Settings > Apps > Default Apps. diff --git a/install.sh b/install.sh index 8ae971a..5f2850d 100755 --- a/install.sh +++ b/install.sh @@ -68,9 +68,14 @@ if [ ! -f "packages.conf" ]; then exit 1 fi source packages.conf +source remove-packages.conf echo "Starting full system setup..." +# Federated Computer's own packages (Federated Calendar, ...) +echo "Adding the Federated Computer package repo..." +ensure_federated_repo + # Bring the system fully up to date before installing anything new echo "Updating system..." sudo pacman -Sy --needed --noconfirm archlinux-keyring @@ -97,6 +102,11 @@ else echo "yay is already installed." fi +# Remove replaced packages first, so their replacements don't conflict with them +echo "Removing unwanted packages..." +remove_packages "${REMOVE_PACMAN[@]}" +remove_flatpaks "${REMOVE_FLATPAKS[@]}" + # Install packages grouped by category as defined in packages.conf echo "Installing system utilities..." install_packages "${SYSTEM_UTILS[@]}" diff --git a/packages.conf b/packages.conf index a670754..2872d9b 100644 --- a/packages.conf +++ b/packages.conf @@ -81,12 +81,9 @@ DEV_TOOLS=( git gnome-video-effects go - herdr + # The source-built herdr pins an exact zig version that Arch rarely ships + herdr-bin hugo - # cline-desktop's build aborts without an appindicator library (its PKGBUILD - # only lists one as optional); also its tray icon. Here so it's installed - # before DESKTOP builds cline-desktop. - libayatana-appindicator neovim nodejs npm @@ -107,6 +104,7 @@ DEV_TOOLS=( uv vim yazi + zig zsh ) @@ -122,15 +120,18 @@ MAINTENANCE=( DESKTOP=( bitwarden cliamp - cline-desktop + # Prebuilt: the source builds of cline-desktop and voxtype break whenever + # Arch updates rust or the libraries they compile against + cline-desktop-bin element-desktop + federated-calendar gnome gnome-tweaks helium-browser-bin kitty libreoffice-fresh sonarr-bin - voxtype + voxtype-bin winboat-bin ) diff --git a/remove-packages.conf b/remove-packages.conf index c9ba896..6e33910 100644 --- a/remove-packages.conf +++ b/remove-packages.conf @@ -4,10 +4,15 @@ # Pacman / AUR packages to remove (works for both pacman and yay packages) REMOVE_PACMAN=( alpaca-ai + # Replaced by cline-desktop-bin, herdr-bin and voxtype-bin, which conflict + # with them + cline-desktop conky-cli + herdr lmstudio-bin neofetch steghide + voxtype ) # Flatpak applications to remove diff --git a/updates.d/10-pacman.sh b/updates.d/10-pacman.sh index ad87e09..ef19b6d 100644 --- a/updates.d/10-pacman.sh +++ b/updates.d/10-pacman.sh @@ -12,6 +12,11 @@ echo "Removing unwanted packages..." remove_packages "${REMOVE_PACMAN[@]}" remove_flatpaks "${REMOVE_FLATPAKS[@]}" +# Machines installed before Federated Calendar need the repo before the -Sy +# below and install_packages, so this can't wait for a migration +echo "Checking the Federated Computer package repo..." +ensure_federated_repo || STATUS=1 + # A machine that hasn't updated in a while can have a keyring too old to verify # the new packages. Update it first; the -Su below completes this -Sy. echo "Updating Arch keyring..." diff --git a/utils.sh b/utils.sh index 1d6c702..ce42c8e 100755 --- a/utils.sh +++ b/utils.sh @@ -36,6 +36,23 @@ install_packages() { fi } +FEDERATED_REPO_URL="https://gitea.federated.computer/api/packages/Federated_Computer/arch" +FEDERATED_REPO_KEY="6AB7C080D87C74BEE3925A026329376994F18B4E" + +# Add Federated Computer's pacman repo, which Gitea serves and signs, and trust +# its key. Does nothing if both are already set up. +ensure_federated_repo() { + if ! sudo pacman-key --list-keys "$FEDERATED_REPO_KEY" &> /dev/null; then + curl -fsSL "$FEDERATED_REPO_URL/repository.key" | sudo pacman-key --add - || return 1 + sudo pacman-key --lsign-key "$FEDERATED_REPO_KEY" > /dev/null || return 1 + fi + + if ! grep -q '^\[federated\]' /etc/pacman.conf; then + printf '\n[federated]\nSigLevel = Required DatabaseRequired\nServer = %s/$repo/$arch\n' \ + "$FEDERATED_REPO_URL" | sudo tee -a /etc/pacman.conf > /dev/null || return 1 + fi +} + # Function to install pipx applications if not already installed install_pipx_apps() { local installed app status=0 @@ -64,8 +81,10 @@ remove_packages() { local packages=("$@") local to_remove=() + # Match the exact name: pacman -Q also finds a package that provides it, such + # as herdr-bin for herdr, which pacman -R won't remove by that name for pkg in "${packages[@]}"; do - if is_installed "$pkg"; then + if [ "$(pacman -Qq "$pkg" 2> /dev/null)" = "$pkg" ]; then to_remove+=("$pkg") fi done