Files
fedora-infra_ansible/roles/copr/keygen/files/backup_keyring.sh
Kevin Fenzi a754144f19 Update infra pagure.io links to forge.fp.o (WIP)
This should update all the references we have to
https://pagure.io/fedora-infrastructure to the
new https://forge.fedoraproject.org/infra/tickets/ area.

Do not merge this before the migration on tuesday.

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2026-01-20 14:39:40 -08:00

28 lines
947 B
Bash

#!/bin/sh
# - used as root
# - executed hourly, overwriting the "daily file" in /backup dir
# - the Fedora Infra backup mechanism pulls that file, overwriting its own
# "daily" copy
# - it means we should always have at most a 24h-old backup
# - the root gpg keychain should have PUBLIC key with `user name`
# copr-keygen-backup-key, per
# https://forge.fedoraproject.org/infra/tickets/8904
# - fixed in https://github.com/fedora-copr/copr/issues/3532
PATH_TO_KEYRING_DIR="/var/lib/copr-keygen"
BACKUP_DIR=/backup
OUTPUT_FILE="$BACKUP_DIR/copr_keygen_keyring_$(date -I).tar.gz.gpg"
tar --exclude="*agent*" -czPf - "$PATH_TO_KEYRING_DIR" \
| gpg2 --output "$OUTPUT_FILE".tmp --encrypt \
--recipient-file /root/backup_key.asc \
&& mv "$OUTPUT_FILE.tmp" "$OUTPUT_FILE"
# shell pattern matching provides sorted output
previous=
for file in "$BACKUP_DIR"/*; do
test -z "$previous" || rm "$previous"
previous=$file
done