xref: /php-src/scripts/dev/gen_verify_stub (revision 3618382d)
1#!/bin/bash
2
3# Handle GNU vs. BSD checksum utilities
4sha256sum="$(which sha256sum)"
5sha256sum="${sha256sum:-$(which shasum) -a 256}"
6
7if [ "x$1" == "x" ]
8then
9	echo "Usage: $0 <version> [email]"
10	echo "Generate the tarball verification info suitable to put into an announcement."
11	echo
12	echo "Examples"
13	echo "	$0 7.0.0beta3"
14	exit 0
15fi
16
17RELEASE_VER=$1
18
19GPG_USER=
20if [ "x$2" != "x" ]
21then
22	GPG_USER=$2
23fi
24
25if test "x$PHPROOT" == "x"; then
26    PHPROOT=.
27fi
28
29for TARBALL in "$PHPROOT/php-$RELEASE_VER.tar.bz2" "$PHPROOT/php-$RELEASE_VER.tar.gz" "$PHPROOT/php-$RELEASE_VER.tar.xz"
30do
31	if ! [ -e $TARBALL ]
32	then
33		echo "$TARBALL doesn't exist"
34		exit 3
35	fi
36
37	if [ "x$GPG_USER" == "x" ]
38	then
39		gpg --armor --detach-sign $TARBALL
40	else
41		gpg -u $GPG_USER --armor --detach-sign $TARBALL
42	fi
43done
44
45for TARBALL in "$PHPROOT/php-$RELEASE_VER.tar.bz2" "$PHPROOT/php-$RELEASE_VER.tar.gz" "$PHPROOT/php-$RELEASE_VER.tar.xz"
46do
47	basename $TARBALL
48	echo "SHA256 hash: `$sha256sum $TARBALL | cut -d' ' -f1`";
49	echo PGP signature:
50	cat $TARBALL.asc
51	echo -e "\n"
52done
53
54exit 0
55