- add preserve-conf script to contrib
authorpmatilai <pmatilai>
Mon, 10 Apr 2006 20:40:51 +0000 (20:40 +0000)
committerpmatilai <pmatilai>
Mon, 10 Apr 2006 20:40:51 +0000 (20:40 +0000)
contrib/preserve-conf/preserve-conf.conf [new file with mode: 0644]
contrib/preserve-conf/preserve-conf.lua [new file with mode: 0644]

diff --git a/contrib/preserve-conf/preserve-conf.conf b/contrib/preserve-conf/preserve-conf.conf
new file mode 100644 (file)
index 0000000..f198e16
--- /dev/null
@@ -0,0 +1,6 @@
+Scripts::AptGet::Upgrade { "preserve-conf.lua"; };
+Scripts::AptGet::Dist-Upgrade { "preserve-conf.lua"; };
+Scripts::Synaptic::Upgrade { "preserve-conf.lua"; };
+Scripts::Synaptic::Dist-Upgrade { "preserve-conf.lua"; };
+
+RPM::Preserve-Config "true";
diff --git a/contrib/preserve-conf/preserve-conf.lua b/contrib/preserve-conf/preserve-conf.lua
new file mode 100644 (file)
index 0000000..fcfe2bb
--- /dev/null
@@ -0,0 +1,20 @@
+if confget("RPM::Preserve-Config/b", "false") == "true" then
+       num = 0
+       pkgs = pkglist()
+       for i, pkg in ipairs(pkgs) do
+               if statinstall(pkg) then
+                       inp = io.popen("LANG=C /bin/rpm -V --nodeps --nodigest --noscripts --nosignature "..pkgname(pkg).." 2> /dev/null")
+                       for line in inp.lines(inp) do
+                               if string.byte(line, 10) == string.byte("c") then
+                                       num = num + 1
+                                       markkeep(pkg)
+                               end
+                       end
+                       io.close(inp)
+               end
+       end
+       if num > 0 then
+               print("\nHolding back "..num.." packages because of changed configuration")
+       end
+end
+-- vim:ts=4