174 lines
3.6 KiB
Plaintext
174 lines
3.6 KiB
Plaintext
|
#!/bin/bash
|
||
|
##########################################################
|
||
|
#
|
||
|
# Eole NG - 2010
|
||
|
# Copyright Pole de Competence Eole (Ministere Education - Academie Dijon)
|
||
|
# Licence CeCill http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html
|
||
|
# eole@ac-dijon.fr
|
||
|
#
|
||
|
# Gestion des modules en mode dialogue
|
||
|
# avec les comptes système eole, eole2
|
||
|
#
|
||
|
##########################################################
|
||
|
|
||
|
# un seul manage ?
|
||
|
pmanage=`pgrep manage-eole`
|
||
|
nbmanage=`echo $pmanage | wc -w`
|
||
|
|
||
|
# fichiers temporaires
|
||
|
temp="/tmp/InBox-Eol-"
|
||
|
tempfile="$temp$$"
|
||
|
|
||
|
TitreGen="Eole - Gestion du Serveur"
|
||
|
|
||
|
##########################################################
|
||
|
# Fonctions reprises de FonctionsEole
|
||
|
##########################################################
|
||
|
|
||
|
MenuBox()
|
||
|
{
|
||
|
#${1="Votre Saisie"}
|
||
|
#${2="Saisie"}
|
||
|
NBlignes=${NBlignes=5}
|
||
|
Menu="$3"
|
||
|
dialog $NOMOUSE1 --backtitle "$TitreGen" \
|
||
|
--aspect 45 --clear \
|
||
|
--menu "$1" 16 50 $NBlignes \
|
||
|
$Menu 2> $tempfile
|
||
|
retval=$?
|
||
|
case $retval in
|
||
|
0)
|
||
|
eval $2="`cat $tempfile`";;
|
||
|
1) # Cancel
|
||
|
eval $2="CANCEL";;
|
||
|
255) # ESC
|
||
|
if test -s $tempfile ;
|
||
|
then
|
||
|
eval $2=`cat $tempfile`
|
||
|
else
|
||
|
eval $2="ESC"
|
||
|
fi
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
OkBox()
|
||
|
{
|
||
|
dialog $NOMOUSE1 --backtitle "$TitreGen" \
|
||
|
--aspect 45 --cancel-label Abandon\
|
||
|
--msgbox "$1" 0 0
|
||
|
}
|
||
|
|
||
|
QuestionBox()
|
||
|
{
|
||
|
#${1=Votre Saisie"}
|
||
|
#${2="Saisie"}
|
||
|
dialog $NOMOUSE1 --backtitle "$TitreGen" \
|
||
|
--aspect 45 --clear \
|
||
|
--yesno "$1" 16 50
|
||
|
retval=$?
|
||
|
case $retval in
|
||
|
0)
|
||
|
eval $2="OUI";;
|
||
|
1) # Cancel
|
||
|
eval $2="NON";;
|
||
|
255) # ESC
|
||
|
eval $2="ESC" ;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
Entree(){
|
||
|
echo
|
||
|
echo "Tapez <Entrée>"
|
||
|
read Bidon
|
||
|
}
|
||
|
|
||
|
CleanExit(){
|
||
|
echo "Au revoir !"
|
||
|
rm -f $tempfile
|
||
|
exit $1
|
||
|
}
|
||
|
|
||
|
##########################################################
|
||
|
# Programme principal
|
||
|
##########################################################
|
||
|
|
||
|
if [ $nbmanage -gt 1 ]
|
||
|
then
|
||
|
MenuBox "D'autres instances de manage-eole ont été détectées" Rep "1 Quitter_sans_tuer 2 Quitter_et_tuer"
|
||
|
rm -f "$temp*"
|
||
|
if [ "$Rep" == "2" ]
|
||
|
then
|
||
|
for pid in $pmanage
|
||
|
do
|
||
|
kill -9 $pid
|
||
|
done
|
||
|
fi
|
||
|
CleanExit 0
|
||
|
fi
|
||
|
|
||
|
OkBox "Administration EOLE\n\nPour Vous Deplacer sur l'Ecran\nUtiliser votre Souris\nOu la touche tabulation.\n\n"
|
||
|
|
||
|
Rep=""
|
||
|
while [ 1 ]
|
||
|
do
|
||
|
# FIXME/TODO : ajouter des entrées de menu !
|
||
|
MenuBox "Votre Choix" Rep "1 Diagnostic 2 Reconfiguration 3 Paquets_en_Maj 4 Mise_A_Jour 8 Redemarrer_Serveur 9 Arret_Serveur ! Shell_Linux Q Quitter"
|
||
|
|
||
|
if [ "$Rep" == "CANCEL" ]
|
||
|
then
|
||
|
CleanExit 1
|
||
|
fi
|
||
|
|
||
|
case $Rep in
|
||
|
1)
|
||
|
echo "En cours ..."
|
||
|
sudo /usr/bin/diagnose
|
||
|
Entree
|
||
|
;;
|
||
|
2)
|
||
|
sudo /usr/bin/reconfigure
|
||
|
Entree
|
||
|
;;
|
||
|
3)
|
||
|
sudo /usr/bin/Query-Auto
|
||
|
Entree
|
||
|
;;
|
||
|
4)
|
||
|
sudo /usr/bin/Maj-Auto
|
||
|
Entree
|
||
|
;;
|
||
|
# TODO : pouvoir inclure des entrées venant d'ailleurs ;)
|
||
|
#5)
|
||
|
#sudo /usr/share/eole/Maj-blacklist.sh
|
||
|
#Entree
|
||
|
#;;
|
||
|
8)
|
||
|
QuestionBox "Vous avez demandé le redémarrage du serveur\nEtes vous sur ?" Rep
|
||
|
if [ "$Rep" == "OUI" ]
|
||
|
then
|
||
|
sudo /sbin/reboot
|
||
|
sleep 1
|
||
|
CleanExit 0
|
||
|
fi
|
||
|
;;
|
||
|
9)
|
||
|
QuestionBox "Vous avez demandé un arret total du serveur\nEtes vous sur ?" Rep
|
||
|
if [ "$Rep" == "OUI" ]
|
||
|
then
|
||
|
sudo /sbin/halt -p
|
||
|
sleep 1
|
||
|
CleanExit 0
|
||
|
fi
|
||
|
;;
|
||
|
!)
|
||
|
echo "\"exit\" ou \"Ctrl + d\" pour revenir au Menu"
|
||
|
/bin/bash
|
||
|
;;
|
||
|
Q)
|
||
|
CleanExit 0
|
||
|
;;
|
||
|
|
||
|
esac
|
||
|
done
|