Skip to content

Commit

Permalink
rebuild-todo: Add the --import-keys option
Browse files Browse the repository at this point in the history
Allows to import PGP keys for packages source verification into the user's keyring before rebuilding packages (including support for offloaded builds).
  • Loading branch information
Antiz96 committed Jan 9, 2025
1 parent bd8075b commit e0073b1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions package/rebuild-todo
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ usage() {
-o, --offload Use offloaded builds
-h, --help Show this help text
--dry-run Show the offload-build and commitpkg being ran
--import-keys Import PGP keys for packages source verification into the user's keyring
--no-build Don't build PKGBUILD
--no-publish Don't run commitpkg after building
--no-bump Don't bump pkgrel before building (default bumps pkgrel)
Expand Down Expand Up @@ -63,6 +64,7 @@ STDIN=0
NO_BUMP=0
NO_BUILD=0
PACKAGES=0
IMPORT_KEYS=0
NO_PUBLISH=0
EDIT_PKGBUILD=0
CONTINUE=0
Expand Down Expand Up @@ -112,6 +114,9 @@ while ((${#})); do
-d|--dry-run)
DRY=1
;;
--import-keys)
IMPORT_KEYS=1
;;
--testing|--staging)
REPO="$key"
;;
Expand Down Expand Up @@ -219,6 +224,22 @@ read <&1

pkgctl repo clone "${packages[@]}"

if ((IMPORT_KEYS)); then
echo "Importing PGP keys..."
# Only add paths that actually have key(s) to import and ignore paths that don't, don't exit on error
key_paths=($(find "${packages[@]/%//keys/pgp}" -type f 2>/dev/null || true))

if [[ "${#key_paths[@]}" -ne 0 ]]; then
if [[ -z "$OFFLOAD" ]]; then
cat "${key_paths[@]}" | gpg --import
else
cat "${key_paths[@]}" | ssh build.archlinux.org gpg --import
fi
else
echo "No PGP key to import"
fi
fi

for pkg in "${packages[@]}"; do
pushd "$pkg" &>/dev/null

Expand Down

0 comments on commit e0073b1

Please sign in to comment.