#!/usr/bin/sh

#*********************************************************************************************************
#*   __     __               __     ______                __   __                      _______ _______   *
#*  |  |--.|  |.---.-..----.|  |--.|   __ \.---.-..-----.|  |_|  |--..-----..----.    |       |     __|  *
#*  |  _  ||  ||  _  ||  __||    < |    __/|  _  ||     ||   _|     ||  -__||   _|    |   -   |__     |  *
#*  |_____||__||___._||____||__|__||___|   |___._||__|__||____|__|__||_____||__|      |_______|_______|  *
#* http://www.blackpantheros.eu | http://www.blackpanther.hu - kbarcza[]blackpanther.hu * Charles Barcza *
#*************************************************************************************(c)2002-2023********

case $LANG in
	hu*) 
	WARNING="HU"
	;;
	*)
	WARNING="EN"
	;;
esac

doit=doit_
bname=$(basename $0)
name=csomagkereses
dot=.bin
bin=$doit$name$dot

. /etc/blackPanther-default-apps.conf
[ "$(uname -m)" = "x86_64" ]&&LIBDIR=/usr/lib64 || LIBDIR=/usr/lib
if [ ! -n "$(echo "$PATH" | grep "$LIBDIR/blackPanther-default-apps/bin")" ]&&[ -d "$LIBDIR/blackPanther-default-apps" ]; then
    export PATH="$LIBDIR/blackPanther-default-apps/bin:$PATH"
elif [ ! -n "$(echo "$PATH" | grep "$LIBDIR/blackPanther-default-serverapps/bin")" ]&&[ -d "$LIBDIR/blackPanther-default-serverapps" ]; then
    export PATH="$LIBDIR/blackPanther-default-serverapps/bin:$PATH"
fi

if [ ! -x "$(which $bin 2>/dev/null)" ];then 
    if [ -n "$DISPLAY" ];then 
	xmsg=$(which pydialog 2>/dev/null ||which kdialog 2>/dev/null ||which bubblemsg 2>/dev/null ||which logger 2>/dev/null)
	if [ "$(echo $xmsg | sed 's|*./||')" = "bubblemsg" ];then
	    $xmsg --error "Missing component for $name. Reinstall app!"
	elif [ "$(echo $xmsg | sed 's|*./||')" = "logger" ];then
	    logger -t "$name" "Missing component for $name. Reinstall app!"
	else
	    $xmsg --title "Missing" --msgbox "Missing component for $name. Reinstall app!"
	fi
	
	else
	    echo "Missing a component for: $name Please reinstall application to fix it."
    fi
    exit 1    
fi

$bin $@

