From 2e0ee57d8b560d5ea509f16b1e02eb890c2d6b86 Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Tue, 4 Aug 2020 13:09:20 -0500
Subject: [PATCH] Added container_dev command

---
 build/bin/eic-shell              | 22 ++++++++++++++++++++++
 build/bin/ipython                | 22 ++++++++++++++++++++++
 build/bin/root                   | 22 ++++++++++++++++++++++
 containers/release/Dockerfile.in |  5 ++++-
 deploy.py                        |  1 +
 5 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100755 build/bin/eic-shell
 create mode 100755 build/bin/ipython
 create mode 100755 build/bin/root

diff --git a/build/bin/eic-shell b/build/bin/eic-shell
new file mode 100755
index 000000000..bf833d0de
--- /dev/null
+++ b/build/bin/eic-shell
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+## Boilerplate to make pipes work
+piped_args=
+if [ -p /dev/stdin ]; then
+  # If we want to read the input line by line
+  while IFS= read line; do
+    if [ -z "$piped_args" ]; then
+      piped_args="${line}"
+    else 
+      piped_args="${piped_args}
+${line}"
+    fi
+  done
+fi
+
+## Fire off the application wrapper
+if [ ${piped_args} ]  ; then
+    echo -e ${piped_args} | singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 eic-shell $@
+else
+    singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 eic-shell $@
+fi
diff --git a/build/bin/ipython b/build/bin/ipython
new file mode 100755
index 000000000..30000603d
--- /dev/null
+++ b/build/bin/ipython
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+## Boilerplate to make pipes work
+piped_args=
+if [ -p /dev/stdin ]; then
+  # If we want to read the input line by line
+  while IFS= read line; do
+    if [ -z "$piped_args" ]; then
+      piped_args="${line}"
+    else 
+      piped_args="${piped_args}
+${line}"
+    fi
+  done
+fi
+
+## Fire off the application wrapper
+if [ ${piped_args} ]  ; then
+    echo -e ${piped_args} | singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 ipython $@
+else
+    singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 ipython $@
+fi
diff --git a/build/bin/root b/build/bin/root
new file mode 100755
index 000000000..621bfae44
--- /dev/null
+++ b/build/bin/root
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+## Boilerplate to make pipes work
+piped_args=
+if [ -p /dev/stdin ]; then
+  # If we want to read the input line by line
+  while IFS= read line; do
+    if [ -z "$piped_args" ]; then
+      piped_args="${line}"
+    else 
+      piped_args="${piped_args}
+${line}"
+    fi
+  done
+fi
+
+## Fire off the application wrapper
+if [ ${piped_args} ]  ; then
+    echo -e ${piped_args} | singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 root $@
+else
+    singularity exec  /home/sjoosten/projects/eic_container/build/lib/eic.sif.2.0.4 root $@
+fi
diff --git a/containers/release/Dockerfile.in b/containers/release/Dockerfile.in
index 8134a34de..843247ca4 100644
--- a/containers/release/Dockerfile.in
+++ b/containers/release/Dockerfile.in
@@ -51,7 +51,10 @@ RUN rm -rf /usr/local && ln -s /opt/view /usr/local
 ## the environment but still provided for backward compatibility (and documentation).
 COPY eic-shell /usr/local/bin/eic-shell
 COPY eic-env.sh /etc/eic-env.sh
-COPY eic-env.sh /etc/profile.d/z10_eic-env.sh
+COPY eic-env.sh /etc/profile.d/z10_eic-env.s
+
+## also make sure we have the older container_dev command available
+COPY eic-shell /usr/local/bin/container_dev
 
 ## Setup fresh bashrc, useful for singularity
 COPY bashrc /etc/bash.bashrc
diff --git a/deploy.py b/deploy.py
index 2c838b608..dbc648021 100755
--- a/deploy.py
+++ b/deploy.py
@@ -25,6 +25,7 @@ PROJECT_NAME='eic_container'
 IMAGE_ROOT='eic'
 
 PROGRAMS = ['eic-shell',
+            'container_dev',
             'root', 
             'ipython']
 
-- 
GitLab