#!/bin/sh

exitstatus=0
if [ "$1" = "--service-based-lookup" ] ||
   [ "$1" = "-s" ]; then
  for my_service in $(fliwi-get-my-services)
  do
    fliwi-get-logical-volumes "$@" $my_service
  done
elif [ "$1" = "--host-based-lookup" ]; then
  fliwi-get-logical-volumes --host-based-lookup "$@" $(hostname -s)
  exitstatus=$?
elif [ "$1" = "--vhost-based-lookup" ]; then
  for my_vhost_service in $(fliwi-get-my-services | grep -E -e '^fliwi-vhost')
  do
    fliwi-get-logical-volumes "$@" $my_vhost_service
  done
else
  fliwi-get-logical-volumes "$@" $(hostname -s)
  exitstatus=$?
fi



exit $exitstatus
