#! /bin/sh

#
# Tento skript by sa mal spustat pred instalaciou baliku
#

# kontrola na pripadnu existenciu predchadzajucich verzii baliku

if [ -f /etc/kbd/config.old.local ]
then
  echo ""
  echo ""
  echo "Je nebezpecne robit upgrade tohto balika na nove verzie."
  echo "Najprv odinstalujte predchadzajucu verziu a az potom instalujte novu."
  echo ""
  exit 1
fi

if [ -f /usr/X11R6/lib/X11/xkb/symbols/czsk ]
then
  echo ""
  echo ""
  echo "Vyzera to tak, ze ste bud robili vlastne upravy systemu X Windows alebo ste"
  echo "instalovali verzie baliku cz-hamm 0.01 alebo 0.02."
  echo ""
  echo "Prosim, stiahnite si subor remove-0.0x.tar.gz z toho isteho miesta, ako ste stiahli"
  echo "tento balik, precitajte si README, odstrante stary balik podla navodu a az potom"
  echo "instalujte tuto verziu."
  echo ""
  exit 1
fi

if [ -f /etc/debian_version ]
then
  DEBIANVER=`cat /etc/debian_version`
  if [ ! "$DEBIANVER" = "2.0" ]
  then
    echo ""
    echo ""
    echo "Verzia Debianu musi byt 2.0 hamm, ale Vy mate verziu $DEBIANVER."
    echo ""
    echo "Stiahnite si prislusny balik pre Vasu verziu Debianu a instalujte ten."
    echo "Napriklad pre Debian GNU/Linux 2.1 to bude cz-slink_N.NN.i386.deb."
    exit 1
  fi
else
  echo ""
  echo ""
  echo "Verzia Debianu musi byt 2.0 hamm, a nemozem zistit verziu vasho systemu."
  echo ""
  echo "Stiahnite si prislusny balik pre Vasu verziu Debianu a instalujte ten."
  echo "Napriklad pre Debian GNU/Linux 2.1 to bude cz-slink_N.NN.i386.deb."
  exit 1
fi

# instalujeme na cisty system, spravme zalohu standardnej klavesnice

if [ ! -f /etc/kbd/default.map.gz.old.local ]
then
  cp /etc/kbd/default.map.gz /etc/kbd/default.map.gz.old.local
fi

# takisto zaloha standardnych fontov - tie sa natahuju pri spusteni `setfont'
# bez parametrov

if [ ! -f /usr/share/consolefonts/default8x16.old.local ]
then
  if [ -f /usr/share/consolefonts/default8x16 ]
  then
    cp /usr/share/consolefonts/default8x16 /usr/share/consolefonts/default8x16.old.local
  fi
fi

if [ ! -f /usr/share/consolefonts/default8x8.old.local ]
then
  if [ -f /usr/share/consolefonts/default8x8 ]
  then
    cp /usr/share/consolefonts/default8x8 /usr/share/consolefonts/default8x8.old.local
  fi
fi

if [ ! -f /usr/share/consolefonts/default8x14.old.local ]
then
  if [ -f /usr/share/consolefonts/default8x14 ]
  then
    cp /usr/share/consolefonts/default8x14 /usr/share/consolefonts/default8x14.old.local
  fi
fi
