Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions base/ubi9/.copy-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file contains a list directories or files to copy over from /home/tooling to /home/user in entrypoint.sh.
#
# For example, the following will copy /home/tooling/testfile to /home/user/testfile:
# ./testfile
#
# The goal of this file is to copy over files that cannot be used as symbolic links created by stow.
# For example, Vim does not permit .viminfo to be a symbolic link for security reasons, therefore it is copied
# over to /home/user manually without stow.
#
# When copying over directories or files from /home/tooling to /home/user using this file, remember to add the
# directory or file to .stow-local-ignore so that a symbolic link is not created.


# Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it
.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)
.bashrc
.bash_profile
24 changes: 19 additions & 5 deletions base/ubi9/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# Replace /home/tooling/* path to /home/user/* path
replace_user_home() {
echo "$1" | sed "s|^/home/tooling|$HOME|"
}

# Ensure $HOME exists when starting
if [ ! -d "${HOME}" ]; then
mkdir -p "${HOME}"
Expand All @@ -15,11 +20,20 @@ if [ ! -d "${HOME}/.config/containers" ]; then
fi
fi

# Create Sym Link for Composer Keys in /home/tooling/.config
if [ -d /home/tooling/.config/composer ] && [ ! -d "${HOME}/.config/composer" ]; then
mkdir -p ${HOME}/.config/composer
ln -s /home/tooling/.config/composer/keys.dev.pub ${HOME}/.config/composer/keys.dev.pub
ln -s /home/tooling/.config/composer/keys.tags.pub ${HOME}/.config/composer/keys.tags.pub
# Find files under /home/tooling/.config and create symlinks. The /home/tooling/.config folder
# is ignored by stow with the .stow-local-ignore file
if [ -d /home/tooling/.config ]; then
for file in $(find /home/tooling/.config -type f); do
tooling_dir=$(dirname "$file")

# Create dir in /home/user if it does not exist already
mkdir -p $(replace_user_home "$tooling_dir")

# Create symbolic link if it does not exist already
if [ ! -f $(replace_user_home $file) ]; then
ln -s $file $(replace_user_home $file)
fi
done
fi

# Setup $PS1 for a consistent and reasonable prompt
Expand Down
Loading