#!/bin/bash # Copyright (c) 2020-2021 Status Research & Development GmbH. Licensed under # either of: # - Apache License, version 2.0 # - MIT license # at your option. This file may not be copied, modified, or distributed except # according to those terms. set -e #################### # argument parsing # #################### GETOPT_BINARY="getopt" if uname | grep -qi darwin; then # macOS GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null || true) [[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; } fi ! ${GETOPT_BINARY} --test > /dev/null if [ ${PIPESTATUS[0]} != 4 ]; then echo '`getopt --test` failed in this environment.' exit 1 fi OPTS="ht:" LONGOPTS="help,tarball:" # default values TARBALL="" PKG_ARCH="" print_help() { cat < /dev/null;then printf "Please install FPM! \nhttps://fpm.readthedocs.io/en/latest/installation.html\n" exit 1 fi BIN_DIR="${PKG_IMG_DIR}/usr/bin" rm -rf "${BIN_DIR}" mkdir -p "${BIN_DIR}" for BINARY in ${BINARIES}; do tar -xzf "${TARBALL}" --strip-components 2 -C "${BIN_DIR}" "${TARBALL_TOP_DIR}/build/${BINARY}" done # delete existing packages rm -f "${PKG_PATH_DEB}" "${PKG_PATH_RPM}" fpm -s dir -t deb -n "${PKG_NAME}" \ --deb-no-default-config-files \ -v "${PKG_VERSION}" \ -C "${PKG_IMG_DIR}" \ -p "${PKG_PATH_DEB}" \ --depends lsb-release \ --after-install "${PKG_IMG_DIR}/after_install" \ --before-remove "${PKG_IMG_DIR}/before_remove" \ --after-remove "${PKG_IMG_DIR}/after_remove" \ --after-upgrade "${PKG_IMG_DIR}/after_upgrade" \ --deb-after-purge "${PKG_IMG_DIR}/deb_after_purge" \ --license "Apache 2.0 + MIT" \ --maintainer "The Nimbus Team" \ --description "Nimbus Beacon Chain / Ethereum Consensus client" \ --url "https://nimbus.team/" \ 2>/dev/null fpm -s dir -t rpm -n "${PKG_NAME}" \ -v "${PKG_VERSION}" \ -C "${PKG_IMG_DIR}" \ -p "${PKG_PATH_RPM}" \ --depends redhat-lsb-core \ --after-install "${PKG_IMG_DIR}/after_install" \ --before-remove "${PKG_IMG_DIR}/before_remove" \ --after-remove "${PKG_IMG_DIR}/after_remove" \ --after-upgrade "${PKG_IMG_DIR}/after_upgrade" \ --license "Apache 2.0 + MIT" \ --maintainer "The Nimbus Team" \ --description "Nimbus Beacon Chain / Ethereum Consensus client" \ --url "https://nimbus.team/" \ 2>/dev/null ls -l "${PKG_PATH_DEB}" "${PKG_PATH_RPM}"