2020-10-15 21:31:50 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-11-16 15:07:16 +08:00
|
|
|
# Exit immediately for non zero status
|
2020-10-15 21:31:50 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Ensure $HOME exists when starting
|
|
|
|
if [ ! -d "${HOME}" ]; then
|
|
|
|
mkdir -p "${HOME}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup $PS1 for a consistent and reasonable prompt
|
2021-03-17 15:51:28 +08:00
|
|
|
if [ -w "${HOME}" ] && [ -d /etc/skel ]; then
|
|
|
|
cp /etc/skel/.bash* "${HOME}"
|
2020-10-15 21:31:50 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Add current (arbitrary) user to /etc/passwd and /etc/group
|
|
|
|
if ! whoami &> /dev/null; then
|
|
|
|
if [ -w /etc/passwd ]; then
|
|
|
|
echo "${USER_NAME:-user}:x:$(id -u):0:${USER_NAME:-user} user:${HOME}:/bin/bash" >> /etc/passwd
|
|
|
|
echo "${USER_NAME:-user}:x:$(id -u):" >> /etc/group
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-07-08 15:43:45 +08:00
|
|
|
set +e
|
2023-02-09 17:32:31 +08:00
|
|
|
if [ -f "/etc/profile.d/devtoolset-8.sh" ]; then
|
|
|
|
source "/etc/profile.d/devtoolset-8.sh"
|
2021-07-08 15:43:45 +08:00
|
|
|
fi
|
|
|
|
|
2023-02-09 17:32:31 +08:00
|
|
|
if [ -f "/etc/profile.d/llvm-toolset-8.sh" ]; then
|
|
|
|
source "/etc/profile.d/llvm-toolset-8.sh"
|
2021-07-08 15:43:45 +08:00
|
|
|
fi
|
2021-11-17 10:35:20 +08:00
|
|
|
|
|
|
|
# Exit immediately for non zero status
|
2021-07-08 15:43:45 +08:00
|
|
|
set -e
|
|
|
|
|
2020-10-15 21:31:50 +08:00
|
|
|
exec "$@"
|