+sub CheckMetaDataVsConfig
+{
+ my($confVars, $file) = @_;
+ my $done = {};
+ my $errors;
+
+ #
+ # Check that the meta file mentions all the config
+ # parameters
+ #
+ open(F, $file) || die("can't open $file");
+
+ while ( <F> ) {
+ next if ( !/^\s{4}(\w+)\s+=>/ );
+ if ( $confVars->{$1} ) {
+ $done->{$1} = 1;
+ next;
+ }
+ next if ( $1 eq "Hosts" );
+ print("$file has $1 but missing from conf/config.pl\n");
+ $errors++;
+ }
+ close(F);
+ foreach my $v ( keys(%$confVars) ) {
+ next if ( $done->{$v} );
+ print("$file missing $v from conf/config.pl\n");
+ $errors++;
+ }
+
+ #
+ # Do extra checks that the CgiUserConfigEdit hash in the Meta
+ # file matches the config file
+ #
+ foreach my $p ( keys(%{$ConfigMeta{CgiUserConfigEdit}{child}}) ) {
+ if ( !defined($bpc->{Conf}{CgiUserConfigEdit}{$p}) ) {
+ print("lib/BackupPC/Config/Meta.pm has $p in CgiUserConfigEdit,"
+ . " but conf/config.pl CgiUserConfigEdit does not\n");
+ $errors++;
+ }
+ }
+ foreach my $p ( keys(%{$bpc->{Conf}{CgiUserConfigEdit}}) ) {
+ if ( !defined($ConfigMeta{CgiUserConfigEdit}{child}{$p}) ) {
+ print("conf/config.pl CgiUserConfigEdit has $p, but"
+ . " lib/BackupPC/Config/Meta.pm does not\n");
+ $errors++;
+ }
+ }
+ return $errors;
+}
+
+sub CheckEditorVsConfig
+{
+ my($confVars, $file) = @_;
+ my $done = {};
+ my $errors;
+
+ #
+ # Check that the config editor file mentions all the config
+ # parameters
+ #
+ open(F, $file) || die("can't open $file");
+
+ while ( <F> ) {
+ next if ( !/name\s*=>\s*"(\w+)"/ );
+ if ( $confVars->{$1} ) {
+ $done->{$1} = 1;
+ next;
+ }
+ next if ( $1 eq "Hosts" );
+ print("$file has $1 but missing from conf/config.pl\n");
+ $errors++;
+ }
+ close(F);
+ foreach my $v ( keys(%$confVars) ) {
+ next if ( $done->{$v} );
+ print("$file missing $v from conf/config.pl\n");
+ $errors++;
+ }
+ return $errors;
+}
+