#!/bin/sh
################################################################################
#                                                                              #
# Polish Kathi Team 2009                                                       #
#                                                                              #
# contact: http://pkt.sat-elita.info/                                          #
#                                                                              #
################################################################################

. /var/config/swap.conf
. /var/config/language.conf

#-------------------------------------------------------------------------------
#language section
#-------------------------------------------------------------------------------

if [ $lang == pl ]; then

  info1="SWAP jest aktywny"
  info2="Wykorzystanie Swap:"
  info3="Uzyte: "
  info4="Wolne: "
  info5="Razem: "
  info6="SWAP jest wylaczony"

elif [ $lang == en ]; then

  info1="SWAP is active"
  info2="Swap usage:"
  info3="Used: "
  info4="Free: "
  info5="Sum.: "
  info6="SWAP is not active"

elif [ $lang == de ]; then

  info1="SWAP ist Aktiv"
  info2="Benutzten Swap:"
  info3="Banutzt: "
  info4="Frei: "
  info5="Zusamman: "
  info6="SWAP-ist ausgeschaltet"

elif [ $lang == it ]; then

  info1="SWAP attivo"
  info2="Utilizzo Swap:"
  info3="In Uso: "
  info4="Libero: "
  info5="Totale: "
  info6="SWAP non attivo"

elif [ $lang == es ]; then
  info1="El SWAP esta activo"
  info2="Tamaņo del SWAP:"
  info3="Usado: "
  info4="Disponible: "
  info5="Total: "
  info6="El SWAP no esta activado"

fi

#-------------------------------------------------------------------------------
#script section
#-------------------------------------------------------------------------------

free_swap1=`free | grep Swap | awk '{print $3}'`
free_swap2=`free | grep Swap | awk '{print $4}'`
free_swap3=`free | grep Swap | awk '{print $2}'`

if [ $swap == on ]; then
    
    echo $info1
    echo ""
    echo $info2
    echo ""
    echo "$info3 $free_swap1 kB"
    echo "$info4 $free_swap2 kB"
    echo "$info5 $free_swap3 kB"
    echo ""

else
    echo $info6
    echo ""
fi

echo ""
exit 0