Blame view

create_bridge.sh 762 Bytes
3e470988   hmalti   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  #!/bin/bash
  NOM_BRIDGE=$3;
  ADDR_IPV4=$4;
  REPERTOIRE=${PWD}
  
  
  #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
  
  touch  $NOM_BRIDGE.manifest # On crée un fichier contenant les infos du bridge
  echo "$NOM_BRIDGE" >> $NOM_BRIDGE.manifest #nom du bridge
  
  #condition de bordure pour le dossier Bridges
  if [[ ! -d "$REPERTOIRE/baleine/Bridges" ]]; then 
    mkdir -p $REPERTOIRE/baleine/Bridges && mv $NOM_BRIDGE.manifest $REPERTOIRE/baleine/Bridges
  fi
  mv $NOM_BRIDGE.manifest $REPERTOIRE/baleine/Bridges