From bec3abe93d6dfdf890dcba2bfc37fe8be98f512a Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Thu, 19 Mar 2015 13:32:10 -0400
Subject: [PATCH] Handle os-release upgrades from existing productized
 installations

---
 fedora-release.spec | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/fedora-release.spec b/fedora-release.spec
index 297a97803052c87d87ce515bb536fba5b9f39d7f..031eb594fbb524b76a7570393da9beb941053f2b 100644
--- a/fedora-release.spec
+++ b/fedora-release.spec
@@ -3,11 +3,11 @@
 %define bug_version 22
 
 Summary:        Fedora release files
 Name:           fedora-release
 Version:        22
-Release:        0.14
+Release:        0.15
 License:        MIT
 Group:          System Environment/Base
 URL:            http://fedoraproject.org
 Source:         %{name}-%{version}.tar.bz2
 Obsoletes:      redhat-release
@@ -158,24 +158,21 @@ if [ $1 = 0 ]; then
     test -e /usr/lib/os-release || \
         ln -sf ./os-release.d/os-release-fedora /usr/lib/os-release
 fi
 
 %post cloud
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-
+# Run every time
     # If there is no link to os-release yet from some other
     # release package, create it
     test -e /usr/lib/os-release || \
         ln -sf ./os.release.d/os-release-cloud /usr/lib/os-release
 
     # If os-release isn't a link or it exists but it points to a
     # non-productized version, replace it with this one
     if [ \! -h /usr/lib/os-release -o "x$(readlink /usr/lib/os-release)" = "xos.release.d/os-release-fedora" ]; then
         ln -sf ./os.release.d/os-release-cloud /usr/lib/os-release || :
     fi
-fi
 
 %postun cloud
 # Uninstall
 if [ $1 = 0 ]; then
     # If os-release is now a broken symlink or missing replace it
@@ -184,13 +181,11 @@ if [ $1 = 0 ]; then
         ln -sf ./os.release.d/os-release-fedora /usr/lib/os-release || :
 fi
 
 
 %post server
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-
+# Run every time
     # If there is no link to os-release yet from some other
     # release package, create it
     test -e /usr/lib/os-release || \
         ln -sf ./os.release.d/os-release-server /usr/lib/os-release
 
@@ -198,10 +193,13 @@ if [ $1 -eq 1 ] ; then
     # non-productized version, replace it with this one
     if [ \! -h /usr/lib/os-release -o "x$(readlink /usr/lib/os-release)" = "xos.release.d/os-release-fedora" ]; then
         ln -sf ./os.release.d/os-release-server /usr/lib/os-release || :
     fi
 
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+
     # fix up after %%systemd_post in packages
     # possibly installed before our preset file was added
     units=$(sed -n 's/^enable//p' \
         < %{_prefix}/lib/systemd/system-preset/80-server.preset)
         /usr/bin/systemctl preset $units >/dev/null 2>&1 || :
@@ -215,13 +213,11 @@ if [ $1 = 0 ]; then
     test -e /usr/lib/os-release || \
         ln -sf ./os.release.d/os-release-fedora /usr/lib/os-release || :
 fi
 
 %post workstation
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-
+# Run every time
     # If there is no link to os-release yet from some other
     # release package, create it
     test -e /usr/lib/os-release || \
         ln -sf ./os.release.d/os-release-workstation /usr/lib/os-release
 
@@ -229,10 +225,13 @@ if [ $1 -eq 1 ] ; then
     # non-productized version, replace it with this one
     if [ \! -h /usr/lib/os-release -o "x$(readlink /usr/lib/os-release)" = "xos.release.d/os-release-fedora" ]; then
         ln -sf ./os.release.d/os-release-workstation /usr/lib/os-release || :
     fi
 
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+
     # fix up after %%systemd_post in packages
     # possibly installed before our preset file was added
     units=$(sed -n 's/^disable//p' \
         < %{_prefix}/lib/systemd/system-preset/80-workstation.preset)
     /usr/bin/systemctl preset $units >/dev/null 2>&1 || :
@@ -285,10 +284,13 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
 %config %attr(0644,root,root) /usr/lib/os.release.d/os-release-workstation
 %{_datadir}/glib-2.0/schemas/org.gnome.shell.gschema.override
 %{_prefix}/lib/systemd/system-preset/80-workstation.preset
 
 %changelog
+* Thu Apr 23 2015 Stephen Gallagher <sgallagh@redhat.com> 22-0.15
+- Handle os-release upgrades from existing productized installations
+
 * Mon Mar 16 2015 Stephen Gallagher <sgallagh@redhat.com> 22-0.14
 - Generate os-release based on product subpackages
 - Remove the -nonproduct subpackage
 - Eliminate Conflicts between subpackages
 - Add preset file for workstation to disable sshd
-- 
2.3.5

