+%post
+[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
+
+%postun
+[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
+
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
+
+%triggerpostun -- poldek <= 0.18.3-5
+if [ -f /etc/poldek.conf ]; then
+ sed -i -e '/^promoteepoch:.*yes/s/^/#/' /etc/poldek.conf
+fi
+
+# otherwise don't touch
+%ifarch i386 i586 i686 ppc sparc alpha amd64 athlon
+%triggerpostun -- poldek <= 0.18.7-1
+if [ -f /etc/poldek.conf ]; then
+ sed -i -e 's://ftp.pld-linux.org://ftp.ac.pld-linux.org:g' /etc/poldek.conf
+fi
+%endif
+
+%triggerpostun -- poldek < 0.19.0-1.20050613.22.0
+if [ -f /etc/poldek.conf.rpmsave ]; then
+ awk '/^source/ {
+ name = $3;
+ path = $4;
+ auto = "yes";
+ autoup = "yes";
+ type = "pdir";
+
+ if (sub(",noauto", "", name)) {
+ auto = "no";
+ }
+
+ # skip ac sources. already in new config.
+ if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
+ print "";
+ print "[source]";
+ print "name = " name;
+ print "type = " type;
+ print "path = " path;
+ print "auto = " auto;
+ print "autoup = " autoup;
+ }
+
+ }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
+ echo "Converted old custom sources (non-ac dist ones) from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
+
+ # propagate use_sudo to new config. only works for untouched poldek.conf and that's intentional.
+ if grep -q '^use_sudo.*=.*yes' /etc/poldek.conf.rpmsave; then
+ sed -i -e '/^#use sudo = no/s/^.*/use sudo = yes/' /etc/poldek/poldek.conf
+ fi
+
+ # copy hold=
+ hold=$(grep ^hold /etc/poldek.conf.rpmsave)
+ if [ "$hold" ]; then
+ sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
+ fi
+fi
+