rpms/389-ds-base/F-11 389-ds-base-git-local.sh, NONE, 1.1 .cvsignore, 1.3, 1.4 389-ds-base.spec, 1.5, 1.6 sources, 1.4, 1.5

Richard Allen Megginson rmeggins at fedoraproject.org
Wed Oct 7 15:42:35 UTC 2009


Author: rmeggins

Update of /cvs/extras/rpms/389-ds-base/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19772/F-11

Modified Files:
	.cvsignore 389-ds-base.spec sources 
Added Files:
	389-ds-base-git-local.sh 
Log Message:
1.2.3 release
added template-initconfig to %files
%posttrans now runs update to update the server instances
servers are shutdown, then restarted if running before install
scriptlets mostly use lua now to pass data among scriptlet phases
Added 389-ds-base-git-local.sh script to generate a source tarball
from a local git repository and a git tag



--- NEW FILE 389-ds-base-git-local.sh ---
#!/bin/bash

DATE=`date +%Y%m%d`
# use a real tag name here
TAG=389-ds-base-1.2.3
VERSION=1.2.3
PKGNAME=389-ds-base
#SRCNAME=$PKGNAME-$VERSION-$DATE
SRCNAME=$PKGNAME-$VERSION

echo you must be in the ds git repo to use this
git status > /dev/null || echo bye
if [ -z "$1" ] ; then
	dir=.
else
	dir="$1"
fi

git archive --prefix=$SRCNAME/ $TAG | bzip2 > $dir/$SRCNAME.tar.bz2


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/389-ds-base/F-11/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- .cvsignore	25 Aug 2009 20:00:51 -0000	1.3
+++ .cvsignore	7 Oct 2009 15:42:35 -0000	1.4
@@ -1,2 +1 @@
-389-ds-base-1.2.1.tar.bz2
-389-ds-base-1.2.2.tar.bz2
+389-ds-base-1.2.3.tar.bz2


Index: 389-ds-base.spec
===================================================================
RCS file: /cvs/extras/rpms/389-ds-base/F-11/389-ds-base.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- 389-ds-base.spec	8 Sep 2009 19:24:58 -0000	1.5
+++ 389-ds-base.spec	7 Oct 2009 15:42:35 -0000	1.6
@@ -3,8 +3,8 @@
 
 Summary:          389 Directory Server (base)
 Name:             389-ds-base
-Version:          1.2.2
-Release:          2%{?dist}
+Version:          1.2.3
+Release:          1%{?dist}
 License:          GPLv2 with exceptions
 URL:              http://port389.org/
 Group:            System Environment/Daemons
@@ -146,24 +146,37 @@ if rc == 0 then
     end
 end
 
-%post
-/sbin/chkconfig --add %{pkgname}
-/sbin/ldconfig
-# this has been problematic - if this directory
-# does not exist, the server will silently fail to
-# start - however, if the user has already created
-# it, we don't want to overwrite the permissions
-# on it - so we can't list it explicitly in the
-# files section - we list it as a ghost so that
-# it will be removed when the rpm is removed
-if [ ! -d %{_localstatedir}/run/%{pkgname} ] ; then
-    mkdir -p %{_localstatedir}/run/%{pkgname}
-fi
+%post -p <lua>
+os.execute('/sbin/chkconfig --add %{pkgname}')
+os.execute('/sbin/ldconfig')
+os.execute('/sbin/chkconfig --add %{pkgname}-snmp')
+-- this has been problematic - if this directory
+-- does not exist, the server will silently fail to
+-- start - however, if the user has already created
+-- it, we don't want to overwrite the permissions
+-- on it - so we can't list it explicitly in the
+-- files section - we list it as a ghost so that
+-- it will be removed when the rpm is removed
+if not posix.access("%{_localstatedir}/run/%{pkgname}") then
+    posix.mkdir("%{_localstatedir}/run/%{pkgname}")
+end
+-- since posttrans is not passed the upgrade status, we get
+-- it here
+if (arg[2] > 1) or %{pkgname}_exists then
+--    print("in %{pkgname} post - upgrading")
+    %{pkgname}_upgrading = true
+else
+--    print("in %{pkgname} post - installing")
+    %{pkgname}_upgrading = false
+end
+
 
 %preun
 if [ $1 = 0 ]; then
         /sbin/service %{pkgname} stop >/dev/null 2>&1 || :
         /sbin/chkconfig --del %{pkgname}
+        /sbin/service %{pkgname}-snmp stop >/dev/null 2>&1 || :
+        /sbin/chkconfig --del %{pkgname}-snmp
 fi
 
 %postun -p /sbin/ldconfig
@@ -177,9 +190,45 @@ if %{pkgname}_savelinks then
 --        print("posttrans - restored run level "..fullpath.." to "..link)
     end
 end
+if %{pkgname}_upgrading then
+    instbase = "%{_sysconfdir}/%{pkgname}"
+--    print("posttrans - upgrading - looking for instances in "..instbase)
+-- find all instances
+    instances = {} -- instances that require a restart after upgrade
+    for dir in posix.files(instbase) do
+--        print("dir="..dir)
+        if string.find(dir,"^slapd-") and not string.find(dir,"\.removed$") then
+            inst = string.gsub(dir,"^slapd[-]", "")
+--            print("found instance "..inst.." getting status")
+            rc = os.execute('/sbin/service %{pkgname} status '..inst..' >/dev/null 2>&1')
+-- if instance is running, we must restart it after upgrade
+            if rc == 0 then
+                instances[inst] = inst
+--                print("instance "..inst.." is running")
+--            else
+--                print("instance "..inst.." is shutdown")
+            end
+        end
+    end
+-- shutdown all instances
+--    print("shutting down all instances . . .")
+    os.execute('/sbin/service %{pkgname} stop > /dev/null 2>&1')
+-- do the upgrade
+--    print("upgrading instances . . .")
+    os.execute('%{_sbindir}/setup-ds.pl -l /dev/null -u -s General.UpdateMode=offline > /dev/null 2>&1')
+-- restart instances that require it
+    for inst,dummy in pairs(instances) do
+--        print("restarting instance "..inst)
+        os.execute('/sbin/service %{pkgname} start '..inst..' >/dev/null 2>&1')
+    end
+end
+-- if we upgraded from fedora to 389, the upgrade will shutdown
+-- all old running instances, so we have to start them here
 if %{pkgname}_exists then
+--    print("restarting all instances due to package rename")
     os.execute('/sbin/service %{pkgname} start >/dev/null 2>&1')
 end
+   
 
 %files
 %defattr(-,root,root,-)
@@ -190,9 +239,12 @@ end
 %dir %{_sysconfdir}/%{pkgname}/config
 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/slapd-collations.conf
 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/certmap.conf
+%config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf
+%config(noreplace)%{_sysconfdir}/%{pkgname}/config/template-initconfig
 %config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}
 %{_datadir}/%{pkgname}
 %{_sysconfdir}/rc.d/init.d/%{pkgname}
+%{_sysconfdir}/rc.d/init.d/%{pkgname}-snmp
 %{_bindir}/*
 %{_sbindir}/*
 %dir %{_libdir}/%{pkgname}
@@ -213,6 +265,13 @@ end
 %{_libdir}/%{pkgname}/*.so
 
 %changelog
+* Mon Sep 14 2009 Rich Megginson <rmeggins at redhat.com> - 1.2.3-1
+- 1.2.3 release
+- added template-initconfig to %files
+- %posttrans now runs update to update the server instances
+- servers are shutdown, then restarted if running before install
+- scriptlets mostly use lua now to pass data among scriptlet phases
+
 * Tue Sep 08 2009 Nathan Kinder <nkinder at redhat.com> - 1.2.2-2
 - removed BuildRequires for lm_sensors on s390 and s390x
 


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/389-ds-base/F-11/sources,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- sources	25 Aug 2009 20:00:51 -0000	1.4
+++ sources	7 Oct 2009 15:42:35 -0000	1.5
@@ -1 +1 @@
-143564394e4ad20bf4ea96e3e8ce970a  389-ds-base-1.2.2.tar.bz2
+1a21a7490d71a585025af657ee133790  389-ds-base-1.2.3.tar.bz2




More information about the fedora-extras-commits mailing list