Newer
Older
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
#!/bin/bash
# Exit on any error. More complex thing could be done in future
# (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error)
set -e
echo ""
echo "[INFO] Executing entrypoint..."
echo "[INFO] Sourcing env in /opt/lofarsoft/lofarinit.sh..."
source /opt/lofarsoft/lofarinit.sh
echo "[INFO] Creating /tmp/lofarhome to be used as lofar home"
mkdir /tmp/lofarhome
echo "[INFO] Initialising /tmp/lofarhome with configuration files"
cp -a /home/vanilla_lofar/* /tmp/lofarhome
echo "[INFO] Moving to /home/lofar and setting as home"
cd /home/lofar
export HOME=/home/lofar
echo "[INFO] Setting new prompt @prefactor3 container"
echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@prefactor3@\h:\w\$ "' > /tmp/lofarhome/.bashrc
# Set entrypoint command
if [ "x$@" == "x" ]; then
COMMAND="/bin/bash"
else
COMMAND="$@"
fi
# Start!
echo -n "[INFO] Will execute entrypoint command: "
echo $COMMAND
echo ""
echo "=============================================================="
echo "| Welcome to the Prefactor3 container! |"
echo "=============================================================="
echo ""
echo "You are now in /home/lofar with write access as user \"$(whoami)\"."
echo ""
echo "Remember that contents inside this container, unless stored"
echo "on a persistent volume mounted from you host machine, will"
echo "be wiped out when exiting the container."
echo ""
exec $COMMAND