diff --git a/bridge.sh b/bridge.sh index 7b117e3..753a994 100644 --- a/bridge.sh +++ b/bridge.sh @@ -1,5 +1,25 @@ #!/bin/bash +if [ $# -lt 1 ]; then + printf "Nom \n" + printf "\t \t Bridge\n" + printf "SYNOPSIS \n" + printf "\t \t baleine bridge [arguments]\n" + printf "Description: \n \n" + printf "La commande 'bridge' permet de créer des bridges Linux, en supprimer et lister les bridges existants (Nom) " + printf "Les commandes sont :\n \n" + printf "\t %-10s %-10s \n" "" "crée un bridge." + printf "\t \t [-b], [NOM_BRIDGE]\n \n" + printf "\t \t [-a], [ADDR_IPV4]\n \n" + printf " \t %-10s %-10s \n" "" "liste les bridges existants ainsi que leurs manifestes." + printf " \t %-10s %-10s \n" "" "Supprime le bridge donné en argument." + printf "\t \t [-b], --bridge [NOM_BRIDGE]\n \n" + printf " \t %-10s %-10s \n" "" "Met up le bridge donné en argument." + printf "\t \t [-b], --bridge [NOM_BRIDGE]\n \n" + printf " \t %-10s %-10s \n" "" "Met down le bridge donné en argument." + printf "\t \t [-b], --bridge [NOM_BRIDGE]\n \n" + printf "Utilisez baleine help pour plus d'informations à propos d'une commande.\n" +fi case $1 in "create") diff --git a/container.sh b/container.sh index 3a401d4..5cdea9b 100644 --- a/container.sh +++ b/container.sh @@ -1,4 +1,30 @@ #!/bin/bash +if [ $# -lt 1 ]; then + printf "Nom \n" + printf "\t \t Container\n" + printf "SYNOPSIS \n" + printf "\t \t baleine container [arguments]\n" + printf "Description: \n \n" + printf "La commande 'Container' permet de créer des conteneurs, en supprimer, lister les conteneurs existants (Son nom, son image, son bridge, son PID, son starting time ) " + printf "Les commandes sont :\n \n" + printf "\t %-10s %-10s \n" "" "crée un conteneur." + printf "\t \t [-i], [NOM_IMAGE]\n \n" + printf "\t \t [-c], [NOM_CONTAINER]\n \n" + printf "\t \t [-b], [NOM_BRIDGE]\n \n" + printf "\t \t [-r], [REPERTOIRE]\n \n" + printf "\t \t [-a], [ADDRE_IPV4]\n \n" + printf "\t \t [-p], [NOM_PROGRAMME]\n \n" + printf " \t %-10s %-10s \n" " " "liste les conteneurs existants ainsi que leurs manifestes." + printf " \t %-10s %-10s \n" " " "Supprime le conteneur donné en argument." + printf "\t \t [-c], --container [NOM_CONTAINER]\n \n" + printf "\t \t %-10s %-10s \n" " " "Exécute au lancement du conteneur un bash." + printf "\t \t [-c], --container [NOM_CONTAINER]\n \n" + printf "\t %-10s %-10s \n" " " "Stop le conteneur donné en argument." + printf "\t \t [-c], --container [NOM_CONTAINER]\n \n" + printf " \t %-10s %-10s \n" " " "redémarre le conteneur donné en argument." + printf "\t \t [-c], --container [NOM_CONTAINER]\n \n" + printf "Utilisez baleine help pour plus d'informations à propos d'une commande.\n" +fi case $1 in diff --git a/create_container.sh b/create_container.sh index cfc3cc8..e3406ab 100644 --- a/create_container.sh +++ b/create_container.sh @@ -69,7 +69,7 @@ echo "PID Unshare :$PID" FILE=$NOM_CONTAINER.manifest date=$(date) -echo "nom_container:$NOM_CONTAINER" >> $FILE #nom de son image +echo "nom_container:$NOM_CONTAINER" >> $FILE #nom du conteneur echo "nom_image:$NOM_IMAGE" >> $FILE #nom de son image echo "pid:$PID" >> $FILE #Son PID echo "nom_bridge:$NOM_BRIDGE" >> $FILE #SON BRIDGE diff --git a/exec_container.sh b/exec_container.sh index 38e7621..45b8b5a 100644 --- a/exec_container.sh +++ b/exec_container.sh @@ -1,8 +1,8 @@ #!/bin/bash -while getopts e: o; do +while getopts c: o; do case $o in - (e) $NOM_CONTAINER=$OPTARG;; + (c) $NOM_CONTAINER=$OPTARG;; esac done diff --git a/help.sh b/help.sh index e94ae49..f057850 100644 --- a/help.sh +++ b/help.sh @@ -1,21 +1,4 @@ #!/bin/bash printf "Baleine est un outil simple de gestion de conteneur.\n" printf "Utilisation: \n \n" - printf "\t \t image [arguments]\n" - printf "Les commandes sont :\n \n" - printf "\t \t %-10s %-10s \n" "create " "Créer une image " - printf "\t \t %-10s %-10s \n" "list <>" "Liste le manifest de chaque image." - printf "\t \t %-10s %-10s \n \n" "remove " "supprime l'image passée en argument " - - printf "\t \t bridge [arguments]\n" - printf "Les commandes sont :\n \n" - printf "\t \t %-10s %-10s \n" "create " "Créer une image avec " - printf "\t \t %-10s %-10s \n" "list <>" "Liste le manifest de chaque image." - printf "\t \t %-10s %-10s \n \n" "remove " "supprime l'image passée en argument " - - printf "\t \t container [arguments]\n" - printf "Les commandes sont :\n \n" - printf "\t \t %-10s %-10s \n" "create " "Créer une image avec " - printf "\t \t %-10s %-10s \n" "list <>" "Liste le manifest de chaque image." - printf "\t \t %-10s %-10s \n \n" "remove " "supprime l'image passée en argument " - \ No newline at end of file + \ No newline at end of file diff --git a/image.sh b/image.sh index 4211287..85f62f7 100644 --- a/image.sh +++ b/image.sh @@ -1,4 +1,23 @@ #!/bin/bash +if [ $# -lt 1 ]; then + printf "Nom \n" + printf "\t \t Image\n" + printf "SYNOPSIS \n" + printf "\t \t baleine image [arguments]\n" + printf "Description: \n \n" + printf "La commande 'image' permet de créer une image, en supprimer, lister les images existantes (Son nom, sa taille, son chemin ) " + printf "Les commandes sont :\n \n" + printf "\t %-10s %-10s \n" "" "crée une image." + printf "\t \t [-i], [NOM_IMAGE]\n \n" + printf "\t \t [-s], [TAILLE]\n \n" + printf "\t \t [-r], [REPERTOIRE]\n \n" + printf "\t \t [-P], [PROXY]\n \n" + printf " \t %-10s %-10s \n" "" "liste les images existantes ainsi que leurs manifestes." + printf " \t %-10s %-10s \n" "" "Supprime l'image donnée en argument." + printf "\t \t [-c], --container [NOM_CONTAINER]\n \n" + printf "Utilisez baleine help pour plus d'informations à propos d'une commande.\n" +fi + case $1 in "create") diff --git a/remove_bridge.sh b/remove_bridge.sh index 021e831..06868c3 100644 --- a/remove_bridge.sh +++ b/remove_bridge.sh @@ -1,6 +1,10 @@ #!/bin/bash NAME_BRIDGE_TO_REMOVE=$1; - +while getopts b: o; do + case $o in + (b) NAME_BRIDGE_TO_REMOVE=$OPTARG;; + esac +done #vérification que l'utilisateur donne bien un nom à l'image if [[ -z "$NAME_BRIDGE_TO_REMOVE" ]]; then echo "Il faut donner le nom du bridge à supprimer ! Relancez la commande avec les bons arguments." diff --git a/remove_container.sh b/remove_container.sh index 5304e2f..5b5fe1e 100644 --- a/remove_container.sh +++ b/remove_container.sh @@ -1,6 +1,9 @@ #!/bin/bash -NAME_CONTAINER_TO_REMOVE=$1; - +while getopts c: o; do + case $o in + (c) NAME_CONTAINER_TO_REMOVE=$OPTARG;; + esac +done #vérification que l'utilisateur donne bien un nom à l'CONTAINER if [[ -z "$NAME_CONTAINER_TO_REMOVE" ]]; then echo "Il faut donner le NAME du conteneur! Relancez la commande avec les bons arguments." diff --git a/remove_image.sh b/remove_image.sh index 77dee9c..8244935 100644 --- a/remove_image.sh +++ b/remove_image.sh @@ -1,6 +1,9 @@ #!/bin/bash -NAME_IMAGE_TO_REMOVE=$1; - +while getopts i: o; do + case $o in + (i) NAME_IMAGE_TO_REMOVE=$OPTARG;; + esac +done #vérification que l'utilisateur donne bien un nom à l'image if [[ -z "$NAME_IMAGE_TO_REMOVE" ]]; then echo "Il faut donner le nom de l'image ! Relancez la commande avec les bons arguments." -- libgit2 0.21.2