> ===> /usr/sbin/facility <===
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use File::Basename;
> use File::Glob qw(bsd_glob);
> 
> my $svdir = $ENV{SVDIR} // "/etc/service";
> my $command = shift or die "usage: $0 command facility...";
> my %providers = map {
>   map {
>     basename(dirname($_)) => 1
>   } bsd_glob("$svdir/*/provides-$_")
> } @ARGV;
> 
> exec ("sv", $command, keys %providers) if %providers;

I think for 'facility check' one might need to be able to define whether
we want an AND or OR relationship - the default 'sv' behaviour would be
to AND them together, whereas for some types of facility we may be
content with any one passing, so we could have something like:

  facility --any network

which would then have to explode into one 'sv' invocation for each
discovered provider and then OR the results together.

Reply via email to