-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5c6bd1
commit d464cb4
Showing
6 changed files
with
135 additions
and
78 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Things we don't care about. | ||
|
||
.built | ||
./test | ||
*~ |
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
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
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
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,99 @@ | ||
#!/bin/sh -e | ||
# | ||
# Do a signing in the directory named by $1 | ||
|
||
die() | ||
{ | ||
echo "$@" 1>&2 | ||
exit 1 | ||
} | ||
|
||
|
||
SIGN=$1 | ||
[ -d "${SIGN}" ] \ | ||
|| die "${SIGN}: Not a directory" | ||
|
||
WORK="${SIGN}/DOSS" | ||
[ -d "${WORK}" ] \ | ||
|| die "${WORK}: Work directory not found" | ||
|
||
|
||
printf "\n\nSigning\n\n" | ||
|
||
id | ||
|
||
echo | ||
ls -alh / | ||
echo | ||
ls -alh "${SIGN}" | ||
echo | ||
ls -alh "${WORK}" | ||
echo | ||
|
||
exit 99 | ||
|
||
|
||
|
||
# | ||
# Configure GPG | ||
# | ||
|
||
KEY_FILE="${WORK}/gpg-signing-key | ||
[ -f "${KEY_FILE}" -a -r "${KEY_FILE}" ] \ | ||
|| die "${KEY_FILE}: Not found" | ||
PASSPHRASE_FILE=${WORK}/gpg-signing-key-passphrase | ||
[ -f "${PASSPHRASE_FILE}" -a -r "${PASSPHRASE_FILE}" ] \ | ||
|| die "${KEY_FILE}: Not found" | ||
export GNUPGHOME="${WORK}/dot-gnupg" | ||
mkdir -p "${GNUPGHOME}" | ||
chmod 700 "${GNUPGHOME}" | ||
gpg --import < "${KEY_FILE}" | ||
# Since we're working in a fresh directory, there should be exactly one key. | ||
[ $(gpg --list-keys | awk '$1 == "uid" { print }' | wc -l) -eq 1 ] \ | ||
|| die "Too many keys in GPG" | ||
KEY_NAME=$(gpg --list-keys --with-colons \ | ||
| awk -F: '$1 == "uid" {print $10}') | ||
if [ -e '/etc/redhat-release' ] | ||
then | ||
# | ||
# Configure RPM | ||
# | ||
RPMDB="${WORK}/rpmdb" | ||
mkdir -p "${RPMDB}" | ||
chmod 700 "${RPMDB}" | ||
rpm --dbpath "${RPMDB}" --initdb | ||
rpm --dbpath "${RPMDB}" --import "${KEY_FILE}" | ||
echo "Signing RPM packages as ${KEY_NAME}:" | ||
# PORT: xargs -0 -r is GNU-specific. | ||
find "${SIGN}" -name '*.rpm' -print0 \ | ||
| xargs -0 -r rpm \ | ||
--dbpath "${RPMDB}" \ | ||
--define "_gpg_path $${GNUPGHOME}" \ | ||
--define "_gpg_name $${KEY_NAME}" \ | ||
--addsign | ||
# TODO: Does the repo data need to be rebuilt after the files are changed? | ||
elif [ -e '/etc/debian_version' ]; then | ||
# TODO: Support Debian | ||
die "Debian is not supported yet." | ||
else | ||
die "Unsupported OS" | ||
fi | ||
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