From a7d5749a1be7ce02b650410163f279f5eb30d96d Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 27 Mar 2024 14:34:10 -0500 Subject: [PATCH] buildmaster: Add tool to regenerate repo * Helpful for architectures and branches without haikuporter automating repo generation --- buildmaster/backend/assets/bin/update_repo | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 buildmaster/backend/assets/bin/update_repo diff --git a/buildmaster/backend/assets/bin/update_repo b/buildmaster/backend/assets/bin/update_repo new file mode 100755 index 00000000..c5cfebc5 --- /dev/null +++ b/buildmaster/backend/assets/bin/update_repo @@ -0,0 +1,38 @@ +#!/bin/bash +# Utility to regenerate and resign repository +# (haikuporter generally does this, however this tool simplifies doing it manually) + +BASE_DIR=/var/packages +REPO_SIGNING_SECRETS="/run/secrets/repo_signing" + +if [ $# -ne 2 ]; then + echo "" + echo "usage: $0 [branch] [architecture]" + exit 1; +fi + +if [[ ! -d $BASE_DIR/repository/$1 ]]; then + echo "Invalid branch!" + exit 1 +fi + +if [[ ! -d $BASE_DIR/repository/$1/$2 ]]; then + echo "Invalid architecture!" + exit 1 +fi + +cd $BASE_DIR/repository/$1/$2/current/ +package_repo create repo.info packages/* +sha256sum repo | awk '{ print $1 }' > repo.sha256 + +if [ -f $REPO_SIGNING_SECRETS/privatekey ] && [ -f $REPO_SIGNING_SECRETS/privatekeypass ] +then + touch /tmp/haiku-secret.key && chmod 600 /tmp/haiku-secret.key + echo "untrusted comment: minisign encrypted secret key" > /tmp/haiku-secret.key + cat $REPO_SIGNING_SECRETS/privatekey >> /tmp/haiku-secret.key + SIGFLAGS="$SIGFLAGS $(cat $REPO_SIGNING_SECRETS/privatekeypass)" + cat $REPO_SIGNING_SECRETS/privatekeypass | minisign -s /tmp/haiku-secret.key -Sm repo + rm /tmp/haiku-secret.key +fi + +echo "$BASE_DIR/repository/$1/$2/current repository regenerated!"