From 53851eb2c436b950e7fd4de669c0f557f3c4ac11 Mon Sep 17 00:00:00 2001
From: lcappelli <laura.cappelli@cnaf.infn.it>
Date: Fri, 13 May 2022 09:54:05 +0000
Subject: [PATCH] Merge user-setup.sh in provide-user.sh

---
 .devcontainer/Dockerfile             |  4 +---
 .devcontainer/assets/provide-user.sh | 18 ++++++++++++++++++
 .devcontainer/assets/user-setup.sh   | 23 -----------------------
 3 files changed, 19 insertions(+), 26 deletions(-)
 delete mode 100644 .devcontainer/assets/user-setup.sh

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index a7542b9..fbec84e 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -14,7 +14,6 @@ ENV DEV_GID ${DEV_USER_UID}
 
 COPY assets/provide-user.sh /docker/
 COPY assets/setup.sh /docker/
-COPY assets/user-setup.sh /docker/
 COPY assets/build-install-openresty.sh /docker/
 
 RUN yum update -y && \
@@ -26,5 +25,4 @@ COPY --chown=$DEV_USER:$DEV_USER assets/build-install-ngx-voms.sh /home/$DEV_USE
 
 USER $DEV_USER
 
-RUN sh /docker/build-install-openresty.sh && \
-    sh /docker/user-setup.sh
\ No newline at end of file
+RUN sh /docker/build-install-openresty.sh
\ No newline at end of file
diff --git a/.devcontainer/assets/provide-user.sh b/.devcontainer/assets/provide-user.sh
index ae8608c..d68c471 100644
--- a/.devcontainer/assets/provide-user.sh
+++ b/.devcontainer/assets/provide-user.sh
@@ -53,6 +53,24 @@ EOF
 USER_RC_PATH="/home/${USERNAME}"
 
 echo "${CODESPACES_BASH}" >> "${USER_RC_PATH}/.bashrc"
+
+cat << EOF >> "${USER_RC_PATH}/.bashrc"
+if [ -f "\${HOME}/openresty-env" ]; then
+    . \${HOME}/openresty-env
+fi
+
+if [ -d \${HOME}/bin ]; then
+  PATH=\${HOME}/bin:\${PATH}
+fi
+
+if [ -n "\${PS1}" ]; then
+    echo
+    echo "To build and install openresty with the ngx_http_voms_module run 'build-install-ngx-voms.sh'"
+    echo "'nginx-httpg_no_delegation.patch' is needed in the directory where the user runs the script"
+    echo
+fi
+EOF
+
 chown ${USERNAME}:${USERNAME} "${USER_RC_PATH}/.bashrc"
 
 echo "Done!"
diff --git a/.devcontainer/assets/user-setup.sh b/.devcontainer/assets/user-setup.sh
deleted file mode 100644
index f4ce7ea..0000000
--- a/.devcontainer/assets/user-setup.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# Copyright 2018-2022 Istituto Nazionale di Fisica Nucleare
-# SPDX-License-Identifier: EUPL-1.2
-
-set -ex
-
-cat << EOF >> ${HOME}/.bashrc
-if [ -f "\${HOME}/openresty-env" ]; then
-    . \${HOME}/openresty-env
-fi
-
-if [ -d \${HOME}/bin ]; then
-  PATH=\${HOME}/bin:\${PATH}
-fi
-
-if [ -n "\${PS1}" ]; then
-    echo
-    echo "To build and install openresty with the ngx_http_voms_module run 'build-install-ngx-voms.sh'"
-    echo "'nginx-httpg_no_delegation.patch' is needed in the directory where the user runs the script"
-    echo
-fi
-EOF
-- 
GitLab