diff --git a/base/ubi8/.stow-local-ignore b/base/ubi8/.stow-local-ignore index 1cceb80d..9a4d5ce2 100644 --- a/base/ubi8/.stow-local-ignore +++ b/base/ubi8/.stow-local-ignore @@ -1,2 +1,7 @@ # .viminfo cannot be a symlink for security reasons \.viminfo + +# We store bash related files in /home/tooling/ so they aren't overriden if persistUserHome is enabled +# but we don't want them to be symbolic links (or to cause stow conflicts). They will be copied to /home/user/ manually. +\.bashrc +\.bash_profile diff --git a/base/ubi8/Dockerfile b/base/ubi8/Dockerfile index ef9bf4cd..85c1b7c5 100644 --- a/base/ubi8/Dockerfile +++ b/base/ubi8/Dockerfile @@ -111,7 +111,11 @@ RUN \ # Create symbolic links from /home/tooling/ -> /home/user/ stow . -t /home/user/ -d /home/tooling/ && \ # .viminfo cannot be a symbolic link for security reasons, so copy it to /home/user/ - cp /home/tooling/.viminfo /home/user/.viminfo + cp /home/tooling/.viminfo /home/user/.viminfo && \ + # Bash-related files are backed up to /home/tooling/ incase they are deleted when persistUserHome is enabled. + cp /home/user/.bashrc /home/tooling/.bashrc && \ + cp /home/user/.bash_profile /home/tooling/.bash_profile && \ + chown 10001 /home/tooling/.bashrc /home/tooling/.bash_profile USER 10001 ENV HOME=/home/user diff --git a/universal/ubi8/entrypoint.sh b/universal/ubi8/entrypoint.sh index 7b050732..5a4a4e95 100755 --- a/universal/ubi8/entrypoint.sh +++ b/universal/ubi8/entrypoint.sh @@ -62,6 +62,10 @@ if [ $HOME_USER_MOUNTED -eq 0 ] && [ ! -f $STOW_COMPLETE ]; then stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /tmp/stow.log 2>&1 # Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it cp /home/tooling/.viminfo /home/user/.viminfo + # We have to restore bash-related files back onto /home/user/ (since they will have been overwritten by the PVC) + # but we don't want them to be symbolic links (so that they persist on the PVC) + cp /home/tooling/.bashrc /home/user/.bashrc + cp /home/tooling/.bash_profile /home/user/.bash_profile touch $STOW_COMPLETE fi