header "Configuring $host"
#availServices=$(ls /home/bdsm/bdsm.d | cut -d'.' -f1 | sort -u)
availServices=()
- find /home/bdsm/bdsm.d -executable -type f | \
- sed 's|/home/bdsm/bdsm.d/||g' | \
- 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"
+ while read service; do
+ if [ -f /home/bdsm/bdsm.d/$service.$type ]; then
+ serviceFile="$service.$type"
+ elif [ -f /home/bdsm/bdsm.d/$service.generic ]; then
+ serviceFile="$service.generic"
else
error "$service plugin not found!"
fi
- if [ "`/home/bdsm/bdsm.d/$serviceFile compatible $host`" -eq "1" ]; then
+ compatible=($(/home/bdsm/bdsm.d/$serviceFile compatible $host))
+ if [ "$compatible" -eq "1" ]; then
availServices+=($service)
fi
- done
+ done <($(find /home/bdsm/bdsm.d -executable -type f | \
+ sed 's|/home/bdsm/bdsm.d/||g' | \
+ cut -d'.' -f1 | \
+ sort -u))
services=$(cat /home/bdsm/.bdsm.conf.tmp | grep ":$host{" | \
sed 's/.*{\(.*\)}/\1/g' | tr ';' ' ')