summaryrefslogtreecommitdiff
path: root/templates/bash/template.sh
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-24 20:19:30 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-24 20:24:51 +0300
commit83db7a29fd4432f28adcd01039ba468716cacc10 (patch)
tree5a3ac67abf2e8375b39a0e56222b57a5a46975e5 /templates/bash/template.sh
parentf53fa38f71391771011aef390961aa92b08389c3 (diff)
downloadsubplot-83db7a29fd4432f28adcd01039ba468716cacc10.tar.gz
feat: set up a minimal environment in the code templates
Diffstat (limited to 'templates/bash/template.sh')
-rw-r--r--templates/bash/template.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/templates/bash/template.sh b/templates/bash/template.sh
index 286e56f..89958d4 100644
--- a/templates/bash/template.sh
+++ b/templates/bash/template.sh
@@ -176,6 +176,8 @@ scenario_{{ loop.index }}() {
scendir="$(mktemp -d -p "$_datadir")"
cd "$scendir"
+ export HOME="$scendir"
+
ctx_new
cleanups[0]=''
steps[0]=''
@@ -227,6 +229,15 @@ scenario_{{ loop.index }}() {
{% endfor %}
#############################################################################
+# Make the environment minimal.
+
+unset $(env | sed 's/=.*//')
+export PATH=/bin:/usr/bin
+export SHELL=/bin/sh
+export HOME=/ # Will be set to datadir for each scenario.
+
+
+#############################################################################
# Run the scenarios.
if [ "$#" = 0 ]