Fix: Upgrade of package break install

Conflicts:
	build/rpm/dolibarr_fedora.spec
	build/rpm/dolibarr_generic.spec
This commit is contained in:
Laurent Destailleur 2013-07-24 13:49:40 +02:00
parent e8400afeba
commit f32bc24285
4 changed files with 144 additions and 112 deletions

View File

@ -302,33 +302,36 @@ 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
echo "Delete apache config link for Dolibarr ($apachelink)" # Remove
%{__rm} -f $apachelink echo "Removed package"
status=purge
fi
# Restart web servers if required # Define vars
if [ "x$status" = "xpurge" ] ; export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
/sbin/service httpd restart
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog %changelog

View File

@ -478,57 +478,69 @@ echo
#---- postun (after uninstall) #---- postun (after upgrade or uninstall)
%postun %postun
# Define vars if [ "x$1" = "x0" ] ;
os='unknown';
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
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 apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
%endif
%endif
# Remove apache link
if [ -L $apachelink ] ;
then then
echo "Delete apache config link for Dolibarr ($apachelink)" # Remove
%{__rm} -f $apachelink echo "Removed package"
status=purge
fi
# Restart web servers if required # Define vars
if [ "x$status" = "xpurge" ] ; os='unknown';
then %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
# Restart web server export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
echo Restart web server %else
if [ -f %{_sysconfdir}/init.d/httpd ]; then %if 0%{?suse_version}
%{_sysconfdir}/init.d/httpd restart export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi %else
if [ -f %{_sysconfdir}/init.d/apache2 ]; then if [ -d %{_sysconfdir}/httpd/conf.d ]; then
%{_sysconfdir}/init.d/apache2 restart export os='fedora-redhat';
fi 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
export os='opensuse';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
export os='mageia-mandriva';
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
fi
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
export os='ubuntu-debian';
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
fi
%endif
%endif
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service httpd restart
%else
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
%endif
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog %changelog

View File

@ -294,31 +294,40 @@ 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
echo "Delete apache config link for Dolibarr ($apachelink)" # Remove
%{__rm} -f $apachelink echo "Removed package"
status=purge
fi
# Restart web servers if required # Define vars
if [ "x$status" = "xpurge" ] ; export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
then
# Restart web server # Remove apache link
echo Restart web server if [ -L $apachelink ] ;
if [ -f %{_sysconfdir}/init.d/httpd ]; then then
%{_sysconfdir}/init.d/httpd restart echo "Delete apache config link for Dolibarr ($apachelink)"
fi %{__rm} -f $apachelink
if [ -f %{_sysconfdir}/init.d/apache2 ]; then status=purge
%{_sysconfdir}/init.d/apache2 restart fi
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi fi

View File

@ -300,33 +300,41 @@ 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
echo "Delete apache config link for Dolibarr ($apachelink)" # Remove
%{__rm} -f $apachelink echo "Removed package"
status=purge
fi
# Restart web servers if required # Define vars
if [ "x$status" = "xpurge" ] ; export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
# Remove apache link
if [ -L $apachelink ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart
fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi
else
# Upgrade
echo "No remove ation done (this is an upgrade)"
fi
%changelog %changelog