forked from giovtorres/slurm-docker-cluster
-
Notifications
You must be signed in to change notification settings - Fork 3
/
prepare-installation-files.sh
61 lines (44 loc) · 1.85 KB
/
prepare-installation-files.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
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -o errexit
set -o nounset
if [ $# -ne 1 ]; then
echo "Error: Wrong number of arguments"
echo "Usage:"
echo "bash ./prepare-installation-files.sh /path/to/where/empty-directory-to-store-installation-files"
exit 1
fi
if [ ! -d $1 ]; then
echo "Error: The given argument $1 is not a directory"
exit 1
fi
if [ -n "$(ls -A $1)" ]; then
echo "Error: The directory $1 is not empty"
exit 1
fi
if ! podman image exists localhost/mysql-with-norouter; then
echo The container image localhost/slurm-with-norouter does not exit.
echo Please build the container first
exit 1
fi
if ! podman image exists localhost/slurm-with-norouter; then
echo The container image localhost/slurm-with-norouter does not exit.
echo Please build the container first
exit 1
fi
mkdir -p $1/etc_munge
mkdir -p $1/etc_slurm
# Extra container images is later added with the script add-extra-containerimage.sh
mkdir -p $1/extra_containerimages
# If SELINUX is enabled let us label the files in the volume
volumeArg=$(selinuxenabled 2> /dev/null && echo :Z || true)
# Create the file munge.key
podman run --rm --volume=$1/etc_munge:/etc/munge${volumeArg} localhost/slurm-with-norouter /usr/sbin/create-munge-key
podman unshare chown 0:0 $1/etc_munge/munge.key
podman save localhost/mysql-with-norouter > $1/mysql-with-norouter.tar
podman save localhost/slurm-with-norouter > $1/slurm-with-norouter.tar
podman run --rm --volume=$1/etc_slurm:/target${volumeArg} localhost/slurm-with-norouter cp -r /etc/slurm/. /target
chmod 600 $1/etc_slurm/slurmdbd.conf
curl -o $1/norouter --fail -L https://github.com/norouter/norouter/releases/latest/download/norouter-$(uname -s)-$(uname -m)
chmod +x $1/norouter
curl -o $1/sshocker --fail -L https://github.com/AkihiroSuda/sshocker/releases/latest/download/sshocker-$(uname -s)-$(uname -m)
chmod +x $1/sshocker