mark plstackapi_config as a config file so it's not replace during rpm upgrade
[plstackapi.git] / opencloud.spec
index 2828bdb..e877ff4 100644 (file)
@@ -1,7 +1,7 @@
 Summary: OpenCloud core services
 Name: opencloud
-Version: 1.0.8
-Release: 1
+Version: 1.0.10
+Release: 4
 License: GPL+
 Group: Development/Tools
 Source0: %{_tmppath}/%{name}-%{version}.tar.gz
@@ -59,28 +59,43 @@ if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then
    gzip -d /usr/share/GeoIP/GeoLiteCity*.gz
 fi
 
+if [ "$1" == 2 ] ; then
+    echo "UPGRADE - saving current state"
+    /opt/planetstack/scripts/opencloud dumpdata
+fi
+
 %install
 rm -rf %{buildroot}
 mkdir -p  %{buildroot}
 install -d %{buildroot}/opt/planetstack
 
 # in builddir
-cp -rp /opt/plstackapi/planetstack %{buildroot}/opt/.
+cp -rp ./planetstack %{buildroot}/opt/.
 
-find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g"  > %{_tmppath}/tmp-filelist
+find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist
+cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist
 
 %clean
 rm -rf %{buildroot}
 
 %files -f %{_tmppath}/tmp-filelist
 %defattr(-,root,root,-)
+%config /opt/planetstack/plstackapi_config
 
 %post
-/opt/planetstack/scripts/opencloud initdb
+if [ "$1" == 1 ] ; then
+    echo "NEW INSTALL - initializing database"
+    /opt/planetstack/scripts/opencloud initdb
+else
+    echo "UPGRADE - doing evolution"
+    /opt/planetstack/scripts/opencloud evolvedb
+fi
+# start the server
+/opt/planetstack/scripts/opencloud runserver
 
 %preun
 if [ "$1" = 0 ] ; then
-    echo "doing preuninstall"
+    echo "UNINSTALL - destroying planetstack"
     rm -rf /opt/planetstack
 fi