]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
systemd: Fix conflict with nss-myhostname.
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 13 Jun 2013 20:18:34 +0000 (22:18 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 13 Jun 2013 20:42:39 +0000 (22:42 +0200)
nss-myhostname has become a part of systemd since version 201.
So the old nss-myhostname package is obsolet and can be dropped.

Fixes #10370.

systemd/systemd.nm

index cc9c0562c20d2101d901ed800678837687d9d2da..5d971f9e05051c0ecff665a1bbfca4e55ff3ee39 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = systemd
 version    = 204
-release    = 2
+release    = 3
 
 maintainer = Stefan Schantl <stefan.schantl@ipfire.org>
 groups     = System/Base
@@ -140,6 +140,7 @@ packages
                        python-cairo
                        python-dbus
                        python-gobject3
+                       %{name}-libs=%{thisver}
                        %{name}-units=%{thisver}
                        util-linux>=2.19
                end
@@ -273,6 +274,49 @@ packages
 
        package %{name}-libs
                template LIBS
+       
+               groups += Base
+
+               prerequires
+                       /etc/nsswitch.conf
+               end
+
+               provides
+                       nss-myhostname = %{thisver}
+               end
+
+               obsoletes
+                       nss-myhostname <= 0.3-3
+               end
+
+               conflicts
+                       nss-myhostname <= 0.3-3
+
+                       # Ensure that the version of systemd matches systemd-libs.
+                       systemd > %{thisver}
+                       systemd < %{thisver}
+               end
+
+               # Add myhostname to the hosts line of /etc/nsswitch.conf
+               script postin
+                       if [ -f "/etc/nsswitch.conf" ]; then
+                               sed -i.bak -e '
+                                       /^hosts:/ !b
+                                       /\<myhostname\>/ b
+                                       s/[[:blank:]]*$/ myhostname/
+                                       ' /etc/nsswitch.conf
+                       fi
+               end
+
+               # Remove myhostname from the hosts line of /etc/nsswitch.conf
+               script postun
+                       if [ -f "/etc/nsswitch.conf" ]; then
+                               sed -i.bak -e '
+                                       /^hosts:/ !b
+                                       s/[[:blank:]]\+myhostname\>//
+                                       ' /etc/nsswitch.conf
+                       fi
+               end
        end
 
        package %{name}-devel