-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildmaster: Add tool to regenerate repo
* Helpful for architectures and branches without haikuporter automating repo generation
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |