/usr/bin/jetring-accept 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 | #!/bin/sh
# Accepts a changeset, adding it to a directory and an index file.
set -e
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: jetring-accept changesetdir changeset" >&2
exit 1
fi
# avoid gnupg touching ~/.gnupg
GNUPGHOME=$(mktemp -d -t jetring.XXXXXXXX)
export GNUPGHOME
trap cleanup exit
cleanup () {
rm -rf "$GNUPGHOME"
}
changesetdir="$1"
changeset="$2"
if [ -n "$JETRING_SIGN" ] && [ -e "$changesetdir/index" ]; 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
mkdir -p "$changesetdir"
touch "$changesetdir/index"
basename=$(basename "$changeset")
sha1sum=$(sha1sum "$changeset" | cut -d " " -f 1)
checksum=sha256-$(sha256sum "$changeset" | cut -d " " -f 1)
if grep "^$checksum " "$changesetdir/index" ||
grep "^$sha1sum " "$changesetdir/index"; then
echo "This changeset is already included." >&2
exit 1
fi
c=1
origbasename="$basename"
while [ -e "$changesetdir/$basename" ]; do
c=$(expr "$c" + 1)
basename="$origbasename.$c"
done
echo "$checksum $basename" >> "$changesetdir/index"
mv "$changeset" "$changesetdir/$basename"
if [ -n "$JETRING_SIGN" ] || [ -e "$changesetdir/index.gpg" ] ; then
jetring-signindex "$changesetdir"
fi
|