Skip to content

Commit

Permalink
Merge pull request #2703 from metalefty/v0.9-tarball-script
Browse files Browse the repository at this point in the history
Add script to make release tarball
  • Loading branch information
metalefty authored May 26, 2023
2 parents b26ca93 + 6954ab0 commit f1fa6bb
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions scripts/make_release_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
#
# Script to generate release tarball
#
# This script will generate release tarball. If the repository HEAD is not
# tagged, the script will be aborted. Target GitHub repository, branch can be
# customized by GH_* envirnment variable.
#
# Usage:
# Just execute the script. This script is intended to be run by maintainers
# so build dependencies are not taken care of.
#
# $ ./scripts/make_release_tarball.sh
# (snip)
# ===============================================
# Release tarball has been generated at:
# /tmp/tmp.q8kme7m7/xrdp-0.9.22.1.tar.gz
#
# CHECKSUM:
# 3ca220d6941ca6dab6a8bd1b50fcffffcf386ce01fbbc350099fdc83684380e0 xrdp-0.9.22.1.tar.gz
#
# Copy tarball to /home/meta/github/metalefty/xrdp? [y/N] y
#
# If the script is executed with BATCH=yes, the full path of the release
# tarball will be printed on the last line. Clip it using tail command.
#
# $ BATCH=yes ./scripts/make_release_tarball.sh | tail -n1

set -e

: ${GH_ACCOUNT:=neutrinolabs}
: ${GH_PROJECT:=xrdp}
: ${GH_BRANCH:=v0.9}
: ${BATCH:=""}

WRKDIR=$(mktemp -d)

# clean checkout
git clone --recursive --branch "${GH_BRANCH}" "https://github.com/${GH_ACCOUNT}/${GH_PROJECT}.git" "${WRKDIR}"

cd "${WRKDIR}"
git diff --no-ext-diff --quiet --exit-code # check if there's no changes on working tree
RELVER=$(git describe --tags --exact-match HEAD) # check if working HEAD refs a release tag
./bootstrap
./configure
make distcheck

echo
echo ===============================================
echo Release tarball has been generated at:
echo ${WRKDIR}/xrdp-${RELVER#v}.tar.gz
echo
echo CHECKSUM:
sha256sum xrdp-${RELVER#v}.tar.gz
echo

if [ -z "${BATCH}" ]; then
echo -n "Copy tarball to ${OLDPWD}? [y/N] "
read -t 60 copy_tarball
case "${copy_tarball}" in
[Yy]*) cp -i xrdp-${RELVER#v}.tar.gz "${OLDPWD}"; exit ;;
esac
else
echo ${WRKDIR}/xrdp-${RELVER#v}.tar.gz
fi

0 comments on commit f1fa6bb

Please sign in to comment.