done
header "Configuring $host"
- availServices=$(ls /home/bdsm/bdsm.d | cut -d'.' -f1 | sort -u)
+ # TODO:
+ # Make availServices a null array; pass this value to a loop
+ # Check compatibility, add compatible ones to the array
+ #availServices=$(ls /home/bdsm/bdsm.d | cut -d'.' -f1 | sort -u)
+
+ availServices=()
+ ls /home/bdsm/bdsm.d | cut -d'.' -f1 | sort -u | while read service; do
+ svc=`echo $service | sed 's/(.*)$//g'`
+ if [ -f /home/bdsm/bdsm.d/$svc.$type ]; then
+ serviceFile="$svc.$type"
+ elif [ -f /home/bdsm/bdsm.d/$svc.generic ]; then
+ serviceFile="$svc.generic"
+ else
+ error "$service plugin not found!"
+ fi
+
+ if [ "`/home/bdsm/bdsm.d/$serviceFile compatible`" -eq 1 ]; then
+ availServices+=($service)
+ fi
+ done
+
services=$(cat /home/bdsm/.bdsm.conf.tmp | grep ":$host{" | \
sed 's/.*{\(.*\)}/\1/g' | tr ';' ' ')
service=`selector "Select a service to configure" $services "Add a service..." "Done"`