[vdr] 09/21: Fixed postinst plugin config migration

Tobias Grimm tiber-guest at moszumanska.debian.org
Wed Mar 25 00:19:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

tiber-guest pushed a commit to branch e-tobi
in repository vdr.

commit 514646d5e46765983b53573f5731e5b9f6a2d0c3
Author: etobi <git at e-tobi.net>
Date:   Mon Mar 23 19:03:33 2015 +0100

    Fixed postinst plugin config migration
    
    Conflicts:
    	debian/changelog
---
 debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate b/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
index b8a9184..389e934 100644
--- a/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
+++ b/debian/dh-addon-vdrplugin/postinst-vdrplugin-migrate
@@ -20,12 +20,25 @@ dh_vdrplugin_migrate_config() {
     }
   }
 
+  my @updatedOptions;
+
+  # Update options in new config with values from old one
   while(<$newConfigFile>) {
     my $line = $_;
     while (my ($key, $value) = each(%options)) {
-      $line = $value if $line =~ /^$key/;
+      if ($line =~ /^$key/) {
+        $line = $value;
+        push(@updatedOptions,$key);
+      }
+    }
+    print $modifiedConfigFile $line;
+  }
+
+  # Add additional values from old config to new one
+  while (my ($key, $value) = each(%options)) {
+    if (! grep {$_ eq $key} @updatedOptions) {
+      print $modifiedConfigFile $value;
     }
-    print $modifiedConfigFile  $line;
   }
 
   close($originalConfigFile);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr.git



More information about the pkg-vdr-dvb-changes mailing list