#!/usr/bin/bash

# 1. Real interactive TTY login -> Launch appctl menu
if [ -t 0 ] && [ -z "$SSH_ORIGINAL_COMMAND" ]; then
    exec /usr/bin/appctl
fi

# 2. If an explicit SSH command was passed (e.g., 'date')
if [ -n "$SSH_ORIGINAL_COMMAND" ]; then
    exec /bin/bash -c "$SSH_ORIGINAL_COMMAND"
fi

# 3. SCP / SFTP / Pipeline Fallback
# If there's no TTY and no explicit command, it's a file transfer pipeline.
# We must pass "$@" to preserve underlying SSH execution arguments.
exec /bin/bash "$@"
