Index: /trunk/server/common/patches/moira-install-headers.patch
===================================================================
--- /trunk/server/common/patches/moira-install-headers.patch	(revision 1396)
+++ /trunk/server/common/patches/moira-install-headers.patch	(revision 1396)
@@ -0,0 +1,42 @@
+Index: moira/include/Makefile.in
+===================================================================
+--- moira.orig/include/Makefile.in	1999-07-12 12:21:05.000000000 -0400
++++ moira/include/Makefile.in	2009-11-19 10:23:05.000000000 -0500
+@@ -7,6 +7,10 @@
+ SRCTOP=@top_srcdir@
+ BUILDTOP=../..
+ 
++prefix=@prefix@
++includedir=@includedir@
++INSTALL=@INSTALL@
++
+ all:
+ 
+ clean:
+@@ -17,3 +21,5 @@
+ depend:
+ 
+ install:
++	$(SRCTOP)/mkinstalldirs $(DESTDIR)$(includedir)/moira
++	$(INSTALL) moira.h $(DESTDIR)$(includedir)/moira
+Index: moira/lib/Makefile.in
+===================================================================
+--- moira.orig/lib/Makefile.in	2009-06-01 17:05:01.000000000 -0400
++++ moira/lib/Makefile.in	2009-11-19 10:22:01.000000000 -0500
+@@ -25,6 +25,7 @@
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
++includedir=@includedir@
+ 
+ OBJS=	critical.lo fixhost.lo fixname.lo \
+ 	hash.lo kname_unparse.lo kname_parse.lo krb_et.lo mr_access.lo mr_auth.lo \
+@@ -54,6 +55,8 @@
+ 
+ install: all
+ 	$(LIBTOOL) --mode=install  $(INSTALL) libmoira.la $(DESTDIR)$(libdir)/libmoira.la
++	$(SRCTOP)/mkinstalldirs $(DESTDIR)$(includedir)/moira
++	$(INSTALL) mr_et.h krb_et.h ureg_err.h $(DESTDIR)$(includedir)/moira
+ 
+ libmoira.la: $(OBJS)
+ 	$(LIBTOOL) --mode=link $(CC) $(ALL_LDFLAGS) -o $@ $(OBJS) -rpath $(libdir) -version-info 0:0:0
Index: /trunk/server/common/patches/moira-update-server.rc.patch
===================================================================
--- /trunk/server/common/patches/moira-update-server.rc.patch	(revision 1396)
+++ /trunk/server/common/patches/moira-update-server.rc.patch	(revision 1396)
@@ -0,0 +1,131 @@
+--- /dev/null	2009-12-25 01:17:35.868011025 -0500
++++ moira-update-server.init	2009-12-26 22:31:51.000000000 -0500
+@@ -0,0 +1,128 @@
++#! /bin/sh
++# Stolen from Debathena
++
++### BEGIN INIT INFO
++# Provides:          moira-update-server
++# Required-Start:    $local_fs $remote_fs
++# Required-Stop:     $local_fs $remote_fs
++# Default-Start:     2 3 4 5
++# Default-Stop:      0 1 6
++# Short-Description: Moira update_server
++# Description:       The moira update_server program for taking updates from
++#                    moira
++### END INIT INFO
++
++# Original Author: Evan Broder <broder@mit.edu>
++# Modified for Fedora by Greg Brockman <gdb@mit.edu>
++
++# Do NOT "set -e"
++
++# PATH should only include /usr/* if it runs after the mountnfs.sh script
++
++prog=update_server
++exec=/usr/sbin/update_server
++config=/etc/athena/moira.conf
++
++# From Debathena
++PATH=/usr/sbin:/usr/bin:/sbin:/bin
++DESC="Moira update_server"
++DAEMON_ARGS=""
++SCRIPTNAME=/etc/rc.d/init.d/$NAME
++
++# Exit if the package is not installed
++[ -x "$exec" ] || exit 0
++
++# Read configuration variable file if it is present
++[ -r /etc/default/$prog ] && . /etc/default/$prog
++
++# Load the VERBOSE setting and other rcS variables
++[ -f /etc/default/rcS ] && . /etc/default/rcS
++
++# Define LSB log_* functions.
++# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
++. /lib/lsb/init-functions
++# End from Debathena
++
++# Source function library.
++. /etc/rc.d/init.d/functions
++
++[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
++
++lockfile=/var/lock/subsys/$prog
++
++start() {
++    [ -x $exec ] || exit 5
++    [ -f $config ] || exit 6
++    echo -n $"Starting $prog: "
++    # if not running, start it up here, usually something like "daemon $exec"
++    daemon $exec
++    retval=$?
++    echo
++    [ $retval -eq 0 ] && touch $lockfile
++    return $retval
++}
++
++stop() {
++    echo -n $"Stopping $prog: "
++    # stop it here, often "killproc $prog"
++    killproc $prog
++    retval=$?
++    echo
++    [ $retval -eq 0 ] && rm -f $lockfile
++    return $retval
++}
++
++restart() {
++    stop
++    start
++}
++
++reload() {
++    restart
++}
++
++force_reload() {
++    restart
++}
++
++rh_status() {
++    # run checks to determine if the service is running or use generic status
++    status $prog
++}
++
++rh_status_q() {
++    rh_status >/dev/null 2>&1
++}
++
++
++case "$1" in
++    start)
++        rh_status_q && exit 0
++        $1
++        ;;
++    stop)
++        rh_status_q || exit 0
++        $1
++        ;;
++    restart)
++        $1
++        ;;
++    reload)
++        rh_status_q || exit 7
++        $1
++        ;;
++    force-reload)
++        force_reload
++        ;;
++    status)
++        rh_status
++        ;;
++    condrestart|try-restart)
++        rh_status_q || exit 0
++        restart
++        ;;
++    *)
++        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
++        exit 2
++esac
++exit $?
Index: /trunk/server/fedora/Makefile
===================================================================
--- /trunk/server/fedora/Makefile	(revision 1395)
+++ /trunk/server/fedora/Makefile	(revision 1396)
@@ -20,5 +20,5 @@
 
 upstream_yum	= krb5 krb5.i586 httpd openssh
-upstream	= openafs $(upstream_yum)
+upstream	= openafs $(upstream_yum) moira
 oursrc		= execsys tokensys accountadm httpdmods logview sql-signup nss_nonlocal nss_nonlocal.i586 whoisd mit-zephyr athrun php_scripts scripts-base
 allsrc		= $(upstream) $(oursrc)
@@ -66,4 +66,5 @@
 	cd $(dload) && yumdownloader --source $(upstream_yum)
 	wget -P $(dload) $(openafs_url)
+	cd $(tmp_src) && wget -nd -r -l1 -np -A.orig.tar.gz http://debathena.mit.edu/apt/pool/debathena/d/debathena-moira/
 	touch download_stamp
 
Index: /trunk/server/fedora/specs/moira.spec
===================================================================
--- /trunk/server/fedora/specs/moira.spec	(revision 1395)
+++ /trunk/server/fedora/specs/moira.spec	(revision 1396)
@@ -1,19 +1,23 @@
-Summary: rpm packaging of libmoira
+# Make sure to update these to coincide with the most recent debathena-moira
+# release from http://debathena.mit.edu/apt/pool/debathena/d/debathena-moira/
+%define debversion 4.0.0
+%define upstreamversion cvs20091116
+Summary: rpm packaging of moira libraries, clients, and friends.
 Group: Applications/System
 Name: moira
-Version: 0.%{scriptsversion}
-Release: 0
+Version: %{debversion}
+Release: 2.%{scriptsversion}.%{upstreamversion}
 Vendor: The scripts.mit.edu Team (scripts@mit.edu)
 URL: http://scripts.mit.edu
-License: GPL
-Source: %{name}.tar.gz
-Source1: debian/debathena-moira-update-server.init
+License: MIT
+Source: debathena-%{name}_%{debversion}+%{upstreamversion}.orig.tar.gz
 BuildRoot: %{_tmppath}/%(%{__id_u} -n)-%{name}-%{version}-root
 #TODO: might really need mit-zephyr-devel, something for autotools-dev
-BuildRequires: readline-devel, patch, e2fsprogs-devel, mit-zephyr, ncurses-devel, krb5-devel, hesiod-devel
-patch0: debian/patches/install-headers
+BuildRequires: readline-devel, e2fsprogs-devel, mit-zephyr, ncurses-devel, krb5-devel, hesiod-devel
+Patch0: moira-install-headers.patch
+Patch1: moira-update-server.rc.patch
 
 %description
-rpm packaging of libmoira
+rpm packaging of moira libraries, clients, and friends.
 
 Source package for the moira library and clients.  Clone of debathena-moira.
@@ -21,7 +25,7 @@
 
 %prep
-%setup -q -n %{name}
-cp -p /home/scripts-build/test/trunk/server/fedora/specs/mybuild/moira-update-server.init %{SOURCE1}
+%setup -q -n debathena-%{name}-%{debversion}+%{upstreamversion}
 %patch0 -p1
+%patch1
 
 %build
@@ -43,5 +47,5 @@
    %{buildroot}/%{_mandir}/man1/chfn.moira.1
 install -m 755 -d %{buildroot}/%{_initddir}
-install -m 755 %{SOURCE1} %{buildroot}/%{_initddir}/moira-update-server
+install -m 755 moira-update-server.init %{buildroot}/%{_initddir}/moira-update-server
 # Hack: These man files are installed but no package uses them
 rm %{buildroot}/%{_mandir}/man8/dcm.8
@@ -56,13 +60,9 @@
 rm -rf %{buildroot}
 
-%changelog
-* Fri Dec 26 2009  Greg Brockman <gdb@mit.edu>
-- prerelease
-
-# moira-clients
-%package moira-clients
+# clients
+%package clients
 Summary: Clients for the Moira database
 Group: Applications/System
-%description moira-clients
+%description clients
 Clients for the Moira database
 
@@ -73,5 +73,6 @@
 This package contains clients such as moira, stella, blanche, etc.
 
-%files moira-clients
+%files clients
+%defattr(755,root,root)
 %{_bindir}/addusr
 %{_bindir}/blanche
@@ -91,15 +92,16 @@
 %{_bindir}/usermaint
 %{_bindir}/update_test
+%defattr(-,root,root)
 %doc %{_mandir}/man1/*
 %doc %{_mandir}/man8/mrtest.8.gz
 
 
-# moira-update-server
-%package moira-update-server
+# update-server
+%package update-server
 Summary: Athena update_server
 Group: Applications/System
 Requires(post): chkconfig
 Requires(preun): chkconfig
-%description moira-update-server
+%description update-server
 Athena update_server
 
@@ -111,5 +113,5 @@
 servers that automatically receive information dumps from moira.
 
-%files moira-update-server
+%files update-server
 %defattr(-,root,root)
 %doc %{_mandir}/man8/update_server.8.gz
@@ -119,8 +121,9 @@
 %{_initddir}/moira-update-server
 
-%post moira-update-server
+%post update-server
 /sbin/chkconfig --add moira-update-server
+%{_initddir}/moira-update-server condrestart
 
-%preun moira-update-server
+%preun update-server
 if [ $1 = 0 ] ; then
     /sbin/service moira-update-server stop >/dev/null 2>&1
@@ -129,8 +132,8 @@
 
 # libmoira0
-%package libmoira0
+%package -n libmoira0
 Summary: The Moira library
 Group: System Environment/Libraries
-%description libmoira0
+%description -n libmoira0
 The Moira library
 
@@ -141,14 +144,18 @@
 This package contains the shared Moira library.
 
-%files libmoira0
+%post -n libmoira0 -p /sbin/ldconfig
+%postun -n libmoira0 -p /sbin/ldconfig
+
+%files -n libmoira0
+%defattr(-,root,root)
 %{_libdir}/libmoira.so.*
 
-# libmoira-dev
-%package libmoira-dev
+# libmoira-devel
+%package -n libmoira-devel
 Summary: Development files for Moira library
 Group: Development/Libraries
-Provides: libmoira-dev
+Provides: libmoira-devel
 Requires: libmoira0
-%description libmoira-dev
+%description -n libmoira-devel
 Development files for Moira library
 
@@ -159,5 +166,8 @@
 This package contains headers and static libraries for development.
 
-%files libmoira-dev
+%post -n libmoira-devel -p /sbin/ldconfig
+%postun -n libmoira-devel -p /sbin/ldconfig
+
+%files -n libmoira-devel
 %defattr(-,root,root)
 %{_includedir}/*
@@ -166,2 +176,6 @@
 %{_libdir}/libmoira.la
 %{_libdir}/libmoira.a
+
+%changelog
+* Sat Dec 26 2009 Greg Brockman <gdb@mit.edu> - 4.0.0-2.1380.cvs20091116
+- Initial packaging of Moira on Fedora
