Blame view

create_bridge.sh 688 Bytes
3e470988   hmalti   First commit
1
2
3
  #!/bin/bash
  NOM_BRIDGE=$3;
  ADDR_IPV4=$4;
b1087939   hmalti   Ajout commandes
4
  
3e470988   hmalti   First commit
5
6
7
8
9
10
11
12
13
14
15
16
  
  
  #condition sur le nbre d'arguments
  if [[ -z "$NOM_BRIDGE" ]]; then 
    echo "Il faut donner le nom du bridge ! Relancez la commande avec les bons arguments."
    exit
  fi
  #création du bridge
  ip link add $NOM_BRIDGE type bridge
  ip a add dev $NOM_BRIDGE $ADDR_IPV4
  ip link set $NOM_BRIDGE down
  ip link set $NOM_BRIDGE up
b1087939   hmalti   Ajout commandes
17
18
19
  FILE= $NOM_BRIDGE.manifest
  touch  FILE # On crée un fichier contenant les infos du bridge
  echo "$NOM_BRIDGE" >> FILE #nom du bridge
3e470988   hmalti   First commit
20
21
  
  #condition de bordure pour le dossier Bridges
b1087939   hmalti   Ajout commandes
22
23
  if [[ ! -d "$PATH_MANIFEST/bridges" ]]; then 
    mkdir -p $PATH_MANIFEST/bridges #&& mv FILE $PATH_MANIFEST/bridges
3e470988   hmalti   First commit
24
  fi
b1087939   hmalti   Ajout commandes
25
  mv FILE $PATH_MANIFEST/bridges