-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSingularity.fun
39 lines (33 loc) · 1.12 KB
/
Singularity.fun
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
Bootstrap: debootstrap
OSVersion: bionic
MirrorURL: http://us.archive.ubuntu.com/ubuntu/
%help
A container with a bunch of fun programs installed.
%environment
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export PATH=/usr/games:"$PATH"
%post
apt update
apt install -y software-properties-common
apt-add-repository universe
apt update
# this sets an env variable only for this apt command
DEBIAN_FRONTEND=noninteractive apt install -y cmatrix cowsay fortune
echo "export PATH=/usr/games:$PATH" >> "$SINGULARITY_ENVIRONMENT"
# tests don't have access to the env variables that you set for the container, you have to set them again
%test
export PATH=/usr/games:"$PATH"
command -v cowsay >/dev/null 2>&1 || \
{ echo >&2 "I require cowsay but it's not installed. Aborting."; exit 1; }
command -v fortune >/dev/null 2>&1 || \
{ echo >&2 "I require fortune but it's not installed. Aborting."; exit 1; }
command -v cmatrix >/dev/null 2>&1 || \
{ echo >&2 "I require cmatrix but it's not installed. Aborting."; exit 1; }
%runscript
if [ $# -eq 0 ]
then
fortune | cowsay
else
cowsay "$@"
fi