4 # process vmware locations database
5 # filter the database and keep only single answers not the complete log
7 # purpose: cleanup locations db for making it into default rpm config
11 my (%files, %dirs, %answer, %config);
15 my ($cmd, $args) = split(/ /, $_, 2);
16 my ($key, $value) = split(/ /, $args, 2);
17 $files{$key} = $value,next if $cmd eq 'file';
18 $config{$key} = 1,next if $cmd eq 'config';
19 $dirs{$args} = 1,next if $cmd eq 'directory';
20 $answer{$key} = $value,next if $cmd eq 'answer';
21 delete $answer{$key},next if $cmd eq 'remove_answer';
22 delete $files{$key},next if $cmd eq 'remove_file';
23 warn "unknown config stub: [$cmd]\n";
26 foreach my $key (sort keys %answer) {
27 my $value = $answer{$key};
28 printf("answer %s %s\n", $key, $value);
31 while (my($key, $value) = each %dirs) {
32 printf("directory %s\n", $key);
35 while (my($key, $value) = each %files) {
37 printf("file %s %s\n", $key, $value);
39 printf("file %s\n", $key);
41 if (exists $config{$key}) {
42 printf("config %s\n", $key);
47 while (my($key, $value) = each %config) {
48 printf("config %s\n", $key);