+ if ($base)
+ {
+ return "$base/etc";
+ }
+ else
+ {
+ return "../etc";
+ }
+}
+
+sub init
+{
+ my $lib_dir = lib_dir ();
+ my $sysconf_dir = sysconf_dir ();
+
+ if (!grep { $lib_dir eq $_ } (@::INC))
+ {
+ unshift (@::INC, $lib_dir);
+ }
+
+ gc_read_config ("$sysconf_dir/collection.conf");
+}
+
+sub main
+{
+ my $Debug = param ('debug') ? 1 : 0;
+ my $action = param ('action') || 'list_hosts';
+
+ if (!exists ($Actions{$action}))
+ {
+ print STDERR "No such action: $action\n";
+ return (1);
+ }
+
+ init ();
+
+ $Actions{$action}->();
+ return (1);
+} # sub main