#!/usr/bin/env bash set -eu ONLY_BUILD=0 synopsis() { cat << EOF Usage : `basename $0` [-b] [-h] EOF } help() { cat << EOF `basename $0` affiche la liste des réseaux. `synopsis` -h : affiche cette aide -b : seulement ceux possédant un script build. EOF } usage() { synopsis exit 1 } args() { local opt while getopts "hb" opt; do case $opt in h) help; exit 0;; b) ONLY_BUILD=1;; ?) usage;; esac done } # Programme principal VDN_PATH=$(readlink -f $(dirname $0)/..); . $VDN_PATH/bin/functions.sh args "$@" [ -z "NETWORK_DIR" ] && error "NETWORK_DIR not set !" || : if [ $ONLY_BUILD = 1 ]; then ( cd $VDN_NETWORKS_BASE_DIR; find -maxdepth 2 -type f -name "build" -exec dirname {} \; | grep -v '^\.$' | sed -re 's/^..//' | sort ) else ( cd $VDN_NETWORKS_BASE_DIR; find -maxdepth 1 -type d -exec basename {} \; | grep -v '^\.$' |sort ) fi