2022-03-09 01:23:56 +01:00
|
|
|
#!/bin/bash -l
|
|
|
|
|
2022-03-09 19:48:42 +01:00
|
|
|
# Set env
|
2022-03-09 20:03:21 +01:00
|
|
|
SUSER=$USER
|
2022-03-09 01:23:56 +01:00
|
|
|
SCRIPT_HOME=$(realpath $(dirname $0))
|
2022-03-09 19:48:42 +01:00
|
|
|
SEMAPHORE_HOME=$(realpath $SCRIPT_HOME/../../../../)
|
|
|
|
echo "Building in $SEMAPHORE_HOME"
|
2022-03-09 01:23:56 +01:00
|
|
|
|
2022-03-09 20:03:21 +01:00
|
|
|
if [[ ! -f $SCRIPT_HOME/../semaphore.simg ]]; then
|
|
|
|
# Build Image
|
|
|
|
sudo bash -lc "
|
2022-03-09 19:48:42 +01:00
|
|
|
# Set env
|
|
|
|
module purge
|
|
|
|
module load singularity || echo 'Not using modules'
|
|
|
|
export SINGULARITY_BIND=${SEMAPHORE_HOME}:/mnt
|
|
|
|
|
|
|
|
# Build image
|
2022-03-09 20:03:21 +01:00
|
|
|
cd $SCRIPT_HOME/../ && singularity build semaphore.simg Singularity
|
2022-03-09 01:23:56 +01:00
|
|
|
|
2022-03-09 20:03:21 +01:00
|
|
|
# Update perms
|
|
|
|
chmod -R ${SUSER}: $SEMAPHORE_HOME"
|
|
|
|
else
|
2022-03-09 19:48:42 +01:00
|
|
|
# Build RPM
|
2022-03-09 20:03:21 +01:00
|
|
|
module load singularity || echo 'Not using modules'
|
2022-03-09 20:59:10 +01:00
|
|
|
cd ${SEMAPHORE_HOME} && singularity exec $SCRIPT_HOME/../semaphore.simg task release
|
|
|
|
chmod a+rx ${SEMAPHORE_HOME}/bin
|
|
|
|
chmod a+r ${SEMAPHORE_HOME}/bin/*
|
2022-03-09 20:03:21 +01:00
|
|
|
fi
|
2022-03-09 01:23:56 +01:00
|
|
|
|