Skip to content

Commit c89945d

Browse files
authored
Merge pull request #3347 from boegel/fix_singularity_easybuild_user
fix running command as 'easybuild' user in generated Singularity definition file
2 parents 1301bcb + 3685f0e commit c89945d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

easybuild/tools/containers/singularity.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
}
9595
EOF
9696
97-
# change to 'easybuild' user
98-
su - easybuild
97+
# switch to 'easybuild' user for following commands
98+
# quotes around EOF delimiter are important to ensure environment variables are not expanded prematurely!
99+
su - easybuild << 'EOF'
99100
100101
# verbose commands, exit on first error
101102
set -ve
@@ -122,8 +123,8 @@
122123
mkdir -p /app/lmodcache
123124
$LMOD_DIR/update_lmod_system_cache_files -d /app/lmodcache -t /app/lmodcache/timestamp /app/modules/all
124125
125-
# exit from 'easybuild' user
126-
exit
126+
# end of set of commands to run as 'easybuild' user
127+
EOF
127128
128129
# cleanup, everything in /scratch is assumed to be temporary
129130
rm -rf /scratch/*

0 commit comments

Comments
 (0)