[389-devel] Please review: auto upgrade during rpm posttrans

Nathan Kinder nkinder at redhat.com
Tue Oct 6 15:25:58 UTC 2009


On 10/05/2009 07:37 PM, Rich Megginson wrote:
> It is a problem that upgrade is not run automatically during rpm 
> installation.  It causes problems for other packages that depend on 
> 389.  This fix allows rpm to run the upgrade script.  Some notes:
> * had to write scriptlets in lua to allow data to be passed among 
> different phases - %posttrans does not know if it is being run as a 
> fresh install or an upgrade, so we have to get that information from 
> %post to pass to %posttrans
> * upgrade must be run in posttrans - in %post, the old package that is 
> being upgraded will still be around - this includes the old schema in 
> the schema dir - the update script assumes the contents of the schema 
> dir are correct and current - so we have to wait until %posttrans when 
> the schema dir will contain only the new schema
> * the upgrade script can only run non-interactively if the servers are 
> all shutdown first - so we have to shutdown the servers, run the 
> upgrade, then start the servers back up - however, if the user did not 
> want certain servers to be running, we first get a list of the running 
> servers, and only start those back up after the upgrade
>
> ------------------------------------------------------------------------
>
>    
I believe you need to add something like the following since you added 
the new dirsrv-snmp init script to the package:

%post
os.execute('/sbin/chkconfig --add %{pkgname}')


%postun
/sbin/service %{pkgname}-snmp stop >/dev/null 2>&1 || :
/sbin/chkconfig --del %{pkgname}-snmp

Other than that, it looks good.
> --
> 389-devel mailing list
> 389-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-directory-devel
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-directory-devel/attachments/20091006/b9af73e4/attachment.htm>


More information about the Fedora-directory-devel mailing list