#!/bin/sh

. /etc/blackPanther-default-apps.conf


#* http://www.blackpantheros.eu | http://www.blackpanther.hu - kbarcza[]blackpanther.hu * Charles Barcza *
#*************************************************************************************(c)2002-2025********
set -x

export PATH=$PATH:/usr/sbin:/usr/bin
if [ "$BP_DEFAULT_APPS" = "yes" ]; then

    if [ ! -n "$(echo "$PATH" | grep "/usr/lib/blackPanther-default-apps/bin" 2>/dev/null)" ]&&[ -d /usr/lib/blackPanther-default-apps/ ]; then
        export PATH="/usr/lib/blackPanther-default-apps/bin:$PATH"
    fi
    if [ ! -n "$(echo "$PATH" | grep "/usr/lib/blackPanther-default-serverapps/bin" 2>/dev/null)" ]&&[ -d /usr/lib/blackPanther-default-serverapps/ ]; then
        export PATH="/usr/lib/blackPanther-default-serverapps/bin:$PATH"
    fi
fi

export TEXTDOMAIN="default-apps"
export TEXTDOMAINDIR="/usr/share/locale"

[ -n "$(echo $@|grep -v grep | grep DeBUG)" ]&&set -x
DEBUG=`echo "${@}" |grep DeBUG`
dbg()
{
    	if [ -n "$DEBUG" ]; then
       	echo
       	$SETCOLOR_FAIL
       	echo -e "DBG >> ${@}"
       	$SETCOLOR_NORMAL
    	fi
}

b=`basename $0`

case $LANG in 
	hu*) 
	    notroot=$notroot_hu
	    effectset="3D felület ${b}a..."
	    userauth="Felhasznaloazonositas ${b}a..."
	    booting="Rendszerbetolto ${b}a ..."
	    bootsplash="Inditokepernyo ${b}a ..."
	    clock="Ora ${b}a ..."
	    netsetup="Halozatok ${b}a ..."
	    harddisks="Rogzitett meghajtok ${b}a ..."
	    removables="Eltavolithato meghajtok ${b}a ..."
	    dvbset="DVB ${b}a ..."
	    loginman="Bejelentkezeskezelo ${b}a ..."
	    firewall="Tuzfal ${b}a ..."
	    systemfonts="Rendszerfontok ${b}a ..."

	    EFFECTS="3D effektek"
	    AUTH="Hitelesítés"
	    ACCESS="Hozzáférés"
	    POLICY="Engedélyek"
	    USERS="Felhasználók"
	    LOGIN="Beléptetés"
	    BOOT="Rendszerbetöltő"
	    MONITOR="Monitor"
	    TUZFAL="Tűzfal"
	    INTERNET="Internet kapcsolat"
	    NETWORK="Hálózati központ"
	    NETPROF="Hálózati profilok"
	    NFS="Nfs beállítások"
	    VPN="VPN hálózat"
	    PROXY="Proxy beállítás"
	    WLAN="Vezetéknélküli (Wifi)"
	    SMB="Samba megosztás"
	    CLOCK="Dátum/Idő"
	    HDD="Merevlemezek"
	    REMOVABLE="Eltávolítható eszk."
	    DVB="DVB vevők"
	    SOUND="Hangbeállítások"
	    SCAN="Szkennerek"
	    UPS="Szünetmentes"
	    DEVICES="Hardverek"
	    KEYB="Billentyűzet"
	    MOUSE="Egér/Tábla"
	    TUNER="TV/Rádio"
	    LOGINMAN="Bejelentkezéskezelő"
	    FONTS="Fontok"
	    NETSHARE="Internet megosztás"
	    HOST="Hosztnév"
	    HOSTS="Hosztnevek"
	    LOCAL="Helyi beállítások"
	    LOGS="Naplók"
	    SERVICES="Szolgáltatások"
	    
	    ERRORMSG="Hiba történt vagy nem lett semmi kiválasztva, próbálja újra vagy jelentse a hibát"
	    CELNAME="Beállítóprogramok"
	    CC="blackPanther Egyszerú Beállítóközpont"

	;;
	*) 
	    notroot=$notroot_en
	    effectset="The 3D interface settings..."
	    userauth="Userauthentication settings..."
	    booting="Systemloader settings..."
	    bootsplash="The bootsplash settings..."
    	    clock="The clock settings..."
	    netsetup="The network settings..."
	    harddisks="Harddisks settings..."
	    removables="Removable devices settings..."
	    dvbset="DVB devices settings..."
	    loginman="Loginmanager settigns..."
	    firewall="Firewall settings..."
	    systemfonts="Systemfonts settings..."
	
	    EFFECTS="3D effects"
	    AUTH="Authentication"
	    ACCESS="Access control"
	    POLICY="Policys"
	    LOGIN="Autologin"
	    USERS="Usermanager"
	    BOOT="Bootloader"
	    MONITOR="Monitor"
	    TUZFAL="Firewall"
	    INTERNET="Internet Connection"
	    NETWORK="Network Center"
	    NETPROF="Netprofiles"
	    NFS="Nfs settings"
	    VPN="VPN network"
	    PROXY="Proxy settings"
	    WLAN="Wireless network"
	    SMB="Samba share"
	    CLOCK="Date/Time"
	    HDD="Harddisks"
	    REMOVABLE="Removable"
	    DVB="DVB reciver"
	    SOUND="Sound settings"
	    SCAN="Scanners"
	    UPS="UPS"
	    DEVICES="System Hardvares"
	    KEYB="Keyboard"
	    MOUSE="Mouse/Tablet"
	    TUNER="TV/Radio"
	    LOGINMAN="Loginmanager"
	    FONTS="Fonts install"
	    NETSHARE="Internet Share"
	    HOST="Hostname"
	    HOSTS="Hosts"
	    LOCAL="Localisation"
	    LOGS="Logs"
	    SERVICES="Services"
	    
	    
	    ERRORMSG="An error occured or does not selected a item pleaser try again or report problem"

	    CELNAME="Properties"
	    CC="blackPanther Easy Control Center"

	;;
esac

inp=$(echo $0 | grep easycc)
if [ -n "$inp" -o "$1" = "-x" ];then

chkapp() {
    app=$(which pydialog 2>/dev/null || which zenity 2>/dev/null || which kdialog  2>/dev/null || which echo)
    app=$(echo $app | sed 's|.*/||')
    notice=$(which nofify-send 2>/dev/null || which bubblemsg 2>/dev/null || which echo)
    notice=$(echo $notice | sed 's|.*/||')

    if [ "$notice" = "bubblemsg" ];then
	notify_critic="bubblemsg error"
	notify_low="bubblemsg"
    elif [ "$notice" = "nofify-send" ];then
	notify_critic="notify-send -u critical"
	notify_low="notify-send -u low"
    elif [ "$notice" = "echo" ];then
	notify_critic="echo"
	notify_low="$notify_critic"
    fi
    
    if [ "$1" = "stop" ]&& [ ! -n "$app" ];then
	$notify_critic  "Error" "The grapical interface install failed! Please try install manual command to the zenity!!"
	exit    
    elif [ ! -n "$app" ];then
	 $notify_low "Missing"  "The graphical engine not installed on system. Try install now!"
	sleep 2
	installing zenity --engine=gurpmi2
	chkapp stop
    fi
}    

mutat () {
sh $0 $1
exit
}

chkapp
if [ "$app" = "zenity" ];then
SELECTION=`zenity --list --height="450" --text "$CC" --column="$CELNAME" "$EFFECTS" "$AUTH" "$ACCESS" "$POLICY" "$USERS" "$LOGIN" "$BOOT" "$MONITOR" "$TUZFAL" "$INTERNET" \
"$NETWORK" "$NETPROF" "$NFS" "$VPN" "$PROXY" "$WLAN" "$SMB" "$CLOCK" "$HDD" "$REMOVABLE" "$DVB" "$SOUND" "$SCAN" "$UPS" "$DEVICES" "$KEYB" "$MOUSE" "$TUNER" "$LOGINMAN" "$FONTS" \
"$NETSHARE" "$HOST" "$HOSTS" "$LOCAL" "$LOGS" "$SERVICES" 2>/dev/null`
ret=$?
test $ret -ne 0 && exit
elif [ "$app" = "pydialog" ];then
echo x
SELECTION=`pydialog --title "$CC" --radiolist "$CELNAME" "$EFFECTS" "$EFFECTS" false "$AUTH" "$AUTH" false "$ACCESS" "$ACCESS" false "$POLICY" "$POLICY" false "$USERS" "$USERS" false "$LOGIN" "$LOGIN" false "$BOOT" "$BOOT" false \
"$MONITOR" "$MONITOR" false "$TUZFAL" "$TUZFAL" false "$INTERNET" "$INTERNET" false "$NETWORK" "$NETWORK" false "$NETPROF" "$NETPROF" false "$NFS" "$NFS" false "$VPN" "$VPN" false "$PROXY" "$PROXY" false "$WLAN" "$WLAN" false \
"$SMB" "$SMB" false "$CLOCK" "$CLOCK" false "$HDD"  "$HDD" fasle "$REMOVABLE" "$REMOVABLE" false "$DVB" "$DVB" false "$SOUND" "$SOUND" false "$SCAN" "$SCAN" false "$UPS" "$UPS" false "$DEVICES" "$DEVICES" false "$KEYB" "$KEYB" false \
"$MOUSE" "$MOUSE" false "$TUNER" "$TUNER" false "$LOGINMAN" "$LOGINMAN" false "$FONTS" "$FONTS" false "$NETSHARE" "$NETSHARE" false "$HOST" "$HOST" false "$HOSTS" "$HOSTS" false "$LOCAL" "$LOCAL" false "$LOGS" "$LOGS" false "$SERVICES" "$SERVICES" false`
ret=$?
test $ret -ne 0 && exit
fi

echo "$SELECTION - $EFFECTS"
#exit
if [ "$SELECTION" = "$EFFECTS" ];then
	beallitas effektek
        mutat $1
elif [ "$SELECTION" = "$AUTH" ];then
        beallitas auth
        mutat $1
elif [ "$SELECTION" = "$ACCESS" ];then
        beallitas access
        mutat $1
elif [ "$SELECTION" = "$POLICY" ];then
        beallitas engedelyek
        mutat $1
elif [ "$SELECTION" = "$USERS" ];then
        beallitas felhasznalo
        mutat $1
elif [ "$SELECTION" = "$LOGIN" ];then
        beallitas bejelentkezes
        mutat $1
elif [ "$SELECTION" = "$BOOT" ];then
        beallitas boot
        mutat $1
elif [ "$SELECTION" = "$MONITOR" ];then
	beallitas monitor
        mutat $1
elif [ "$SELECTION" = "$TUZFAL" ];then
	beallitas tuzfal
        mutat $1
elif [ "$SELECTION" = "$INTERNET" ];then
        beallitas network
        mutat $1
elif [ "$SELECTION" = "$NETWORK" ];then
        beallitas netcent
        mutat $1
elif [ "$SELECTION" = "$NETPROF" ];then
        beallitas netprofil
        mutat $1
elif [ "$SELECTION" = "$NFS" ];then
        beallitas nfs
        mutat $1
elif [ "$SELECTION" = "$VPN" ];then
        beallitas vpn
        mutat $1
elif [ "$SELECTION" = "$PROXY" ];then
        beallitas proxy
        mutat $1
elif [ "$SELECTION" = "$WLAN" ];then
        beallitas wifi
        mutat $1
elif [ "$SELECTION" = "$SMB" ];then
        beallitas samba
        mutat $1
elif [ "$SELECTION" = "$CLOCK" ];then
        beallitas ora
        mutat $1
elif [ "$SELECTION" = "$HDD" ];then
        beallitas lemez
        mutat $1
elif [ "$SELECTION" = "$REMOVABLE" ];then
        beallitas removable
        mutat $1
elif [ "$SELECTION" = "$DVB" ];then
        beallitas dvb
        mutat $1
elif [ "$SELECTION" = "$SOUND" ];then
        beallitas hang
        mutat $1
elif [ "$SELECTION" = "$SCAN" ];then
        beallitas lapolvaso
        mutat $1
elif [ "$SELECTION" = "$UPS" ];then
        beallitas ups
        mutat $1
elif [ "$SELECTION" = "$DEVICES" ];then
        beallitas hardverek
        mutat $1
elif [ "$SELECTION" = "$KEYB" ];then
        beallitas kbd
        mutat $1
elif [ "$SELECTION" = "$MOUSE" ];then
        beallitas eger
        mutat $1
elif [ "$SELECTION" = "$TUNER" ];then
        beallitas tuner
        mutat $1
elif [ "$SELECTION" = "$LOGINMAN" ];then
        beallitas gdm
        mutat $1
elif [ "$SELECTION" = "$FONTS" ];then
        beallitas font
        mutat $1
elif [ "$SELECTION" = "$NETSHARE" ];then
        beallitas megoszt
        mutat $1
elif [ "$SELECTION" = "$HOST" ];then
        beallitas hoszt
        mutat $1
elif [ "$SELECTION" = "$HOSTS" ];then
        beallitas hosztok
        mutat $1
elif [ "$SELECTION" = "$LOCAL" ];then
        beallitas helyi
        mutat $1
elif [ "$SELECTION" = "$LOGS" ];then
        beallitas naplo
        mutat $1
elif [ "$SELECTION" = "$SERVICES" ];then
        beallitas szolgaltatas
        mutat $1
  else
  zenity --error --text="$ERRORMSG"
  exit
fi

fi

video_settings() {
echo "Settings"
if [ -n "$DISPLAY" ];then 
     pydialog --title "$(gettext 'Warning!')" --yesno \
    "$(gettext 'This is Xorg Server custom settings <b>ONLY for Experts.</b> <br>The modification will rewrite the system settings. If you do not know what can you do, then will you kill your screen and you get a blank screen.')" || exit
else
    echo
    echo "$(gettext 'This is Xorg Server custom settings, ONLY for Experts! Any modifications will rewrite the system settings...')"
    echo "$(gettext 'If you do not know what can you do, then will you kill your screen, and you will get a blank screen...')"
    echo
    echo "$(gettext 'Do you wish to install this program?')"
select yn in $(gettext Yes) $(gettext No) $(gettext Cancel); do
    case $yn in
        Yes|Igen ) echo $(gettext "The potentional risk is accepted...") ; break;;
        No|Cancel|Nem|Mégsem) exit;;
    esac
done

fi

VGANUM="$(drakcheck vganum 2>/dev/null)"
if [ "$VGANUM" = "0" ]||[ "$VGANUM" = "1" ];then
    /usr/bin/drakx11 2>/dev/null 
    exit
else 

if [ "2" -le "$(drakcheck vganum 2>/dev/null)" ]&&[ "$(drakcheck optimus 2>/dev/null)" = "no" ];then

    LIST=$(drakcheck vga 2>/dev/null | awk '{print $1}' | sed 's|N|/ N|')
     pydialog --title "$(gettext 'Warning!')" --yesnocancel \
    "$(gettext '<h2>Multiple VGA devices detected!</h2>') \
     $LIST :\
     $(gettext 'This is NOT compatible with Optimus!<br>Do you want try run Xorg settings?!<br> - Yes = Continue and install optimus components<br> - No = Run Xorg config wizard <br> - Cancel = Just exit <br><br>If you do not know what can you do, then will you kill your screen and you get a blank screen...')"
     RET=$?

     if [ "$RET" = "0" ];then
      if [ -n "$DISPLAY" ];then 
    	if [ -n "$(rpm -q optimus-manager-qt >/dev/null || echo 1)" ];then
	installing optimus-manager-qt 
	    pydialog --title "$(gettext 'Warning!')" --msgbox \
	    "$(gettext '<h2>Restart requires...</h2>') \
		$(gettext 'Restart system to apply new settings...<br>') \
    	    $(gettext 'Optimus-Manager will available your menu and on system tray after restart.') "
        else
            pydialog --title "$(gettext 'Warning!')" --msgbox \
		"$(gettext '<h2>Already installed...Availabele on system-tray!</h2>') \
	    $(gettext 'If you have any problem with Optimus-Manager, remove first and run settings again...') "
       fi

      elif [ "$RET" = "1" ];then
    	 /usr/bin/drakx11 2>/dev/null
    	 exit
      elif [ "$RET" = "2" ];then
        echo "$(gettext 'Multiple VGA: Selected exit..')"
        exit
      fi
     else
       	if [ -n "$(rpm -q optimus-manager-qt >/dev/null || echo 1)" ];then
		installing optimus-manager-qt 
       	else
	    echo "$(gettext 'If you have any problem with Optimus-Manager, remove first and run settings again...') "

       	fi

     fi


elif [ "2" -le "$(drakcheck vganum 2>/dev/null)" ]&&[ "$(drakcheck optimus 2>/dev/null)" = "old" ];then

    LIST=$(drakcheck vga 2>/dev/null | awk '{print $1}' | sed 's|N|/ N|')
     pydialog --title "$(gettext 'Warning!')" --yesnocancel \
    "$(gettext '<h2>Multiple VGA devices detected!</h2>') \
     $LIST :\
     $(gettext 'This is OLD Optimus method detected!<br><b>Bumblebee</b> recommend use for this system! Do you wan continue install?<br> - Yes = Continue and install Bumblebee<br> - No = Run Xorg config wizard <br> - Cancel = Just exit <br><br>If you do not know what can you do, then will you kill your screen and you get a blank screen...')"
     RET=$?
 
     if [ "$RET" = "1" ];then
    	 /usr/bin/drakx11 2>/dev/null
    	 exit
     elif [ "$RET" = "2" ];then
        echo "$(gettext 'Multiple VGA: Selected exit..')"
        exit
     fi
     
     if [ -n "$DISPLAY" ];then 
	if [ -n "$(rpm -q bumblebee-ui >/dev/null || echo 1)" ];then
	    installing bumblebee
    	    pydialog --title "$(gettext 'Warning!')" --msgbox \
	    "$(gettext '<h2>Restart requires...</h2>') \
	    $(gettext 'Restart system to apply new settings...<br>') \
    	    $(gettext 'Bumblebe will available your menu and on system tray after restart.') "
	  else
    	    pydialog --title "$(gettext 'Warning!')" --msgbox \
	    "$(gettext '<h2>Already installed...</h2>') \
	    $(gettext 'If you have any problem with Bumblebee, remove first and run settings again...') "
	fi
	
      else 

    # Commandline

	if [ -n "$(rpm -q bumblebee >/dev/null || echo 1)" ];then
	    installing bumblebee 
	    echo "$(gettext 'Restart system to apply new settings...')"
	    echo "$(gettext 'Bumblebee available your menu and on system tray after restart.') "
	    echo "$(gettext 'For manual gpu test ex.: optirun glxspheres64') "
	    echo 
	else
	    echo
    	    echo "$(gettext 'Already installed...')"
	    echo "$(gettext 'If you have any problem with Optimus-Manager, remove first and run settings again...') "
	    echo
	fi
    fi


elif [ "2" -le "$(drakcheck vganum 2>/dev/null)" ]&&[ "$(drakcheck optimus 2>/dev/null)" = "yes" ];then
echo "$(drakcheck vganum 2>/dev/null) = $(drakcheck optimus 2>/dev/null)"
    # I.

 if [ -n "$DISPLAY" ];then 
    
    LIST=$(drakcheck vga 2>/dev/null | awk '{print $1}' | sed 's|N|/ N|')
    pydialog --title "$(gettext 'Warning!')" --yesnocancel \
    "$(gettext '<h2>Dual Optimus VGA is detected!</h2>') \
     $LIST :\
     $(gettext 'Thats correct?!<br>Do you wish to continue progress of Nvidia Optimus settings?<br> - Yes = Continue and install optimus components<br> - No = Run Xorg config wizard <br> - Cancel = Just exit <br><br> If you do not know what can you do, then will you kill your screen and you get a blank screen...')"
     RET=$?
     if [ "$RET" = "1" ];then
    	 /usr/bin/drakx11 2>/dev/null
    	 exit
     elif [ "$RET" = "2" ];then
        echo "$(gettext 'DUAL VGA: Selected exit..')"
        exit
     fi

 else
  # Commandline
    echo "$(gettext 'Dual Optimus VGA is detected...')"
    echo "$(gettext 'Thats correct?! Do you wish to continue progress?')"
    select ync in $(gettext Yes) $(gettext No) $(gettext Cancel); do
	case $yn in
    	    Yes ) echo $(gettext "Optimus settings is accepted...") ; break;;
    	    No )  /usr/bin/drakx11 2>/dev/null ; exit;;
    	    Cancel ) exit ;;
	esac
    done

 fi

    # II.

 if [ -n "$DISPLAY" ];then 
    if [ -n "$(rpm -q optimus-manager-qt >/dev/null || echo 1)" ];then
	installing optimus-manager-qt 
        pydialog --title "$(gettext 'Warning!')" --msgbox \
	"$(gettext '<h2>Restart requires...</h2>') \
	$(gettext 'Restart system to apply new settings...<br>') \
	$(gettext 'Optimus-Manager will available your menu and on system tray after restart.') "
    else
        pydialog --title "$(gettext 'Warning!')" --msgbox \
	"$(gettext '<h2>Already installed...</h2>') \
	$(gettext 'If you have any problem with Optimus-Manager, remove first and run settings again...') "
    fi

 else 
 # Commandline

    if [ -n "$(rpm -q optimus-manager >/dev/null||echo 1)" ];then
	installing optimus-manager 
	echo "$(gettext 'Restart system to apply new settings...')"
	echo "$(gettext 'Optimus-Manager available your menu and on system tray after restart.') "
	echo "$(gettext 'For manual vga switching: optimus-manager --switch integrated/or/nvidia') "
	echo 
    else
	echo
	echo "$(gettext 'Already installed...')"
	echo "$(gettext 'If you have any problem with Optimus-Manager, remove first and run settings again...') "
	echo
    fi

  fi
 fi 
fi

exit 0

}

case $* in 
    3d|3D|effe)
	echo "$effectset"
	/usr/bin/drak3d 2>/dev/null
	;;
    *azonositas|hitelesit*|auth*)
	echo "$userauth"
	/usr/bin/drakauth 2>/dev/null
	;;
    autologin|login|automatikusbelelp*|belep*|bejelentk*)
	echo "$booting"
	/usr/bin/drakautologin 2>/dev/null
	;;
    *betolto*|indito|boot|grub)
	echo "$booting"
	[ ! -n "$DISPLAY" ]&&/usr/bin/drakboot 2>/dev/null
	[ -n "$DISPLAY" ]&&/usr/bin/drakgrub 2>/dev/null
	;;
    splash*|inditokep*|bootspl*)
	echo "$bootsplash"
	/usr/bin/drakboot --splash 2>/dev/null
	;;
    ora*|ido*|time|clock)
	echo "$clock"
	/usr/bin/drakclock 2>/dev/null
	;;
    halozat*|kapcsolat*|internet*|network*)
	echo "$netsetup"
	if [ ! -n "$DISPLAY" ];then 
	    if [ -x /usr/bin/nmtui ];then
		/usr/bin/nmtui 2>/dev/null
	    elif [ -x /usr/bin/drakconnect ];then
		/usr/bin/drakconnect 2>/dev/null
	    else 
		echo "$(gettext 'Missing Connection Manager!')"
	    fi
	fi	
	if [ -n "$DISPLAY" ];then
	    if [ "$KDE_FULL_SESSION" = "true" ];then
		kcmshell5 kcm_networkmanagement
	    elif [ -x "$(which nm-connection-editor 2>/dev/null)" ];then
		    $(which nm-connection-editor)
	    elif [ -x /usr/bin/drakconnect ];then
		/usr/bin/drakconnect 2>/dev/null
	    else 
		echo "$(gettext 'Missing Connection Manager!')"
	    fi
	fi
	;;
    ids*|interaktiv*)
	echo "$netsetup"
	/usr/bin/drakids 2>/dev/null
	;;
    invictus*)
	echo "$netsetup"
	/usr/bin/drakinvictus 2>/dev/null
	;;
    pxe*|netboot|PXE)
	echo "$netsetup"
	/usr/sbin/drakpxelinux 2>/dev/null
	;;
    *lemez*|disk*|hdd|meghajto*|harddisk*)
	echo "$harddisks"
	[ ! -n "$DISPLAY" ]&& drakdisk
	[ -n "$DISPLAY" ]&& /usr/bin/drakpartition 2>/dev/null
	;;
    *cd*|*CD*|usb*|eltavolithato|DVD|dvd|removable)
	echo "$removables"
	[ ! -n "$DISPLAY" ]&&drakdisk --removable 2>/dev/null
	[ -n "$DISPLAY" ]&& /usr/bin/drakpartition 2>/dev/null
	;;
    dvb*|digital*)
	echo "$dvbset"
	[ ! -n "$DISPLAY" ]&& echo "Graphical desktop requires..." && exit 0
	/usr/bin/drakdvb 2>/dev/null
	;;
    loginman*|edm|sddm|gdm|kdm|KDM|GDM)
	echo "$loginman"
	[ ! -n "$DISPLAY" ]&& echo "Graphical desktop requires..." && exit 0
	/usr/sbin/drakedm 2>/dev/null
	;;
    tuzfal|firewall)
	echo "$firewall"
	[ -n "$DISPLAY" ]&&drakfw 2>/dev/null
	[ ! -n "$DISPLAY" ]&&drakfirewall 2>/dev/null
	;;
    betu*|font*)
	echo "$systemfonts"
	drakfont 2>/dev/null
	;;
    atjaro|internetmegoszt|kapcsolatmegoszt*|megoszt*|gw|gateway|inernetshare|netshare)
	echo $(gettext "Internet megosztas ${b}a")
	drakgw 2>/dev/null
	;;
    eszkoz*|hardver*|hardware*)
	echo $(gettext "Hardverek ${b}a ...")
	[ -n "$DISPLAY" ]&&drakdevices 2>/dev/null
	[ ! -n "$DISPLAY" ]&&lspcidrake 2>/dev/null
	;;
    hosztnev|hostname|gepnev)
	echo $(gettext "Hálózatinév ${b}a ...")
	if [ ! -n "$DISPLAY" ];then
	    if [ -x "$(which nmtui-hostname 2>/dev/null)" ];then
		nmtui-hostname 2>/dev/null
	 #elif [ -x /usr/bin/drakhosts ];then
	 #
	    else 
		echo "Use 'hostname --help' command! Ex.: hostname -b anywanthostanme.... "
	    fi
	fi

	if [ -n "$DISPLAY" ];then
	    if [ -x "$(which nmtui-hostname 2>/dev/null)" ];then
		nmtui-hostname 2>/dev/null
	    elif [ -x "$(which /usr/bin/drakhosts 2>/dev/null)" ];then 
		/usr/bin/drakhosts 2>/dev/null
	    else
		echo "Use 'hostname --help' command! Ex.: hostname -b anywanthostanme.... "
	    fi
	fi
	;;
    hosztnevek|hostnames|gepnevek|hosts|host)
	echo $(gettext "Hosztok ${b}a ...")
	if [ -n "$DISPLAY" ];then
	    if [ -x "$(which /usr/bin/drakhosts 2>/dev/null)" ];then 
			/usr/bin/drakhosts 2>/dev/null
	    else
		echo "Edit /etc/hosts file manually.."
	    fi
	else 
		echo "Edit /etc/hosts file manually.."
	
	fi
	;;
    billen*|keyboard|kbd)
	echo $(gettext "Billentyuzetek ${b}a ...")
        /usr/bin/drakkeyboard 2>/dev/null
	;;
    local*|code*|lang*|hely*|orszag|nyelv*|kodlap )
	echo $(gettext "Lokalis adatok ${b}a ...")
	/usr/bin/draklocale 2>/dev/null
	;;
    log|logging|naplo*)
	echo $(gettext "Naplozasok ${b}a ...")
	/usr/bin/draklog 2>/dev/null
	;;
    eger|mouse|tablet)
	echo $(gettext "Pointerek ${b}a ...")
	[ -n "$DISPLAY" ]&&drakmice 2>/dev/null
	[ ! -n "$DISPLAY" ]&&drakmouse 2>/dev/null
	;;
    netcent*|halzatikozpont)
	echo $(gettext "Halozatok kozponti ${b}a ...")
	/usr/bin/draknet 2>/dev/null
	;;
    netprofil*|halozatiprofi*)
	echo $(gettext " Halozati profilok ${b}a ...")
	/usr/bin/draknetprofile 2>/dev/null
	;;
    nfs*)
	echo $(gettext "NFS rendszerek ${b}a ...")
	/usr/bin/draknfsm 2>/dev/null
	;;
    access|perm*|jogo*)
	echo $(gettext "Jogosultsagok ${b}a ...")
	/usr/bin/drakperm 2>/dev/null
	;;
    proxy*)
	echo $(gettext "Proxy ${b}a ...")
	/usr/bin/drakproxy 2>/dev/null
	;;
    wifi|wire*|radioshalo*|roam*|barangol*)
	echo $(gettext "Wireless kapcsolatok ${b}a ...")
	[ -n "$DISPLAY" ]&&drakroam 2>/dev/null
	[ ! -n "$DISPLAY" ] && nmtui-connect 2>/dev/null
	;;
    fileshare*|fajlmegoszt*)
	echo $(gettext "Fájlmegosztasok ${b}a ...")
	[ -n "$DISPLAY" ]&&/usr/bin/drakfileshare 2>/dev/null
	[ ! -n "$DISPLAY" ]&& echo $(gettext "This configurator cannot be run in console mode, sorry")
	;;
    samba*)
	echo $(gettext "Samba megosztasok ${b}a ...")
	[ -n "$DISPLAY" ]&&/usr/bin/draksamba 2>/dev/null
	[ ! -n "$DISPLAY" ]&& echo $(gettext "This configurator cannot be run in console mode, sorry")
	;;
    netsec*)
	echo $(gettext "NETSecurity ${b}a ...")
	[ -n "$DISPLAY" ]&&/usr/bin/draknetsec 2>/dev/null
	[ ! -n "$DISPLAY" ]&& echo $(gettext "This configurator cannot be run in console mode, sorry")
	;;
    scan|scanner*|szkenner|lapolvas*)
	echo $(gettext "Lapolvasok ${b}a ...")
	[ ! -n "$DISPLAY" ]&& echo $(gettext "This configurator cannot be run in console mode, sorry")
	[ -n "$DISPLAY" ]&& /usr/bin/drakscan 2>/dev/null
	;;
    engedelyek*|sec*)
	echo $(gettext "Engedélyek ${b}a ...")
	draksec 2>/dev/null
	;;
    hang*|sound*)
	echo $(gettext "Hangkártyák ${b}a ...")
	[ -n "$DISPLAY" ] && /usr/bin/draksound 2>/dev/null
        [ ! -n "$DISPLAY" ] && default-su -c /usr/sbin/draksound 2>/dev/null
	;;
    ups*|szunetmentes*)
	echo $(gettext "UPS eszkozok ${b}a ...")
	/usr/bin/drakups 2>/dev/null
	;;
    user*|felhasznalo*)
	echo $(gettext "Felhasznalok ${b}a ...")
	/usr/bin/drakuser 2>/dev/null
	;;
    vpn*)
	echo $(gettext "VPN rendszerek ${b}a ...")
	/usr/bin/drakvpn 2>/dev/null
	;;
    kepernyo*|monitor*|felbontas*|vga*|kijelzo*|X|Xorg|X11|x11|display)
	echo $(gettext "Grafikus kiszolgálók ${b}a ...")
	video_settings
	;;
    szolgaltatas*|service*)
	echo $(gettext "Szolgaltatasok rendszerek ${b}a ...")
	[ -n "$DISPLAY" ]&&/usr/bin/systemd-services 2>/dev/null || drakxservices
	[ ! -n "$DISPLAY" ]&&/usr/bin/drakxservices 2>/dev/null
	;;
    dvb*|tv*|tuner*)
	echo $(gettext "TV vevok ${b}a ...")
	[ -n "$DISPLAY" ]&&/usr/bin/drakdvbtv 2>/dev/null
	[ ! -n "$DISPLAY" ]&& echo $(gettext "This configurator cannot be run in console mode, sorry")
	;;
    server*|szerver*|apache|http*|ftp*|ssh*|dhcp*|ntp*)
	echo $(gettext "Szerver szolgáltatások ${b}a ...")
	/usr/sbin/drakwizard 2>/dev/null
	;;
    felugyelet*|szulo*|control*|parent*)
	echo $(gettext "Szülői felügyelet ${b}a ...")
	/usr/sbin/drakguard 2>/dev/null
	;;
    nyomtat*|print*|cups*)
	echo $(gettext "Nyomtatási rendszer ${b}a ...")
	/usr/bin/drakprint 2>/dev/null
	;;
    nokdeinst*|nokdetelepit*|easyinstall|telepiteskdenelkul)
	if [ ! -x /usr/sbin/blackPanther-install ]
	    then echo "$(gettext 'Service not available or system already installed')"
	    exit 
	fi
	query() {
	case "$LANG" in
	hu*)
	echo ''
	echo '		blackPanther OS Biztonsági telepítése ...'
	echo '		Másodlagos telepítési mód gyengébb gépekhez.'
	accept="  		Biztosan elindítja a telepítőprogramot a munkaasztal indítása nélkül? i=igen n=nem (i/n)"
	;;
	*)
	echo ''
	echo '		blackPanther OS safe install mode...'
	echo '		Second install mode for easy computers.'
	accept="		Do you want start installer without start desktop? y=yes n=no (y/n)"
	;;
	esac

    echo ""
    ANSWER=""
    while [ -z "${ANSWER}" ] ; do
      echo -en "$accept : "
      read ANSWER
      UCANSWER=`echo "${ANSWER}" | tr '[a-z]' '[A-Z]'`
      case "${UCANSWER}" in
      "I"|"YES"|"Y")
        ;;
      "NO"|"N")
        echo ""
        echo ""
        echo -e "$(gettext		'Exiting.. Not the KDE Install mode !')"
        echo ""
        exit 1
        ;;
      *)
        ANSWER=""
        ;;
      esac
    done
    }
    
    if grep -q INSTALL /proc/cmdline; then 
	X || /etc/rc.d/displaycontroller 
	sleep 2
	killall X -KILL
	sleep 1
    else
	query
    fi

	clear
	echo ""
	echo "		------ Welcome to blackPanther OS Easy PC Installer -------"
	echo ""
	echo " 	  * You needed locale and keyboard settings...Start configure applications now!"
	echo ""
	sleep 2
	startxorg() {
	    echo "X Desktop starting..."
	    export DISPLAY=:0
	    /usr/bin/X &
	    export DISPLAY=:0
	    sleep 1
	    checker
	}

	checker() {
	    if [ -n $DISPLAY ];then
	    echo "Display found"
	    sleep 3
	    #drakx-matchbox-window-manager & finish-install
	 else
	    echo " SLOW DISPLAY "
	    sleep 10
	    #service dm restart && service dm stop
	    killall X -KILL
	    startxorg
	fi
	}

	startinst() {
	echo "Installer starting..."
	drakx-matchbox-window-manager & blackPanther-install 2>/dev/null
	echo "Installer exiting...."
	echo "---------------------"
	service dm restart && sleep 2 && service dm stop
	killall X -KILL
	clear
	sleep 1
	clear
	menu
	}
	
	startxorg
	drakx-matchbox-window-manager & finish-install
	service dm restart && sleep 2 && service dm stop
	killall X -KILL
	#draklocale  2>/dev/null
	echo " * Locale Settings Now: $LANG * $LANGUAGE "
	sleep 2
	#drakkeyboard  2>/dev/null
	#echo " * Keyboard Settings Now: $KEYBOARD * $KEYTABLE * $(cat /etc/syscongfig/clock)"
	#sleep 2
	locales=`cat /etc/sysconfig/i18n`
	export $locales
	startxorg
	startinst
	killall X -KILL
	clear
	echo "-- install done -- 
	Restart PC now!"
    RESTART=""
    while [ -z "${RESTART}" ] ; do
      echo -en "$accept : "
      read RESTART
      UCANSWER=`echo "${RESTART}" | tr '[a-z]' '[A-Z]'`
      case "${UCANSWER}" in
      "I"|"YES"|"Y")
        echo "RESTARTING..."
        reboot
        ;;
      "NO"|"N")
        echo ""
        echo ""
        echo -e "		Reboot progress cancel now. Restart pc to complete install !
"
        echo ""
        exit 1
        ;;
      *)
        RESTART=""
        ;;
      esac
    done

	#reboot
	;;
	*)
	echo -e "   
	$MAG Easy Control Center *$BLU blackPanther OS $CYN* www.blackpantheros.eu
 $GRN Input command or parameter required!  Please select command from list below:
  ----------------------------------------------------------------------------------

	        $MAG Available commands:$YEL 3d|3D|effe
    		      azonositas|hitelesit|auth
    			    betolto|indito|boot|grub
			  splash|inditokep|bootspl
			      ora|ido|time|clock
	        halozat|kapcsolat|internet|network
		   lemez|disk|hdd|meghajto|harddisk
	   cd|CD|usb|eltavolithato|DVD|dvd|removable
				       dvb|digital
			       gdm|kdm|KDM|GDM
				    tuzfal|firewall
				      betu|font
   atjaro|internetmegoszt|kapcsolatmegoszt|megoszt|gw|netshare
			  eszkozok|hardver|hardwer
			      hoszt|gepnev|host|hostname
		          hosztok|gepnevek|hostnames
		           billen|keyboard|kbd
		  nyelv|kodlap|hely|orszag|local|codepage
				     naplo|log
			       eger|tablet|mouse
			    halzatikozpont|netcent*
			    halozatiprofi*|netprofil*
				      nfs*|nfs*
				      pxe*|netboot
				     jogo*|access|perm*
				    proxy*|
		wifi|barangol*|radioshalo*|wire*|roaming
			      fajlmegoszt*|samba*
			lapolvas*|szkenner|scan|scanner*
			       engedelyek*|sec*
				     hang*|sound*
			     szunetmentes*|ups*
			      felhasznalo*|user*
				      vpn*|
    kepernyo*|monitor*|felbontas*|kijelzo*|vga
			     szolgaltatas*|service*
				       tv*|tuner*
			          szerver*|server*
	       szuloi*|felugyelet*|parent*|control*
-------------------------------------------------------------------------------------		        
|		       <------ Hungarian  |  English ------->			    |
-------------------------------------------------------------------------------------		        
$DEF
  [ usage:$YEL  $(echo $(basename $0)) command $GRN ] or [ graphical:$YEL $(echo $(basename $0)) -x$GRN ]"
  
echo

esac

exit
