Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| utilisateurs:sonn2 [Le 19/01/2012, 11:58] – [Vos commentaires] sonn2 | utilisateurs:sonn2 [Le 01/02/2012, 23:46] (Version actuelle) – sonn2 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | . | ||
| - | < | ||
| ====== | ====== | ||
| ===== Présentation ===== | ===== Présentation ===== | ||
| Ligne 24: | Ligne 22: | ||
| * C (pour plus tard...) | * C (pour plus tard...) | ||
| ==== Philosophie ==== | ==== Philosophie ==== | ||
| - | J'ai quitter le monde propriétaire il y a plus d' | + | J'ai quitter le monde propriétaire il y a plus de deux an et je respire enfin :-P |
| - | J' | + | J' |
| ====== Projets ====== | ====== Projets ====== | ||
| <note important> | <note important> | ||
| - | Je fait cette page pour mettre des liens que je trouve les plus utiles, je posterais aussi mon petit script. | + | Je fait cette page pour mettre des liens que je trouve les plus utiles, je posterais aussi mon modeste |
| C'est mes petits trucs à moi, rien de génial, mais bon... j'aime l' | C'est mes petits trucs à moi, rien de génial, mais bon... j'aime l' | ||
| </ | </ | ||
| ===== gestionnaire de taches/ | ===== gestionnaire de taches/ | ||
| ==== Introduction ==== | ==== Introduction ==== | ||
| - | C'est un petit script qui permet | + | Contenu supprimé temporairement afin d'éviter |
| - | Donc s'il vous plait les habitués, venez pas dire que c'est nul, etc... parce que je le SAIT!! merci :) | + | Une discussion |
| - | Ce script necessite d' | + | |
| - | < | + | |
| - | sudo ./script.sh installation | + | |
| - | </ | + | |
| - | + | ||
| - | <note tip> | + | |
| - | *version : 0.4 | + | |
| - | *dépendances : zenity (si lancement de cet environnement) | + | |
| - | | + | |
| - | *Nécessite les droits root. | + | |
| - | *Le mot de passe est : test | + | |
| - | *Peut etre lancer en console ou en graphique. | + | |
| - | * la possibilité de lancer directement une fonction passé en parametre (utile pour un cron par exemple) | + | |
| - | </ | + | |
| - | exemple de lancement : | + | |
| - | < | + | |
| - | sudo ./script.sh terminal | + | |
| - | ou | + | |
| - | sudo ./script.sh zenity | + | |
| - | </ | + | |
| - | + | ||
| - | A venir : | + | |
| - | <note help> | + | |
| - | * < | + | |
| - | * une meuilleur ergonomie pour le menu terminal avec l' | + | |
| - | * un script de connexion ssh | + | |
| - | * un script de sauvegarde automatique de fichier | + | |
| - | * un script de rangement semi-automique de fichier | + | |
| - | * un script de restauration rapide de programmes préféré (utilise en cas de réinstallation de sa distribution) | + | |
| - | * un systeme de log (dont certaines lignes de commande sont déjà présentes ^^ ) | + | |
| - | si vous avez d' | + | |
| - | </ | + | |
| - | ==== code ==== | + | |
| - | === Le fichier " | + | |
| - | < | + | |
| - | # | + | |
| - | clear | + | |
| - | + | ||
| - | #version 0.4 | + | |
| - | + | ||
| - | source " | + | |
| - | source " | + | |
| - | source " | + | |
| - | + | ||
| - | echo " | + | |
| - | "`date +%Y-%m-%d\; | + | |
| - | initialisation | + | |
| - | + | ||
| - | if [ `pwd` == " | + | |
| - | then | + | |
| - | if ((EUID == 0)) | + | |
| - | then | + | |
| - | # | + | |
| - | if [ -z " | + | |
| - | then | + | |
| - | echo `date +%Y-%m-%d\; | + | |
| - | echo " | + | |
| - | zenity --error --title=" | + | |
| - | exit 3 | + | |
| - | + | ||
| - | # | + | |
| - | elif [ " | + | |
| - | then | + | |
| - | echo `date +%Y-%m-%d\; | + | |
| - | echo -e " | + | |
| - | terminal_verification_mdp | + | |
| - | echo " | + | |
| - | terminal_choisir_programme | + | |
| - | + | ||
| - | # | + | |
| - | elif [ " | + | |
| - | then | + | |
| - | echo `date +%Y-%m-%d\; | + | |
| - | zenity --info | + | |
| - | zenity_verification_mdp | + | |
| - | zenity --info --title=" | + | |
| - | zenity_choisir_programme | + | |
| - | + | ||
| - | # | + | |
| - | else | + | |
| - | for i in ${!noms_fonctions_terminal[*]} | + | |
| - | do | + | |
| - | if [ " | + | |
| - | then | + | |
| - | eval " | + | |
| - | exit 9 | + | |
| - | fi | + | |
| - | done | + | |
| - | + | ||
| - | for i in ${!noms_fonctions_zenity[*]} | + | |
| - | do | + | |
| - | if [ " | + | |
| - | then | + | |
| - | eval " | + | |
| - | exit 9 | + | |
| - | fi | + | |
| - | done | + | |
| - | + | ||
| - | if [ " | + | |
| - | then | + | |
| - | installation | + | |
| - | exit 9 | + | |
| - | fi | + | |
| - | + | ||
| - | #si on n'as pas déjà quitter, c'est que la fonction n' | + | |
| - | clear | + | |
| - | echo " | + | |
| - | zenity --error --title=" | + | |
| - | exit 4 | + | |
| - | fi | + | |
| - | else | + | |
| - | clear | + | |
| - | echo " | + | |
| - | zenity --error --title=" | + | |
| - | exit 2 | + | |
| - | fi | + | |
| - | else | + | |
| - | clear | + | |
| - | echo " | + | |
| - | zenity --error --title=" | + | |
| - | exit 1 | + | |
| - | fi | + | |
| - | + | ||
| - | exit | + | |
| - | + | ||
| - | # 1 = lancer sans être installé | + | |
| - | # 2 = lancer sans root | + | |
| - | # 3 = lancer sans parametre | + | |
| - | # 4 = lancer avec un parametre d' | + | |
| - | + | ||
| - | # 5 = trop d' | + | |
| - | # 6 = fin normal de la session d' | + | |
| - | + | ||
| - | # 7 = trop d' | + | |
| - | # 8 = fin normal de la session d' | + | |
| - | + | ||
| - | # 9 = fin normal de la session sans environnement | + | |
| - | </ | + | |
| - | + | ||
| - | === Le fichier " | + | |
| - | < | + | |
| - | # | + | |
| - | + | ||
| - | #variables supplémentaires utilisées : | + | |
| - | # mdp | + | |
| - | # afficher_message | + | |
| - | # quitter | + | |
| - | + | ||
| - | # définition des variables | + | |
| - | # | + | |
| - | + | ||
| - | repertoire="/ | + | |
| - | sortie_log=" | + | |
| - | let " | + | |
| - | s_mdp=" | + | |
| - | ner=" | + | |
| - | + | ||
| - | #lancement message | + | |
| - | l_t="" | + | |
| - | l_m_1=" | + | |
| - | l_m_2=" | + | |
| - | l_m_3=" | + | |
| - | #fin lancement message | + | |
| - | + | ||
| - | lancement=" | + | |
| - | + | ||
| - | install_non_t=" | + | |
| - | install_non_m=" | + | |
| - | + | ||
| - | root_manquant_t=" | + | |
| - | root_manquant_m=" | + | |
| - | + | ||
| - | # | + | |
| - | + | ||
| - | plm_t=" | + | |
| - | plm_m=" | + | |
| - | + | ||
| - | pli_t=" | + | |
| - | pli_m=" | + | |
| - | + | ||
| - | entrer_mdp_t=" | + | |
| - | entrer_mdp_m=" | + | |
| - | + | ||
| - | mdp_vide_t=" | + | |
| - | mdp_vide_m=" | + | |
| - | + | ||
| - | mdp_incorrect_t=" | + | |
| - | mdp_incorrect_m=" | + | |
| - | + | ||
| - | mdp_erreur_t=" | + | |
| - | mdp_erreur_m=" | + | |
| - | + | ||
| - | msg_bienvenue_t=" | + | |
| - | msg_bienvenue_m=" | + | |
| - | + | ||
| - | entrer_choix_t=" | + | |
| - | entrer_choix_m=" | + | |
| - | + | ||
| - | choix_vide_t=" | + | |
| - | choix_vide_m=" | + | |
| - | + | ||
| - | choix_incorrect_l=" | + | |
| - | choix_incorrect_m=" | + | |
| - | + | ||
| - | fenetre_fermee_t=" | + | |
| - | fenetre_fermee_m=" | + | |
| - | + | ||
| - | # | + | |
| - | # fin définition des variables | + | |
| - | </ | + | |
| - | + | ||
| - | === Le fichier " | + | |
| - | < | + | |
| - | # | + | |
| - | + | ||
| - | # | + | |
| - | # | + | |
| - | + | ||
| - | noms_fonctions_terminal=( | + | |
| - | '' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ) | + | |
| - | descriptions_fonctions_terminal=( | + | |
| - | '' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ) | + | |
| - | noms_fonctions_zenity=( | + | |
| - | '' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ) | + | |
| - | descriptions_fonctions_zenity=( | + | |
| - | '' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ' | + | |
| - | ) | + | |
| - | + | ||
| - | + | ||
| - | # | + | |
| - | #fin des définitions des array | + | |
| - | + | ||
| - | # définition des fonctions terminal | + | |
| - | # | + | |
| - | function terminal_01 | + | |
| - | { | + | |
| - | echo "Pour obtenir une liste des commandes les plus utiles :" | + | |
| - | echo "http://doc.ubuntu-fr.org/ | + | |
| - | } | + | |
| - | function terminal_02 | + | |
| - | { | + | |
| - | apt-get update | + | |
| - | apt-get upgrade | + | |
| - | } | + | |
| - | function terminal_03 | + | |
| - | { | + | |
| - | n=1 # Nombre d' | + | |
| - | for nom in $(awk ' | + | |
| - | do | + | |
| - | echo " | + | |
| - | let "n += 1" | + | |
| - | done | + | |
| - | } | + | |
| - | function terminal_04 | + | |
| - | { | + | |
| - | read -p " | + | |
| - | read sha1 x < < | + | |
| - | echo -e " | + | |
| - | echo $sha1 | + | |
| - | } | + | |
| - | function terminal_05 | + | |
| - | { | + | |
| - | dmidecode | + | |
| - | } | + | |
| - | function terminal_06 | + | |
| - | { | + | |
| - | echo " | + | |
| - | } | + | |
| - | function terminal_07 | + | |
| - | { | + | |
| - | echo " | + | |
| - | } | + | |
| - | function terminal_08 | + | |
| - | { | + | |
| - | echo " | + | |
| - | } | + | |
| - | function terminal_09 | + | |
| - | { | + | |
| - | echo " | + | |
| - | } | + | |
| - | function terminal_10 | + | |
| - | { | + | |
| - | echo " | + | |
| - | } | + | |
| - | # | + | |
| - | # fin définition des fonctions terminal | + | |
| - | + | ||
| - | # définition des fonctions zenity | + | |
| - | # | + | |
| - | function zenity_01 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_02 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_03 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_04 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_05 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_06 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_07 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_09 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | function zenity_10 | + | |
| - | { | + | |
| - | zenity --info title=" | + | |
| - | } | + | |
| - | + | ||
| - | # | + | |
| - | # fin définition des fonctions zenity | + | |
| - | </ | + | |
| - | + | ||
| - | === le fichier " | + | |
| - | < | + | |
| - | # | + | |
| - | # | + | |
| - | + | ||
| - | function installation | + | |
| - | { | + | |
| - | if [ -d $repertoire ] | + | |
| - | then | + | |
| - | read -p "Le répertoire $repertoire existe déjà, il seras effacer" | + | |
| - | sudo rm -r $repertoire | + | |
| - | fi | + | |
| - | sudo mkdir $repertoire | + | |
| - | sudo mv *.* $repertoire | + | |
| - | sudo rm -r `pwd` | + | |
| - | chown -R root:root $repertoire | + | |
| - | chmod -R 000 $repertoire | + | |
| - | } | + | |
| - | + | ||
| - | function initialisation | + | |
| - | { | + | |
| - | menu_terminal=" | + | |
| - | for i in ${!noms_fonctions_terminal[*]} | + | |
| - | do | + | |
| - | menu_terminal+=" | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | # | + | |
| - | # | + | |
| - | + | ||
| - | function terminal_verification_mdp | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | read -p " | + | |
| - | echo | + | |
| - | + | ||
| - | #si le mdp entré est vide | + | |
| - | if [ -z " | + | |
| - | then | + | |
| - | echo " | + | |
| - | + | ||
| - | #si le mdp entré est incorrect | + | |
| - | elif [ -n " | + | |
| - | then | + | |
| - | echo " | + | |
| - | + | ||
| - | #si le mdp est correct | + | |
| - | elif [ -n " | + | |
| - | then | + | |
| - | break | + | |
| - | fi | + | |
| - | + | ||
| - | let " | + | |
| - | echo "$ner $nb_essai_restant" | + | |
| - | + | ||
| - | #si le nombre d' | + | |
| - | if [ " | + | |
| - | then | + | |
| - | clear | + | |
| - | echo " | + | |
| - | exit 5 | + | |
| - | fi | + | |
| - | + | ||
| - | echo | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | function terminal_choisir_programme | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | echo -e " | + | |
| - | read -p " | + | |
| - | + | ||
| - | if [ -z " | + | |
| - | then | + | |
| - | echo -e " | + | |
| - | else | + | |
| - | case " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | *) | + | |
| - | esac | + | |
| - | fi | + | |
| - | if [ " | + | |
| - | then | + | |
| - | terminal_message_quitter | + | |
| - | fi | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | function terminal_message_quitter | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | read -p " | + | |
| - | if [ -z $quitter ] | + | |
| - | then | + | |
| - | echo | + | |
| - | elif [ $quitter | + | |
| - | then | + | |
| - | break | + | |
| - | elif [ $quitter == " | + | |
| - | then | + | |
| - | clear | + | |
| - | echo "Au revoir!" | + | |
| - | exit 6 | + | |
| - | fi | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | # | + | |
| - | #fin définitions des fonctions de l' | + | |
| - | + | ||
| - | + | ||
| - | # | + | |
| - | # | + | |
| - | function zenity_verification_mdp | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | if mdp=`zenity --entry --title=" | + | |
| - | then | + | |
| - | #si le mdp entré est vide | + | |
| - | if [ -z " | + | |
| - | then | + | |
| - | zenity --error --title=" | + | |
| - | + | ||
| - | #si le mdp entré est incorrect | + | |
| - | elif [ -n " | + | |
| - | then | + | |
| - | zenity --error --title=" | + | |
| - | + | ||
| - | #si le mdp est correct | + | |
| - | elif [ -n " | + | |
| - | then | + | |
| - | break | + | |
| - | fi | + | |
| - | else | + | |
| - | zenity --error --title=" | + | |
| - | fi | + | |
| - | + | ||
| - | let " | + | |
| - | + | ||
| - | #si le nombre d' | + | |
| - | if [ " | + | |
| - | then | + | |
| - | zenity --error --title=" | + | |
| - | exit 7 | + | |
| - | fi | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | function zenity_choisir_programme | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | choix=`zenity --list --title=" | + | |
| - | 1 " | + | |
| - | 4 " | + | |
| - | 7 " | + | |
| - | 10 " | + | |
| - | afficher_message=false | + | |
| - | + | ||
| - | if [ -z " | + | |
| - | then | + | |
| - | echo -e " | + | |
| - | else | + | |
| - | case " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | *) | + | |
| - | esac | + | |
| - | fi | + | |
| - | + | ||
| - | if [ " | + | |
| - | then | + | |
| - | zenity_message_quitter | + | |
| - | fi | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | function zenity_message_quitter | + | |
| - | { | + | |
| - | while true | + | |
| - | do | + | |
| - | zenity --question --title "que faire" --text " | + | |
| - | if [ $? == 0 ] | + | |
| - | then | + | |
| - | break | + | |
| - | else | + | |
| - | zenity --info --title=" | + | |
| - | exit 8 | + | |
| - | fi | + | |
| - | done | + | |
| - | } | + | |
| - | + | ||
| - | # | + | |
| - | #fin définitions des fonctions de l' | + | |
| - | </ | + | |
| ==== message xD ==== | ==== message xD ==== | ||
| < | < | ||
| Ligne 641: | Ligne 47: | ||
| ---- | ---- | ||
| - | --- // | + | --- // |
