#!/usr/bin/bash # SPDX-License-Identifier: MIT set -euo pipefail if (( EUID != 0 )); then printf '%s\n' 'Run enzimos-migrate with sudo.' >&2 exit 1 fi if [[ $(pacman -Q enzimos-update-client) != 'enzimos-update-client 0.1.0-160' ]]; then printf '%s\n' 'This bootstrap is for the original enzimOS ISO #5 installation.' >&2 exit 1 fi origin=https://packages.enzim.dev/enzimos-migration/x86_64 fingerprint=66CEB56F3018F39D2491A3B24C558611AFC55399 packages=( enzimos-archive-keyring-0.1.0-1-any.pkg.tar.zst enzimos-migration-bridge-0.1.0-6-x86_64.pkg.tar.zst ) umask 077 work=$(mktemp -d /run/enzimos-migrate.XXXXXX) trap 'find "$work" -depth -mindepth 1 -delete; rmdir "$work"' EXIT trap 'exit 1' HUP INT TERM cd -- "$work" mkdir gnupg printf 'trust-model direct\n' >gnupg/gpg.conf base64 -d >gnupg/pubring.gpg <<'ARCHIVE_KEY' mDMEawCQ3hYJKwYBBAHaRw8BAQdAva+84/3p8UpQic7dSQvQJebRq5Ei//0Vvbd2bGWnKXK0LGVuemltT1MgTmF0aXZlIFBhY2thZ2VzIDxwYWNrYWdlc0BlbnppbS5kZXY+iJYEExYKAD4WIQRmzrVvMBjznSSRo7JMVYYRr8VTmQUCawCQ3gIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRBMVYYRr8VTmRsjAQCP4da6I97hz0fLOvjeo554lvIk22wnzlf2W1C4wRDLZAD/b8HCEfSj5lK8XGhlG0Qc35ZrP6tu7ihFaTSoNyKBsQg= ARCHIVE_KEY gpg=(/usr/bin/gpg --homedir "$work/gnupg" --batch --no-tty --no-autostart --no-auto-key-retrieve --auto-key-locate clear) printf '%s:5:\n' "$fingerprint" | "${gpg[@]}" --import-ownertrust for archive in "${packages[@]}"; do for file in "$archive" "$archive.sig"; do curl --fail --silent --show-error --location --proto '=https' \ --proto-redir '=https' --output "$file" "$origin/$file" done "${gpg[@]}" --assert-signer "$fingerprint" --verify "$archive.sig" "$archive" done printf 'Include = /etc/pacman.conf\n[options]\nLocalFileSigLevel = Required TrustedOnly\n' >pacman.conf pacman --config "$work/pacman.conf" --gpgdir "$work/gnupg" -U -- "${packages[@]}" printf '%s\n' 'Restart enzimOS, then open Settings → Updates to review the migration.'