Fix: Upgrade of package break install

This commit is contained in:
Laurent Destailleur 2013-07-24 13:44:08 +02:00
parent 7ae06c6f45
commit f4987a6fa5
4 changed files with 142 additions and 109 deletions

View File

@ -297,29 +297,37 @@ echo "-------------------------------------------------------"
echo echo
#---- postun (after uninstall) #---- postun (after upgrade or uninstall)
%postun %postun
# Define vars if [ "x$1" = "x0" ] ;
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then then
# Remove
echo "Removed package"
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
/sbin/service httpd restart /sbin/service httpd restart
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3 * Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3

View File

@ -488,47 +488,52 @@ echo
#---- postun (after uninstall) #---- postun (after upgrade or uninstall)
%postun %postun
# Define vars if [ "x$1" = "x0" ] ;
os='unknown'; then
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} # Remove
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" echo "Removed package"
%else
%if 0%{?suse_version} # Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" os='unknown';
%else %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
if [ -d %{_sysconfdir}/httpd/conf.d ]; then export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
%else
%if 0%{?suse_version}
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
%else
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
export os='fedora-redhat'; export os='fedora-redhat';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse'; export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva'; export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian'; export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi fi
%endif %endif
%endif %endif
# Remove apache link # Remove apache link
if [ -L $apachelink ] ; if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
@ -541,10 +546,13 @@ then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
%endif %endif
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3 * Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3

View File

@ -296,23 +296,28 @@ echo "-------------------------------------------------------"
echo echo
#---- postun (after uninstall) #---- postun (after upgrade or uninstall)
%postun %postun
# Define vars if [ "x$1" = "x0" ] ;
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then then
# Remove
echo "Removed package"
# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
@ -321,6 +326,10 @@ then
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi fi

View File

@ -302,23 +302,28 @@ echo "-------------------------------------------------------"
echo echo
#---- postun (after uninstall) #---- postun (after upgrade or uninstall)
%postun %postun
# Define vars if [ "x$1" = "x0" ] ;
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then then
# Remove
echo "Removed package"
# Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)" echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink %{__rm} -f $apachelink
status=purge status=purge
fi fi
# Restart web servers if required # Restart web servers if required
if [ "x$status" = "xpurge" ] ; if [ "x$status" = "xpurge" ] ;
then then
# Restart web server # Restart web server
echo Restart web server echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
@ -327,10 +332,13 @@ then
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart %{_sysconfdir}/init.d/apache2 restart
fi fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3 * Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3