6 use System::Introspector::State;
7 use File::Tree::Snapshot;
8 use System::Introspector::Config;
11 'c|config=s' => \my $config_file,
12 's|storage=s' => \my $storage_dir,
13 'H|host=s' => \my $hostname,
14 'U|user=s' => \my $username,
15 'allow-empty' => \my $allow_empty,
16 'a|all' => \my $update_all,
17 'g|group=s' => \my @update_groups,
18 'h|help' => sub { pod2usage(0) },
21 die "Requires --all or --group option\n"
22 unless $update_all or @update_groups;
24 die "The --user option also requires a --host to be set\n"
25 if defined($username) and not defined($hostname);
27 my $config = System::Introspector::Config->new(
28 config_file => (defined($config_file)
30 : "$storage_dir/main.conf"),
33 $config->has_group($_) or die "Unknown group '$_'\n"
36 @update_groups = $config->groups
39 my $sudo_user = $config->sudo_user;
41 for my $group (@update_groups) {
42 my $group_dir = "$storage_dir/$group";
43 print "Group $group at $group_dir\n";
44 my $storage = File::Tree::Snapshot->new(
45 storage_path => $group_dir,
46 allow_empty => $allow_empty,
49 unless $storage->exists;
50 my $state = System::Introspector::State->new(
51 defined($hostname) ? (host => $hostname) : (),
52 defined($username) ? (user => $username) : (),
53 defined($sudo_user) ? (sudo_user => $sudo_user) : (),
55 config => $config->config_for_group($group),
57 eval { $state->fetch_and_store };
59 warn "Error: $error\n";
71 system-introspector - Generate System Introspection Data
75 system-introspector --storage <path> [OPTIONS]
79 =head2 -s <path>, --storage <path>
81 Path to storage. Always required.
83 =head2 -H <host>, --host <host>
89 Allow empty commits to storage.