
# Script program Realised by MARTINEZ SYLVAIN
# 25/01/1996
# martinez@iutserveur.univ-lyon1.fr
 

if [ ! -d /archives/config ]; then
mkdirhier /archives/config
fi

while [ 0 ]; do

 dialog --title "CONFIGURATION du Reseau sous LINUX" --menu "\n\
		Iut informatique de LYON    (FRANCE)
             V1.0  cree par MARTINEZ Sylvain (25/01/1996) \n\n\
             Config Actuelle : '`cat /root/config/config_actu`'\n" 21 74 9 \
"AFFICHE" "Afficher les configs disponibles" \
"CHARGER" "Charger une nouvelle config" \
"SAUVEGARDER" "Sauvegarder la config actuelle" \
"EFFACER" "Effacer une config (PRUDENCE !)" \
"CREER" "Creer/Modifer des informations sur une config" \
"INFOS" "Informations sur une config" \
"BACKUP" "Sauvegarde sur DISK A" \
"LOAD" "Chargement d'un BACKUP (PRUDENCE !)" \
"QUITTER" "Sortir du menu de config" 2> /tmp/choix_config

 if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/choix_config
  reset
  exit
 fi

 MAINSELECT="`cat /tmp/choix_config`"

 rm /tmp/choix_config


 if [ "$MAINSELECT" = "AFFICHE" ]; then
    affiche
 fi
 
 if [ "$MAINSELECT" = "CHARGER" ]; then
    charger
 fi


 if [ "$MAINSELECT" = "SAUVEGARDER" ]; then
       dialog --title "	SAUVEGARDER LA CONFIG ACTUELLE " \
--inputbox "
         Entrez le nom de la config a sauver" 10 60 2>/tmp/choix_config
       dialog --yesno "	  ETES-VOUS SURE DE VOULOIR SAUVEGARDER LA CONFIG \n\
         SOUS '`cat /tmp/choix_config`' ?" 6 60

     if [ $? != 1 ]; then
	NOM=`cat /tmp/choix_config`
	mkdir /archives/config/$NOM
     if [ $? != 1 ]; then 
	cd /archives/config/$NOM
	/root/config/files
        echo $NOM > /root/config/config_actu
     fi
       
      fi
 fi

 if [ "$MAINSELECT" = "EFFACER" ]; then
	effacer
 fi

 if [ "$MAINSELECT" = "CREER" ]; then
	creer
 fi

 if [ "$MAINSELECT" = "INFOS" ]; then
	information
 fi

 if [ "$MAINSELECT" = "BACKUP" ]; then
	backup
 fi

 if [ "$MAINSELECT" = "LOAD" ]; then
	load
 fi

  if [ "$MAINSELECT" = "QUITTER" ]; then
   rm -f /tmp/choix_config 2>/dev/null
   reset
   break
  fi
done 
clear
