#!/usr/bin/env bash MODE="$1" display_usage() { echo "Usage: ${0} " echo echo "If the first argument isn't one of the above modes," echo "the arguments will be exec'd directly, i.e.:" echo echo " ${0} uptime" } if [[ "${MODE}" = "help" ]] then display_usage exit 0 fi cat << "EOF" __ __ / \ / \ ______ _ _ __ __ __ / /\ / /\ \ / __ \ | | | | / \ \ \ / / / / / / \ \ | | | | | | | | / /\ \ \ / \ \ \ \ / / | |__| | | |__| | / ____ \ | | \ \/ \ \/ / \_ ___/ \____/ /_/ \_\ |_| \__/ \__/ \ \__ \___\ by Red Hat Build, Store, and Distribute your Containers EOF venv/bin/python -m displayversion case "$MODE" in "shell") echo "Entering shell mode" exec /bin/bash ;; "config") echo "Entering config mode, only copying config-app entrypoints" cp -r ${QUAYDIR}/config_app/init/service/* /etc/service cp $QUAYDIR/config_app/init/*.sh /etc/my_init.d/ exec /sbin/my_init ;; "interactive") echo "Copying $MODE files" cp $QUAYCONF/init/*.sh /etc/my_init.d/ cp -r ${QUAYCONF}/init/service/interactive/* /etc/service exec /sbin/my_init ;; "batch") echo "Copying $MODE files" cp $QUAYCONF/init/*.sh /etc/my_init.d/ cp -r ${QUAYCONF}/init/service/batch/* /etc/service exec /sbin/my_init ;; "") echo "Copying all files" cp $QUAYCONF/init/*.sh /etc/my_init.d/ cp -r ${QUAYCONF}/init/service/interactive/* /etc/service cp -r ${QUAYCONF}/init/service/batch/* /etc/service exec /sbin/my_init ;; esac # Not a Quay mode, just exec the args. exec "$@"