summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2011-10-27 18:29:53 +0200
committerRemi Collet <fedora@famillecollet.com>2011-10-27 18:29:53 +0200
commite978f882d02861b45e93c3a82f67d685863ccd2e (patch)
treef26ff92f06b276d8353d64954df5d04d6ab65c3c
parent75eccfa59bbaf55dacc7153deaa4672fc6a0c74d (diff)
ocsinventory: improve upgrade from 1.3.3
-rw-r--r--ocsinventory-upgrade.patch49
-rw-r--r--ocsinventory.spec16
2 files changed, 62 insertions, 3 deletions
diff --git a/ocsinventory-upgrade.patch b/ocsinventory-upgrade.patch
new file mode 100644
index 0000000..bd8626a
--- /dev/null
+++ b/ocsinventory-upgrade.patch
@@ -0,0 +1,49 @@
+diff -up ocsreports/install.php.orig ocsreports/install.php
+--- ocsreports/install.php.orig 2011-10-27 18:04:00.011717775 +0200
++++ ocsreports/install.php 2011-10-27 18:16:38.947261089 +0200
+@@ -99,10 +99,32 @@ if( isset($_POST["name"])) {
+ if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
+ fclose($hnd);
+ require("dbconfig.inc.php");
+- $valNme = COMPTE_BASE;
+- $valPass = PSWD_BASE;
+- $valServ = SERVER_WRITE;
+- $valdatabase = DB_NAME;
++ if (defined('COMPTE_BASE')) { // Upgrade from 2.0.x
++ $valNme = COMPTE_BASE;
++ } else if (isset($_SESSION["COMPTE_BASE"])) { // Upgrade from 1.3.x
++ $valNme = $_SESSION["COMPTE_BASE"];
++ } else { // Fresh install
++ $valNme = '';
++ }
++ if (defined('PSWD_BASE')) {
++ $valPass = PSWD_BASE;
++ } else if (isset($_SESSION["PSWD_BASE"])) {
++ $valPass = $_SESSION["PSWD_BASE"];
++ } else {
++ $valPass = '';
++ }
++ if (defined('SERVER_WRITE')) {
++ $valServ = SERVER_WRITE;
++ } else if (isset($_SESSION["SERVEUR_SQL"])) {
++ $valServ = $_SESSION["SERVEUR_SQL"];
++ } else {
++ $valServ = '';
++ }
++ if (defined('DB_NAME')) {
++ $valdatabase = DB_NAME;
++ } else { // Upgrade from 1.3.x
++ $valdatabase = 'ocsweb';
++ }
+ }
+
+ if( ! $instOk ) {
+@@ -113,7 +135,7 @@ if( ! $instOk ) {
+ $name_field=array("name","pass","database","host");
+ $tab_name= array($l->g(247).": ",$l->g(248).": ",$l->g(1233).":",$l->g(250).":");
+ $type_field= array(0,4,0,0);
+- $value_field=array($valNme,$valPass,(isset($valdatabase) && $valdatabase!= 'DB_NAME'? $valdatabase: "ocsweb"),$valServ);
++ $value_field=array($valNme,$valPass,$valdatabase,$valServ);
+
+ $tab_typ_champ=show_field($name_field,$type_field,$value_field);
+ tab_modif_values($tab_name,$tab_typ_champ,$tab_hidden,$title="",$comment="",$name_button="INSTALL",$showbutton='BUTTON',$form_name);
diff --git a/ocsinventory.spec b/ocsinventory.spec
index 4dcd5ce..4e76e9f 100644
--- a/ocsinventory.spec
+++ b/ocsinventory.spec
@@ -12,7 +12,7 @@ Name: ocsinventory
Summary: Open Computer and Software Inventory Next Generation
Version: 2.0.2
-Release: 1%{?dist}
+Release: 1%{?dist}.1
Group: Applications/Internet
License: GPLv2
@@ -22,6 +22,8 @@ URL: http://www.ocsinventory-ng.org/
Source0: http://launchpad.net/ocsinventory-server/stable-2.0/%{version}/+download/%{tarname}-%{version}.tar.gz
Source1: ocsinventory-reports.conf
+# Manage upgrade from 1.3.x
+Patch0: %{name}-upgrade.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -129,6 +131,8 @@ navigateur favori.
%prep
%setup -q -n %{tarname}-%{version}
+%patch0 -p0
+
chmod -x binutils/ocs-errors
%build
@@ -229,6 +233,7 @@ semanage fcontext -a -s system_u -t httpd_log_t -r s0 "%{_localstatedir}/log/ocs
restorecon -R %{_localstatedir}/log/ocsinventory-server
) &>/dev/null ||:
%endif
+/sbin/service httpd condrestart > /dev/null 2>&1 || :
%post reports
@@ -245,12 +250,13 @@ restorecon -R %{_localstatedir}/lib/ocsinventory-reports
%postun server
-%if %{useselinux}
if [ "$1" -eq "0" ]; then
+%if %{useselinux}
# Remove the File Context
semanage fcontext -d "%{_localstatedir}/log/ocsinventory-server(/.*)?" &>/dev/null || :
-fi
%endif
+ /sbin/service httpd condrestart > /dev/null 2>&1 || :
+fi
%postun reports
@@ -296,6 +302,10 @@ fi
%changelog
+* Thu Oct 27 2011 Remi Collet <Fedora@famillecollet.com> - 2.0.2-1.1
+- add patch for upgrade from 1.3.x
+- restart apache
+
* Sun Oct 23 2011 Remi Collet <Fedora@famillecollet.com> - 2.0.2-1
- update to 2.0.2