You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
886 B

#!/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