github.com/rigado/snapd@v2.42.5-go-mod+incompatible/cmd/snap-confine/spread-tests/release.sh (about) 1 #!/bin/bash 2 # This script creates a new release tarball 3 set -xue 4 5 # Sanity check, are we in the top-level directory of the tree? 6 test -f configure.ac || ( echo 'this script must be executed from the top-level of the tree' && exit 1) 7 8 # Record where the top level directory is 9 top_dir=$(pwd) 10 11 # Create source distribution tarball and place it in the top-level directory. 12 create_dist_tarball() { 13 # Load the version number from a dedicated file 14 local pkg_version= 15 pkg_version="$(cat "$top_dir/VERSION")" 16 17 # Ensure that build system is up-to-date and ready 18 autoreconf -f -i 19 # XXX: This fixes somewhat odd error when configure below (in an empty directory) fails with: 20 # configure: error: source directory already configured; run "make distclean" there first 21 test -f Makefile && make distclean 22 23 # Create a scratch space to run configure 24 scratch_dir="$(mktemp -d)" 25 trap 'rm -rf "$scratch_dir"' EXIT 26 27 # Configure the project in a scratch directory 28 cd "$scratch_dir" 29 "$top_dir/configure" --prefix=/usr 30 31 # Create the distribution tarball 32 make dist 33 34 # Ensure we got the tarball we were expecting to see 35 test -f "snap-confine-$pkg_version.tar.gz" 36 37 # Move it to the top-level directory 38 mv "snap-confine-$pkg_version.tar.gz" "$top_dir/" 39 } 40 41 create_dist_tarball