#!/bin/bash
cd `dirname "$0"`
CMD="./HNagent -ONDEM "

locale=$1
file=$2

$CMD "$file" >& /dev/null
prot=$?

if [ "$locale" = "fr" ]; then
  ttle="Status de la sauvegarde"  
  case $prot in
   0) msg="Sauvegarde en cours" ;;
   *) msg="Impossible de lancer la sauvegarde" ;;
  esac
else
  ttle="Backup status"
  case $prot in
   0) msg="Backup in progress" ;;
   *) msg="Unable to launch backup" ;;
  esac
fi


fullmsg=`echo "$file" ; echo "$msg"`
which zenity > /dev/null 2>&1
if [ "$?" = "0" ]; then
  if [ "$prot" = "0" ]; then
    zenity --title "$ttle" --info --text="$fullmsg" --width=300 
  else
    zenity --title "$ttle" --warning --text="$fullmsg" --width=300 
  fi 
else
 which kdialog > /dev/null 2>&1
 if [ "$?" = "0" ]; then
  kdialog --title "$ttle" --msgbox "$fullmsg"
 fi
fi
