#!/usr/bin/env bash
# Redirect standard error to standard output since calamares doesn't
# capture stderr
exec 2>&1

pacman-key --init

# Update cachyos-keyring first since archlinux-keyring is taken from cachyos
# repo. Also try to make multiple attempts in case of failures due to unsynced
# mirrors.
for ((i=0; i<5; i++)); do pacman -Sy --noconfirm --needed cachyos-keyring && break; done
for ((i=0; i<5; i++)); do pacman -Sy --noconfirm --needed archlinux-keyring && break; done

pacman-key --populate
