/usr/bin/jetring-build is in jetring 0.21.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/bin/sh
# Creates a keyring from a set of changesets. Can run in incremental or
# full build mode.
set -e
incremental=
if [ "$1" = "-i" ]; then
shift 1
incremental=1
elif [ "$1" = "-I" ]; then
shift 1
incremental=1
force=1
fi
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: jetring-build [-i] keyring changesetdir" >&2
exit 1
fi
# avoid gnupg touching ~/.gnupg
GNUPGHOME=$(mktemp -d -t jetring.XXXXXXXX)
export GNUPGHOME
trap cleanup exit
cleanup () {
rm -rf "$GNUPGHOME"
}
keyring=$(readlink -f "$1") # gpg works better with absolute keyring paths
changesetdir="$2"
if [ ! -e "$changesetdir/index" ]; then
echo "$changesetdir/index not found" >&2
exit 1
fi
if [ -s "$changesetdir/index" ]; then
jetring-checksum "$changesetdir"
fi
if [ -n "$JETRING_SIGN" ]; then
JETRING_SIGN=$(readlink -f "$JETRING_SIGN")
gpg --no-auto-check-trustdb --options /dev/null \
--no-default-keyring --keyring "$JETRING_SIGN" \
--verify "$changesetdir/index.gpg" "$changesetdir/index"
fi
if [ "$incremental" ]; then
if [ ! -e "$keyring.lastchangeset" ]; then
if [ ! "$force" ]; then
echo "$keyring.lastchangeset not found, cannot do incremental update" >&2
exit 1
else
incremental=
fi
else
if [ ! -e "$keyring" ]; then
if [ ! "$force" ]; then
echo "$keyring not found, cannot do incremental update" >&2
else
incremental=
fi
else
skiptil=$(cat $keyring.lastchangeset)
echo "Skipping forward past changeset $skiptil ..."
fi
fi
else
if [ -e "$keyring" ]; then
echo "$keyring already exists, and not in incremental mode, not modifying" >&2
exit 1
fi
fi
touch "$keyring"
for changeset in $(cut -d " " -f 3 "$changesetdir/index"); do
if [ -n "$skiptil" ]; then
if [ "$changeset" = "$skiptil" ]; then
skiptil=
fi
continue
fi
echo "Applying $changesetdir/$changeset ..."
if ! jetring-apply "$keyring" "$changesetdir/$changeset"; then
echo "Failed! Leaving keyring in $keyring.error" >&2
mv -f "$keyring" "$keyring.error"
exit 1
fi
done
if [ -n "$skiptil" ]; then
echo "Did not find last applied changeset, $skiptil, incremental update failed" >&2
exit 1
fi
echo "$changeset" > "$keyring.lastchangeset"
echo "All changesets applied ok."
|