# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# It's NOT good idea to change this file unless you know what you
# are doing. Much better way is to create custom.sh shell script in
# /etc/profile.d/ to make custom changes to environment. This will
# prevent need for merging in future updates.

# By default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
	umask 002
else
	umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    i='${USER}@${HOSTNAME%%.*}:$([[ "${PWD}" =~ ^"${HOME}"(/|$) ]] && echo "~${PWD#${HOME}}" || echo "${PWD}")'
    case $TERM in
	xterm*)
	    PROMPT_COMMAND='echo -ne "\033]0;'${i}'\007"'
	    ;;
	screen)
	    PROMPT_COMMAND='echo -ne "\033_'${i}'\033\\"'
	    ;;
	*)
	    ;;
    esac
    unset i

    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

    # You might want to have e.g. tty in prompt (e.g. more virtual machines)
    # and console windows
    # If you want to do so, just add e.g.
    # if [ "$PS1" ]; then
    #   PS1="[\u@\h:\l \W]\\$ "
    # fi
    # to your custom modification shell script in /etc/profile.d/ directory
    
    if [ -z "$loginsh" ]; then # We're not a login shell
	# Not all scripts in profile.d are compatible with other shells
	# TODO: make the scripts compatible or check the running shell by
	# themselves.
	if [ -n "${BASH_VERSION}${KSH_VERSION}${ZSH_VERSION}" ]; then
            for i in /etc/profile.d/*.sh; do
	        if [ -r $i ]; then
	            . $i
	        fi
	    done
	    unset i
	fi
    else
	LIST="
	/etc/profile.d/10blackPanther-release.sh
	/etc/profile.d/10lang.sh
	/etc/profile.d/20bash-completion.sh
	/etc/profile.d/20mc.sh
	/etc/profile.d/20screen.sh
	/etc/profile.d/PackageKit.sh
	/etc/profile.d/blackPanther-default-apps.sh
	/etc/profile.d/blackPanther-default-serverapps.sh
	/etc/profile.d/ccache.sh
	/etc/profile.d/gawk.sh
	/etc/profile.d/java.sh
	/etc/profile.d/lang.sh
	"
            for i in $LIST; do
	        if [ -r $i ]; then
	            . $i
	        fi
	    done
	    unset i
	
    fi
fi

read LINES COLUMNS < <(stty size)
if [ -n "$COLUMNS" ];then
 [ -x /usr/bin/linux_logo ]&& linux_logo
fi

if [ "$COLUMNS" -gt "70" ];then
CENTER=$(expr $COLUMNS / 3 / 3)
for space in `seq $CENTER` ;do echo -en " " ;done
case $LANG in
	hu*) 
	    echo -n "[ ** Üdvözöljük a blackPanther OS csodálatos világában ** ]"
echo ""
echo ""
	;;
	*)
	    echo -n "[ *** Welcome to blackPanther OS Wonderful World *** ]"
echo ""
echo ""
	;;
esac
fi

if [ ! -n "$(pidof Xorg)" ]; then
    case $LANG in
	hu*) echo " 
	Figyelmeztetés! 
        A grafikus felület nem fut. Az indításához használja a: 'szolgaltatasok dm ujrainditas' vagy 
        a beállításokhoz a 'beallitas vga' paracsokat. Elérhető utasításokhoz írd be és üss entert: parancsok
        "
	;;
	*) echo " 
	Warning! 
        The graphical interface does not run. To start use: 'services dm restart' or  use for 
        display settings 'settings vga' commands. For list available cmd, type and press enter: commands
        "
	;;
    esac
fi

unset loginsh
