Changeset View
Changeset View
Standalone View
Standalone View
contrib/release/debian-packages.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
export LC_ALL=C | export LC_ALL=C | ||||
set -euo pipefail | set -euo pipefail | ||||
DEFAULT_DISTROS=() | DEFAULT_DISTROS=() | ||||
# Bionic: Ubuntu 18.04 LTS | # Bionic: Ubuntu 18.04 LTS | ||||
DEFAULT_DISTROS+=("bionic") | DEFAULT_DISTROS+=("bionic") | ||||
# Focal: Ubuntu 20.04 LTS | # Focal: Ubuntu 20.04 LTS | ||||
DEFAULT_DISTROS+=("focal") | DEFAULT_DISTROS+=("focal") | ||||
DEFAULT_PPA="bitcoin-abc" | DEFAULT_ABC_PPA="bitcoin-abc" | ||||
DEFAULT_BCHN_PPA="bitcoin-abc-bchn" | |||||
DEFAULT_NETWORK="ABC" | DEFAULT_NETWORK="ABC" | ||||
DEFAULT_CONTROL_SOURCE_NAME="bitcoinabc" | DEFAULT_CONTROL_SOURCE_NAME="bitcoinabc" | ||||
DPUT_CONFIG_FILE=~/".dput.cf" | DPUT_CONFIG_FILE=~/".dput.cf" | ||||
TOPLEVEL="$(git rev-parse --show-toplevel)" | TOPLEVEL="$(git rev-parse --show-toplevel)" | ||||
KEYS_TXT="${TOPLEVEL}"/contrib/gitian-signing/keys.txt | KEYS_TXT="${TOPLEVEL}"/contrib/gitian-signing/keys.txt | ||||
help_message() { | help_message() { | ||||
Show All 9 Lines | |||||
Note: This script will prompt you to sign with your PGP key. | Note: This script will prompt you to sign with your PGP key. | ||||
-d, --dry-run Build and sign the packages, but do not push them to the PPA. | -d, --dry-run Build and sign the packages, but do not push them to the PPA. | ||||
-D, --distro <name> Name of the distribution to package for. Can be supplied multiple times. | -D, --distro <name> Name of the distribution to package for. Can be supplied multiple times. | ||||
If supplied at least once, the defaults are ignored. Defaults to: '${DEFAULT_DISTROS[@]}' | If supplied at least once, the defaults are ignored. Defaults to: '${DEFAULT_DISTROS[@]}' | ||||
-h, --help Display this help message. | -h, --help Display this help message. | ||||
-n, --network Select which network the node software will follow (ABC or BCHN). | -n, --network Select which network the node software will follow (ABC or BCHN). | ||||
-p, --ppa <ppa-name> PPA hostname. Defaults to: '${DEFAULT_PPA}'. If no config file exists at ${DPUT_CONFIG_FILE} | -p, --ppa <ppa-name> PPA hostname. Defaults to: '${DEFAULT_ABC_PPA}' for ABC and '${DEFAULT_BCHN_PPA}' for BCHN. | ||||
then one will be created using '${DEFAULT_PPA}'. Setting this option to a hostname other than | If no config file exists at ${DPUT_CONFIG_FILE} then one will be created. | ||||
the default will require that you add the necessary settings to the config file. | Setting this option to a hostname other than the default will require that you add the | ||||
necessary settings to the config file. | |||||
-v, --version <version> Set the package version. Defaults to the version returned by 'bitcoind --version'. | -v, --version <version> Set the package version. Defaults to the version returned by 'bitcoind --version'. | ||||
If set, version must be of the form: MAJOR.MINOR.REVISION[.OPTIONALPATCH] | If set, version must be of the form: MAJOR.MINOR.REVISION[.OPTIONALPATCH] | ||||
OPTIONALPATCH may be necessary when source files have changed but the version revision has not, | OPTIONALPATCH may be necessary when source files have changed but the version revision has not, | ||||
as the PPA will reject source archives of the same name. | as the PPA will reject source archives of the same name. | ||||
EOF | EOF | ||||
} | } | ||||
CONTROL_SOURCE_NAME="${DEFAULT_CONTROL_SOURCE_NAME}" | CONTROL_SOURCE_NAME="${DEFAULT_CONTROL_SOURCE_NAME}" | ||||
DISTROS=() | DISTROS=() | ||||
DRY_RUN="false" | DRY_RUN="false" | ||||
NUM_EXPECTED_ARGUMENTS=1 | NUM_EXPECTED_ARGUMENTS=1 | ||||
PACKAGE_VERSION="" | PACKAGE_VERSION="" | ||||
PPA="${DEFAULT_PPA}" | PPA="${DEFAULT_ABC_PPA}" | ||||
NETWORK="${DEFAULT_NETWORK}" | NETWORK="${DEFAULT_NETWORK}" | ||||
# Parse command line arguments | # Parse command line arguments | ||||
while [[ $# -ne 0 ]]; do | while [[ $# -ne 0 ]]; do | ||||
case $1 in | case $1 in | ||||
-d|--dry-run) | -d|--dry-run) | ||||
DRY_RUN="true" | DRY_RUN="true" | ||||
shift # shift past argument | shift # shift past argument | ||||
;; | ;; | ||||
-D|--distro) | -D|--distro) | ||||
DISTROS+=("$2") | DISTROS+=("$2") | ||||
shift # shift past argument | shift # shift past argument | ||||
shift # shift past value | shift # shift past value | ||||
;; | ;; | ||||
-h|--help) | -h|--help) | ||||
help_message | help_message | ||||
exit 0 | exit 0 | ||||
;; | ;; | ||||
-n|--network) | -n|--network) | ||||
shift | shift | ||||
case $1 in | case $1 in | ||||
ABC|BCHA) | ABC|BCHA) | ||||
NETWORK="ABC" | NETWORK="ABC" | ||||
CONTROL_SOURCE_NAME=bitcoinabc | CONTROL_SOURCE_NAME=bitcoinabc | ||||
PPA="${DEFAULT_ABC_PPA}" | |||||
;; | ;; | ||||
BCHN) | BCHN) | ||||
NETWORK="BCHN" | NETWORK="BCHN" | ||||
CONTROL_SOURCE_NAME=bitcoinabc-bchn | CONTROL_SOURCE_NAME=bitcoinabc-bchn | ||||
PPA="${DEFAULT_BCHN_PPA}" | |||||
;; | ;; | ||||
esac | esac | ||||
shift # shift past argument | shift # shift past argument | ||||
;; | ;; | ||||
-p|--ppa) | -p|--ppa) | ||||
PPA="$2" | PPA="$2" | ||||
shift # shift past argument | shift # shift past argument | ||||
shift # shift past value | shift # shift past value | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if [ -z "${SIGNER}" ]; then | ||||
echo "Error: Signer key for '${SIGNER}' not found." | echo "Error: Signer key for '${SIGNER}' not found." | ||||
exit 23 | exit 23 | ||||
fi | fi | ||||
# Generate default dput config file if none exists | # Generate default dput config file if none exists | ||||
if [ ! -f ${DPUT_CONFIG_FILE} ]; then | if [ ! -f ${DPUT_CONFIG_FILE} ]; then | ||||
echo "Info: No dput config file exists. Creating ${DPUT_CONFIG_FILE} now..." | echo "Info: No dput config file exists. Creating ${DPUT_CONFIG_FILE} now..." | ||||
cat > ${DPUT_CONFIG_FILE} <<EOF | cat > ${DPUT_CONFIG_FILE} <<EOF | ||||
[${DEFAULT_PPA}] | [${DEFAULT_ABC_PPA}] | ||||
fqdn = ppa.launchpad.net | fqdn = ppa.launchpad.net | ||||
method = ftp | method = ftp | ||||
incoming = ~bitcoin-abc/ubuntu/ppa/ | incoming = ~bitcoin-abc/ubuntu/ppa/ | ||||
login = anonymous | login = anonymous | ||||
allow_unsigned_uploads = 0 | allow_unsigned_uploads = 0 | ||||
[${DEFAULT_BCHN_PPA}] | |||||
fqdn = ppa.launchpad.net | |||||
method = ftp | |||||
incoming = ~bitcoin-abc/ubuntu/bitcoin-abc-bchn/ | |||||
login = anonymous | |||||
allow_unsigned_uploads = 0 | |||||
EOF | EOF | ||||
fi | fi | ||||
# Check that the requested PPA hostname exists | # Check that the requested PPA hostname exists | ||||
grep "\[${PPA}\]" ${DPUT_CONFIG_FILE} || { | grep "\[${PPA}\]" ${DPUT_CONFIG_FILE} || { | ||||
echo "Error: PPA hostname does not exist in ${DPUT_CONFIG_FILE}" | echo "Error: PPA hostname does not exist in ${DPUT_CONFIG_FILE}" | ||||
exit 30 | exit 30 | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |