- various fixes to configure.pl and lib/BackupPC/Lib.pm
[BackupPC.git] / lib / BackupPC / Storage / Text.pm
index 18f5913..4213106 100644 (file)
@@ -340,15 +340,19 @@ sub ConfigFileMerge
                     $contents .= "\$Conf{$var} = " . $value;
                     $done->{$var} = 1;
                 }
-                $endLine = $1 if ( /^\s*\$Conf\{[^}]*} *= *<<(.*);/ );
-                $endLine = $1 if ( /^\s*\$Conf\{[^}]*} *= *<<'(.*)';/ );
+                if ( /^\s*\$Conf\{[^}]*} *= *<<(.*);/
+                        || /^\s*\$Conf\{[^}]*} *= *<<'(.*)';/ ) {
+                    $endLine = $1;
+                    $skipVar = 1;
+                } else {
+                    $endLine = undef;
+                    $skipVar = /^[^#]*;/ ? 0 : 1;
+                }
                 $out = "";
-                $skipVar = 1;
             } elsif ( $skipVar ) {
-                if ( !defined($endLine) && (/^\s*[\r\n]*$/ || /^\s*#/) ) {
+                if ( !defined($endLine) && /^[^#]*;/ ) {
                     $skipVar = 0;
                     $comment = 1;
-                    $out .= $_;
                 }
                 if ( defined($endLine) && /^\Q$endLine\E[\n\r]*$/ ) {
                     $endLine = undef;