From 776e213c9f5e6c4b0d7c35f04d9af478200dabb3 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Fri, 10 Sep 2021 15:04:16 -0400 Subject: [PATCH] KASM-1860 Add SHELL_EXEC environment variable for terminal image - This command will be called when the terminal launches via .bashrc --- dockerfile-kasm-terminal | 7 +++++++ docs/terminal/README.md | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dockerfile-kasm-terminal b/dockerfile-kasm-terminal index 6ebd8d1..3481773 100644 --- a/dockerfile-kasm-terminal +++ b/dockerfile-kasm-terminal @@ -13,6 +13,13 @@ RUN apt-get update && apt-get install -y tmux screen nano dnsutils zip RUN echo "set -g mouse on" > $HOME/.tmux.conf && chown 1000:1000 $HOME/.tmux.conf +### Update .bashrc to run an arbitrary command if specified as an environment variable +RUN echo "if [ ! -z \"\${SHELL_EXEC}\" ] && [ \"\${TERM}\" == \"xterm-256color\" ] ; \n\ +then \n\ + set +e \n\ + eval \${SHELL_EXEC} \n\ +fi " >> $HOME/.bashrc && chown 1000:1000 $HOME/.bashrc + ### Install Ansible COPY ./src/ubuntu/install/ansible $INST_SCRIPTS/ansible/ RUN bash $INST_SCRIPTS/ansible/install_ansible.sh && rm -rf $INST_SCRIPTS/ansible/ diff --git a/docs/terminal/README.md b/docs/terminal/README.md index 632a72f..e979db6 100644 --- a/docs/terminal/README.md +++ b/docs/terminal/README.md @@ -8,4 +8,5 @@ This Image contains a browser-accessible version of [xfce4-terminal](https://doc # Environment Variables -* `APP_ARGS` - Additional arguments to pass to the application when launched. +* `TERMINAL_ARGS` - Additional arguments to pass to the application when launched. +* `SHELL_EXEC`- A command to run when the terminal starts