1#!/usr/bin/env bash 2# 3# Script that places the GMT release files on the SOEST GMT ftp server. 4# 5# Temporary ftp site for pre-release files: 6GMT_FTP_URL=ftp.soest.hawaii.edu 7GMT_FTP_DIR=/export/ftp1/ftp/pub/gmtrelease 8 9if [ ! "${USER}" = "pwessel" ] && [ ! "${USER}" = "meghanj" ]; then # Place file in gmtrelease SOEST ftp release directory and set permissions 10 echo "place-release.sh: Can currently only be run by user pwessel or user meghanj" >&2 11 exit 1 12fi 13 14TOPDIR=$(pwd) 15 16if [ $# -gt 0 ]; then 17 cat <<- EOF >&2 18 Usage: place-release.sh 19 20 place-release.sh must be run from top-level gmt directory. 21 Typically run after build-release.sh has been done and that the 22 Windows installer files have been placed in pwessel staging directory. 23 EOF 24 exit 1 25fi 26if [ ! -d cmake ]; then 27 echo "place-release.sh: Must be run from top-level gmt directory" >&2 28 exit 1 29fi 30 31# 1. Get the version string 32Version=$(build/src/gmt --version) 33# 2. Build the release.sh script 34cat << EOF > /tmp/release.sh 35#!/bin/bash 36# Script to be placed in pwessel ftp/release directory and executed 37# Place macOS bundle with read permissions 38if [ -f gmt-${Version}-darwin-x86_64.dmg ]; then 39 cp -f gmt-${Version}-darwin-x86_64.dmg ../gmt/bin 40 chmod og+r ../gmt/bin/gmt-${Version}-darwin-x86_64.dmg 41fi 42if [ -f gmt-${Version}-darwin-arm64.dmg ]; then 43 cp -f gmt-${Version}-darwin-arm64.dmg ../gmt/bin 44 chmod og+r ../gmt/bin/gmt-${Version}-darwin-arm64.dmg 45fi 46# Place Windows 32-bit installer with read and execute permissions 47if [ -f gmt-${Version}-win32.exe ]; then 48 cp -f gmt-${Version}-win32.exe ../gmt/bin 49 chmod og+rx ../gmt/bin/gmt-${Version}-win32.exe 50fi 51# Place Windows 64-bit installer with read and execute permissions 52if [ -f gmt-${Version}-win64.exe ]; then 53 cp -f gmt-${Version}-win64.exe ../gmt/bin 54 chmod og+rx ../gmt/bin/gmt-${Version}-win64.exe 55fi 56# Place tar balls with read permissions 57if [ -f gmt-${Version}-src.tar.gz ]; then 58 cp -f gmt-${Version}-src.tar.gz ../gmt 59 chmod og+r ../gmt/gmt-${Version}-src.tar.gz 60fi 61# Place tar balls with read permissions 62if [ -f gmt-${Version}-src.tar.xz ]; then 63 cp -f gmt-${Version}-src.tar.xz ../gmt 64 chmod og+r ../gmt/gmt-${Version}-src.tar.xz 65fi 66# Self-destruct 67rm -f release.sh 68EOF 69# 3. Copy script to pwessel/release dir: 70scp /tmp/release.sh ${GMT_FTP_URL}:${GMT_FTP_DIR} 71# 4. Run the release.sh script 72ssh ${USER}@${GMT_FTP_URL} "bash ${GMT_FTP_DIR}/release.sh" 73# 5. Remove the local script copy 74rm -f /tmp/release.sh 75