rpms/389-admin/devel 389-admin.spec,1.6,1.7

Richard Allen Megginson rmeggins at fedoraproject.org
Tue Aug 25 20:05:59 UTC 2009


Author: rmeggins

Update of /cvs/extras/rpms/389-admin/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19934/devel

Modified Files:
	389-admin.spec 
Log Message:
Resolves 518418 -  Package rename shuts down server, results in unconfigured package
rewrite perm/owner preservation code to use lua
VS: ----------------------------------------------------------------------



Index: 389-admin.spec
===================================================================
RCS file: /cvs/extras/rpms/389-admin/devel/389-admin.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- 389-admin.spec	12 Aug 2009 20:00:08 -0000	1.6
+++ 389-admin.spec	25 Aug 2009 20:05:59 -0000	1.7
@@ -3,7 +3,7 @@
 Summary:          389 Administration Server (admin)
 Name:             389-admin
 Version:          1.1.8
-Release:          5%{?dist}
+Release:          6%{?dist}
 License:          GPLv2 and ASL 2.0
 URL:              http://port389.org/
 Group:            System Environment/Daemons
@@ -79,54 +79,25 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgnam
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%pre
-# save permission info in temp file
-# if upgrading
-if [ "$1" -gt 1 ] ; then
-    set -x
-    mydt=`date +%Y%m%d`
-    mytmpfile=${TMPDIR:-/tmp}/$mydt.$PPID
-    perm1=`stat --format=%%a %{_sysconfdir}/%{pkgname}/admin-serv 2> /dev/null`
-    if [ -z "$perm1" ] ; then
-        perm1=0
-    fi
-    own1=`stat --format=%%U:%%G %{_sysconfdir}/%{pkgname}/admin-serv 2> /dev/null`
-    if [ -z "$own1" ] ; then
-        own1=0
-    fi
-    perm2=`stat --format=%%a %{_sysconfdir}/%{pkgname}/admin-serv/console.conf 2> /dev/null`
-    if [ -z "$perm2" ] ; then
-        perm2=0
-    fi
-    own2=`stat --format=%%U:%%G %{_sysconfdir}/%{pkgname}/admin-serv/console.conf 2> /dev/null`
-    if [ -z "$own2" ] ; then
-        own2=0
-    fi
-    echo $perm1 $own1 $perm2 $own2 > $mytmpfile
-fi
-
-%post
-/sbin/chkconfig --add %{pkgname}-admin
-/sbin/ldconfig
-# if installing for the first time, make sure the config
-# directory and file have the correct permissions
-# the setup script is used to "fix" these
-if [ "$1" -gt 1 ]; then
-    set -x
-    mydt=`date +%Y%m%d`
-    mytmpfile=${TMPDIR:-/tmp}/$mydt.$PPID
-    if [ ! -f $mytmpfile ] ; then
-        echo Error: upgrade temp file $mytmpfile not found
-        exit 1
-    fi
-    cat $mytmpfile | while read perm1 own1 perm2 own2 ; do
-        chmod $perm1 %{_sysconfdir}/%{pkgname}/admin-serv
-        chown $own1 %{_sysconfdir}/%{pkgname}/admin-serv
-        chmod $perm2 %{_sysconfdir}/%{pkgname}/admin-serv/console.conf
-        chown $own2 %{_sysconfdir}/%{pkgname}/admin-serv/console.conf
-    done
-    rm -f $mytmpfile
-fi
+%pre -p <lua>
+-- save ownership/permissions on the dirs/files that rpm changes
+-- if these don't exist, the vars will be nil
+%{pkgname}admin_adminserv = posix.stat('%{_sysconfdir}/%{pkgname}/admin-serv')
+%{pkgname}admin_consoleconf = posix.stat('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf')
+
+%post -p <lua>
+-- do the usual daemon post setup stuff
+os.execute('/sbin/chkconfig --add %{pkgname}-admin')
+os.execute('/sbin/ldconfig')
+-- restore permissions if upgrading
+if %{pkgname}admin_adminserv then
+    posix.chmod('%{_sysconfdir}/%{pkgname}/admin-serv', %{pkgname}admin_adminserv.mode)
+    posix.chown('%{_sysconfdir}/%{pkgname}/admin-serv', %{pkgname}admin_adminserv.uid, %{pkgname}admin_adminserv.gid)
+end
+if %{pkgname}admin_consoleconf then
+    posix.chmod('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf', %{pkgname}admin_consoleconf.mode)
+    posix.chown('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf', %{pkgname}admin_consoleconf.uid, %{pkgname}admin_consoleconf.gid)
+end
 
 %preun
 if [ $1 = 0 ]; then
@@ -150,7 +121,10 @@ fi
 %{_mandir}/man8/*
 
 %changelog
-* Wed Aug 12 2009 Rich Megginson <rmeggins at redhat.com> - 1.1.8-4
+* Tue Aug 25 2009 Rich Megginson <rmeggins at redhat.com> - 1.1.8-6
+- rewrite perm/owner preservation code to use lua
+
+* Wed Aug 12 2009 Rich Megginson <rmeggins at redhat.com> - 1.1.8-5
 - final rebuild for 1.1.8 release
 
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1.8-4




More information about the fedora-extras-commits mailing list