forked from bluesky/bluesky-pods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch_bluesky.sh
39 lines (35 loc) · 1.27 KB
/
launch_bluesky.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
#! /usr/bin/bash
set -e
set -o xtrace
# This was a useful reference for the $DISPLAY and xauth stuff.
# https://stackoverflow.com/a/48235281/1221924
if [ -v "SSH_CONNECTION" ]; then
echo "SSH_CONNECTION is set"
# Unlike the recommendation in the linked SO post,
# we are not using docker and thus not using docker's special network.
# Instead, we use the IP of the host.
IP_ADDR=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
DISPLAY=`echo $DISPLAY | sed "s/^[^:]*\(.*\)/${IP_ADDR}\1/"`
fi
XAUTH=/tmp/.docker.xauth
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
if [ "$1" != "" ]; then
imagename=$1
else
imagename="bluesky"
fi
podman run --pod acquisition \
-ti --rm \
-v /tmp/.X11-unix/:/tmp/.X11-unix/ \
-e DISPLAY \
-v $XAUTH:$XAUTH \
-e XAUTHORITY=$XAUTH \
-v `pwd`:'/app' -w '/app' \
-v ./bluesky_config/ipython:/usr/local/share/ipython \
-v ./bluesky_config/databroker:/usr/local/share/intake \
-v ./bluesky_config/happi:/usr/local/share/happi \
-e XDG_RUNTIME_DIR=/tmp/runtime-$USER \
-e EPICS_CA_ADDR_LIST=10.0.2.255 \
-e EPICS_CA_AUTO_ADDR_LIST=no \
$imagename \
ipython3 --ipython-dir=/usr/local/share/ipython