Skip to content

Commit

Permalink
Fix: Upgrade of package break install
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 24, 2013
1 parent 7ae06c6 commit f4987a6
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 111 deletions.
44 changes: 26 additions & 18 deletions build/rpm/dolibarr_fedora.spec
Expand Up @@ -297,29 +297,37 @@ echo "-------------------------------------------------------"
echo


#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun

# Define vars
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"

# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
# 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)"
%{__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

# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
/sbin/service httpd restart
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
%changelog
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
Expand Down
104 changes: 56 additions & 48 deletions build/rpm/dolibarr_generic.spec
Expand Up @@ -488,63 +488,71 @@ echo



#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun

# Define vars
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 ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
fi
# Remove
echo "Removed package"

# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
then
# Restart web server
echo Restart web server
# Define vars
os='unknown';
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion}
/sbin/service httpd restart
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
%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
%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
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



# 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
* Sun Feb 17 2013 Laurent Destailleur 3.4.0-0.3
Expand Down
53 changes: 31 additions & 22 deletions build/rpm/dolibarr_mandriva.spec
Expand Up @@ -296,31 +296,40 @@ echo "-------------------------------------------------------"
echo


#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun

# 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)"
%{__rm} -f $apachelink
status=purge
fi

# Restart web servers if required
if [ "x$status" = "xpurge" ] ;
if [ "x$1" = "x0" ] ;
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
# 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)"
%{__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


Expand Down
54 changes: 31 additions & 23 deletions build/rpm/dolibarr_opensuse.spec
Expand Up @@ -302,34 +302,42 @@ echo "-------------------------------------------------------"
echo


#---- postun (after uninstall)
#---- postun (after upgrade or uninstall)
%postun

# Define vars
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"

# Remove apache link
if [ -L $apachelink ] ;
if [ "x$1" = "x0" ] ;
then
echo "Delete apache config link for Dolibarr ($apachelink)"
%{__rm} -f $apachelink
status=purge
# 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)"
%{__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

# 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



# 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
Expand Down

0 comments on commit f4987a6

Please sign in to comment.