#!/bin/sh

tty=$1

if [ -x /sbin/agetty -o -x /bin/agetty ]; then
    # util-linux specific settings
    if [ "${tty}" = "tty1" ]; then
        if [ -e /bin/getty ]; then
            GETTY_ARGS=""
        else
            GETTY_ARGS="--noclear"
        fi
    fi
fi

BAUD_RATE=38400
TERM_NAME=linux

if [ -x /sbin/getty -o -x /bin/getty ]; then
        # busybox
        GETTY=getty
elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
        # util-linux
        GETTY=agetty
fi

exec ${GETTY} ${GETTY_ARGS} \
        "${tty}" "${BAUD_RATE}" "${TERM_NAME}"
