#!/bin/sh

# When logging in via ssh, SSH_TTY variable will be set. We will check for this environment variable to determine if it is local login vs SSH login. 

if [ "x${SSH_TTY}" != 'x' -o "x${SSH_CLIENT}" != 'x' -o "x${SSH_CONNECTION}" != 'x' ]; then

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

    if [ "x$1" == 'x-c' ]; then 
	## SSH and SCP can pass commands to be executed from SSH SHELL. 
	## This section will handle those commands.
	shift
	$@
    else
	
	exec /bin/bash --login
    fi



else
#Non-SSH, local logins. 

    if [ -f /etc/sysconfig/i18n ]; then
	. /etc/sysconfig/i18n
	unset SYSFONTACM SYSFONT consoletype
    fi
        
    if [ x${LANG} == 'x' ]; then
	export LANG='en_US.UTF-8'
    else
	export LANG
    fi

    sudo /usr/share/dell_app_init/dell_app_init.py 
    #Give the users to read a chance to the error messages if any.
    sleep 2
fi

