diff options
Diffstat (limited to 'files')
-rwxr-xr-x | files/docker-entrypoint.sh | 12 | ||||
-rwxr-xr-x | files/usr/bin/sx | 30 |
2 files changed, 42 insertions, 0 deletions
diff --git a/files/docker-entrypoint.sh b/files/docker-entrypoint.sh new file mode 100755 index 0000000..f4d9f20 --- /dev/null +++ b/files/docker-entrypoint.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +set -e + +if ! whoami &> /dev/null; then + if [ -w /etc/passwd ]; then + echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd + fi +fi + +echo "Running: $@" +exec "$@" diff --git a/files/usr/bin/sx b/files/usr/bin/sx new file mode 100755 index 0000000..beac660 --- /dev/null +++ b/files/usr/bin/sx @@ -0,0 +1,30 @@ +#!/bin/bash +export TERM=xterm +pid=0 + +function display_container_header { + echo "+=====================================================" + echo "| Container : $HOSTNAME" + echo "| OS : $(</etc/redhat-release)" + echo "| kubernetes : $KUBERNETES_SERVICE_HOST" + echo "| user : $(whoami)" + echo "| home : $HOME" + echo "+=====================================================" +} + +function start_service { + echo "+=====================================================" + echo "| Container $HOSTNAME is now RUNNING" + echo "+=====================================================" + while true + do + echo "live... (next try in 1 hour)" & sleep 3600 + done +} + +if [ -n "$HOME" ]; then + [ -d "$HOME" ] || mkdir -p $HOME +fi + +display_container_header +start_service |