#!/bin/bash # Build autoPROC fresh under a NEW version name on a Ra login node - the # existing install is left untouched. Version convention: - # (e.g. 20240710-2); the - release suffix is stripped to find the staged # snapshot tarball. Verifies the module loads and the licence is seen. # Usage: ./rebuild.sh [version] (default 20240710-2; run from the autoPROC module dir) set -euo pipefail V="${1:-20240710-2}" V_PKG="${V%%-*}" # snapshot date without the - release suffix CACHE=/das/work/p21/p21515/.cache/Pmodules cd "$(dirname "$0")" grep -q "^ ${V}:" files/config.yaml || { echo "ERROR: version ${V} not in files/config.yaml - add it under versions: first" >&2 exit 1 } [[ -r "autoPROC_snapshot_${V_PKG}.tar.gz" ]] || { echo "ERROR: stage the GPhL snapshot here first as autoPROC_snapshot_${V_PKG}.tar.gz" >&2 echo " (download needs GPhL credentials, see README)" >&2 exit 1 } [[ -r .licence ]] || { echo "ERROR: .licence token missing from module dir" >&2; exit 1; } # `module` is a shell function; non-login shells may lack it if ! type module >/dev/null 2>&1; then for f in /etc/profile.d/pmodules.sh /opt/psi/config/profile.bash; do [[ -r "$f" ]] && source "$f" && break done fi type module >/dev/null 2>&1 || { echo "ERROR: module command not found - run from a login shell" >&2; exit 1 } # leaked env vars from previously loaded modules cause odd build failures module purge module use unstable module load modbuild/2.1.3 # no --clean-install/-f: this is a fresh version, existing installs stay as-is modbuild build \ --tmpdir="$CACHE" --distdir="$CACHE" \ "$V" # verify: module loads, runtime deps come in, licence is active module use MX unstable module load "autoPROC/${V}" out=/tmp/autoPROC_rebuild_check.$$ process -h > "$out" 2>&1 || true head -20 "$out" rm -f "$out" echo "OK: autoPROC/${V} rebuilt; loaded modules:" module list 2>&1 | grep -Ei 'autoPROC|xds|ccp4|ImageMagick'