Files
ubuntu/scripts/entrypoint.sh
Ameer Hamza Khan e744481ea2
All checks were successful
continuous-integration/drone Build is passing
Changed order of execution for User and Sys init commands.
2024-07-26 08:28:33 +00:00

27 lines
535 B
Bash
Executable File

#!/usr/bin/env bash
set -x
term_handler() {
eval $USER_COMMAND_EXIT
eval $SYS_COMMAND_EXIT
exit 143; # 128 + 15 -- SIGTERM
}
# setup handler when the container is exited
trap 'kill ${!}; term_handler' SIGTERM
# setup home directory for the current user. It is useful for attaching vscode with container.
sudo mkhomedir_helper `whoami`
if [[ $LOG_FILE != "/dev/null" ]];
then
sudo touch $LOG_FILE
sudo chown -R $(id -u):$(id -g) $LOG_FILE
fi
eval $USER_COMMAND_INIT
eval $SYS_COMMAND_INIT
tail -f $LOG_FILE & wait ${!}