From 1c6f5c17f4d706a6c6f78df9f7b9cb0dccdac50a Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Sat, 23 Oct 2021 00:45:49 +0000
Subject: [PATCH] Resolve "Update sigils when using one of the pre-packaged
 detectors"

---
 containers/jug/eic-env.sh         |  9 +++++----
 containers/jug/setup_detectors.py | 10 ++++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/containers/jug/eic-env.sh b/containers/jug/eic-env.sh
index 0e07fa3a4..5df2bdaee 100755
--- a/containers/jug/eic-env.sh
+++ b/containers/jug/eic-env.sh
@@ -25,15 +25,16 @@ if [ -f /etc/jug_info ]; then
       *testing*)  sigil="*" ;;
       *) sigil="+" ;;
     esac
-    PS1_PREAMBLE="${container}${sigil}> "
-    unset sigil
+    ps1_preamble="${container}${sigil}> "
+    export PS1_SIGIL=${sigil}
+    unset ${sigil}
   fi
   unset version
   unset container
 fi
-export PS1=${PS1_PREAMBLE}'\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+export PS1=${ps1_preamble}'\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33'
-unset PS1_PREAMBLE
+unset ps1_preamble
 
 ## redefine ls and less as functions, as this is something we
 ## can import into our plain bash --norc --noprofile session
diff --git a/containers/jug/setup_detectors.py b/containers/jug/setup_detectors.py
index b732766d9..d26648cce 100755
--- a/containers/jug/setup_detectors.py
+++ b/containers/jug/setup_detectors.py
@@ -18,7 +18,12 @@ export JUGGLER_DETECTOR_VERSION=$DETECTOR_VERSION
 export JUGGLER_DETECTOR_PATH=$DETECTOR_PATH
 export JUGGLER_BEAMLINE_CONFIG=$BEAMLINE_CONFIG
 export JUGGLER_BEAMLINE_CONFIG_VERSION=$BEAMLINE_CONFIG_VERSION
-export JUGGLER_INSTALL_PREFIX=/usr/local'''
+export JUGGLER_INSTALL_PREFIX=/usr/local
+
+## modify PS1 for this detector version
+export PS1="{branch}${{PS1_SIGIL}}>${{PS1#*>}}"
+unset branch
+'''
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser()
@@ -135,7 +140,8 @@ if __name__ == '__main__':
                             data_prefix=data_dir,
                             version=cfg['version'],
                             ip=ip['config'],
-                            ip_version=ip['version']),
+                            ip_version=ip['version'],
+                            branch=branch),
                           file=f)
     print(' --> Symlinking default detector for backward compatibility')
     full_prefix='{}/{}-{}'.format(args.prefix, default_detector, default_version)
-- 
GitLab