#!/bin/bash

dir=`dirname $0`
cmd="$dir/nsooutmode"

## check soffice.bin run##########################################################################
sofficerun=`pgrep soffice`

if [ -n "$sofficerun" ]; then
        zenity --question --text "бջ Office Уȷرա" --title "бջ Office "
fi

if [ $? == 1 ]; then
        exit 
else
	kill  -9 `ps -ef|grep soffice|awk '{print $2}'` 
fi
## check soffice.bin run##########################################################################

if [ ${UID} = 0 ]; then
        exec  $cmd  >/dev/null 2>&1
        exit 
fi

xsu=`which gksu kdesu 2>&- | head -1`

if [ $xsu ]; then
        $xsu  $cmd  >/dev/null 2>&1
        exit
fi

xterm=`which gnome-terminal terminal  konsole xterm rxvt eterm 2>&- | head -1`

if [ -z "$xsu" ]; then  
	$xterm -e "$dir/textoutmod" && exit
fi


