-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
50 lines (38 loc) · 1.08 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
APP="meme-suite"
VERSION=5.1.0
OS=debian-dusty
IMAGE=singularity-"$OS"-"$APP"-v"$VERSION".sif
DEFINITION=Singularity
LIST_OF_BINARIES="meme memechip dreme glam2 momo ame centrimo spamo gomo fimo mast mcast motiph glam2scan tomtom tgene ama"
if [ -f $IMAGE ]; then
rm -fv $IMAGE
fi
sudo singularity build $IMAGE $DEFINITION
if [ ! -d $APP/v$VERSION ]; then
mkdir -p $APP/v$VERSION
fi
if [ -f $IMAGE ]; then
mv -v $IMAGE $APP/v$VERSION/
fi
cp modulefile $APP/v$VERSION/
sed -i 's|NAME_OF_THE_APPLICATION|'$APP'|g' $APP/v$VERSION/modulefile
sed -i 's|VERSION_OF_THE_APPLICATION|'$VERSION'|g' $APP/v$VERSION/modulefile
APPS=($LIST_OF_BINARIES)
for BINARY in "${APPS[@]}"
do
cat << EOF > $APP/v$VERSION/$BINARY
#!/bin/bash
IMAGE=singularity-OPERATING_SYSTEM-NAME_OF_THE_APPLICATION-vVERSION_OF_THE_APPLICATION.sif
DIRECTORY=\$(dirname \$0)
APPLICATION=$BINARY
source /containers/images/other/functions.sh
if is_compute_node; then
singularity run --app \$APPLICATION \$DIRECTORY/\$IMAGE "\$1"
else
cat /containers/images/other/MESSAGE
exit 1
fi
EOF
chmod +x $APP/v$VERSION/$BINARY
done