Skip to content

Commit

Permalink
buildmaster: Add tool to regenerate repo
Browse files Browse the repository at this point in the history
* Helpful for architectures and branches without
  haikuporter automating repo generation
  • Loading branch information
kallisti5 committed Mar 27, 2024
1 parent 537257b commit a7d5749
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions buildmaster/backend/assets/bin/update_repo
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit a7d5749

Please sign in to comment.