From b6c98e46b79fa33d47fe03c7f47008270d13c5bc Mon Sep 17 00:00:00 2001 From: Tom Parkin Date: Mon, 17 Nov 2008 13:06:24 +0000 Subject: [PATCH] Fixed up packaging system for generic RPM --- packaging4/RPM/samba.init | 113 +++++++++++++ packaging4/RPM/samba.log | 7 + packaging4/RPM/samba.spec | 375 +++++++++++++++++++++++++++++++++++++++++ packaging4/RPM/samba.sysconfig | 2 + source4/Makefile | 2 +- 5 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 packaging4/RPM/samba.init create mode 100644 packaging4/RPM/samba.log create mode 100644 packaging4/RPM/samba.spec create mode 100644 packaging4/RPM/samba.sysconfig diff --git a/packaging4/RPM/samba.init b/packaging4/RPM/samba.init new file mode 100644 index 00000000000..b8d8c701907 --- /dev/null +++ b/packaging4/RPM/samba.init @@ -0,0 +1,113 @@ +#!/bin/sh +# +# chkconfig: - 91 35 +# description: Starts and stops the Samba samba daemon \ +# used to provide SMB network services. +# +# pidfile: /var/run/samba/samba.pid +# config: /etc/samba/smb.conf + +SAMBA_NAME=samba + +# Source function library. +if [ -f /etc/init.d/functions ] ; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ] ; then + . /etc/rc.d/init.d/functions +else + exit 1 +fi + +# Avoid using root's TMPDIR +unset TMPDIR + +# Source networking configuration. +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/$SAMBA_NAME ]; then + . /etc/sysconfig/$SAMBA_NAME +fi + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 1 + +# Check that smb.conf exists. +[ -f /etc/$SAMBA_NAME/smb.conf ] || exit 6 + +RETVAL=0 + + +start() { + echo -n $"Starting Samba services: " + daemon samba $SMBDOPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SAMBA_NAME || \ + RETVAL=1 + return $RETVAL +} + +stop() { + echo -n $"Shutting down Samba services: " + killproc samba + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SAMBA_NAME + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading smb.conf file: " + killproc samba -HUP + RETVAL=$? + echo + return $RETVAL +} + +rhstatus() { + status samba + return $? +} + + +# Allow status as non-root. +if [ "$1" = status ]; then + rhstatus + exit $? +fi + +# Check that we can write to it... so non-root users stop here +[ -w /etc/$SAMBA_NAME/smb.conf ] || exit 4 + + + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + condrestart) + [ -f /var/lock/subsys/$SAMBA_NAME ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" + exit 2 +esac + +exit $? diff --git a/packaging4/RPM/samba.log b/packaging4/RPM/samba.log new file mode 100644 index 00000000000..cd0cf9ae07b --- /dev/null +++ b/packaging4/RPM/samba.log @@ -0,0 +1,7 @@ +/var/log/samba4/* { + notifempty + olddir /var/log/samba4/old + missingok + sharedscripts + copytruncate +} diff --git a/packaging4/RPM/samba.spec b/packaging4/RPM/samba.spec new file mode 100644 index 00000000000..192221fc1d7 --- /dev/null +++ b/packaging4/RPM/samba.spec @@ -0,0 +1,375 @@ + +%define main_release 5 +%define alpha_version 5 +%define samba_version 4.0.0alpha%{alpha_version} +%define tarball_name samba-4.0.0alpha%{alpha_version} +%define version_info unknown + +#Set what versions we require for tdb and talloc +%define tdb_version 1.1.1 +%define talloc_version 1.2.0 + +%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} + +Summary: The Samba4 CIFS and AD client and server suite +Name: samba +Version: 4.0.0 +Release: 0.%{main_release}.alpha%{alpha_version}%{?dist} +License: GPLv3+ and LGPLv3+ +Group: System Environment/Daemons +URL: http://www.samba.org/ + +Source: http://download.samba.org/samba/ftp/samba4/%{tarball_name}.tar.gz + +# Red Hat specific replacement-files +Source1: %{name}.log +Source4: %{name}.sysconfig +Source5: %{name}.init + +Requires(pre): %{name}-common = %{version}-%{release} +Requires: pam >= 0:0.64 +Requires: logrotate >= 0:3.4 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Requires(pre): /usr/sbin/groupadd +Requires(post): /sbin/chkconfig, /sbin/service +Requires(preun): /sbin/chkconfig, /sbin/service +BuildRequires: pam-devel, readline-devel, ncurses-devel, libacl-devel, e2fsprogs-devel +#BuildRequires: popt-devel +BuildRequires: libattr-devel, libaio-devel, sed +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: libtalloc-devel >= %{talloc_version} +BuildRequires: libtdb-devel >= %{tdb_version} + +%description + +Samba 4 is the ambitious next version of the Samba suite that is being +developed in parallel to the stable 3.0 series. The main emphasis in +this branch is support for the Active Directory logon protocols used +by Windows 2000 and above. + +%package client +Summary: Samba client programs +Group: Applications/System +Requires: %{name}-common = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} + +%description client +The %{name}-client package provides some SMB/CIFS clients to complement +the built-in SMB/CIFS filesystem in Linux. These clients allow access +of SMB/CIFS shares and printing to SMB/CIFS printers. + +%package libs +Summary: Samba libraries +Group: Applications/System + +%description libs +The %{name}-libs package contains the libraries needed by programs +that link against the SMB, RPC and other protocols provided by the Samba suite. + +%package python +Summary: Samba python libraries +Group: Applications/System +Requires: %{name}-libs = %{version}-%{release} + +%description python +The %{name}-python package contains the python libraries needed by programs +that use SMB, RPC and other Samba provided protocols in python programs/ + +%package devel +Summary: Developer tools for Samba libraries +Group: Development/Libraries +Requires: %{name}-libs = %{version}-%{release} + +%description devel +The %{name}-devel package contains the header files for the libraries +needed to develop programs that link against the SMB, RPC and other +libraries in the Samba suite. + +%package pidl +Summary: Perl IDL compiler +Group: Development/Tools +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description pidl +The %{name}-pidl package contains the Perl IDL compiler used by Samba +and Wireshark to parse IDL and similar protocols + +%package common +Summary: Files used by both Samba servers and clients +Group: Applications/System +Requires: %{name}-libs = %{version}-%{release} + +%description common +%{Name}-common provides files necessary for both the server and client +packages of Samba. + +%package winbind +Summary: Samba winbind +Group: Applications/System +Requires: %{name} = %{version}-%{release} + +%description winbind +The samba-winbind package provides the winbind NSS library, and some +client tools. Winbind enables Linux to be a full member in Windows +domains and to use Windows user and group accounts on Linux. + + +%prep +# TAG: change for non-pre +%setup -q -n %{tarball_name} +#%setup -q + +# copy Red Hat specific scripts + +mv source4/VERSION source4/VERSION.orig +sed -e 's/SAMBA_VERSION_VENDOR_SUFFIX=$/&%{release}/' < source4/VERSION.orig > source4/VERSION +cd source4 +GIT_INFO="%version_info" script/mkversion.sh +cd .. + +%build +cd source4 + +test -r ./configure || ./autogen.sh +%configure \ + --with-fhs \ + --enable-fhs \ + --with-lockdir=/var/lib/%{name} \ + --with-piddir=/var/run \ + --with-privatedir=/var/lib/%{name}/private \ + --with-logfilebase=/var/log/%{name} \ + --sysconfdir=%{_sysconfdir} \ + --with-winbindd-socket-dir=/var/run/winbind \ + --with-ntp-signd-socket-dir=/var/run/ntp_signd \ + --disable-gnutls + +#Build PIDL for installation into vendor directories before 'make proto' gets to it +(cd pidl && %{__perl} Makefile.PL INSTALLDIRS=vendor ) + +#Builds using PIDL the IDL and many other things +make proto + +make everything + +%install +rm -rf $RPM_BUILD_ROOT + +cd source4 + +#Don't call 'make install' as we want to call out to the PIDL install manually +make install DESTDIR=%{buildroot} + +#Undo the PIDL install, we want to try again with the right options +rm -rf $RPM_BUILD_ROOT/%{_libdir}/perl5 +rm -rf $RPM_BUILD_ROOT/%{_datadir}/perl5 + +cd .. + +#Install PIDL +( cd pidl && make install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT/ ) + +#Clean out crap left behind by the Pidl install +find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; +find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; + +mkdir -p $RPM_BUILD_ROOT/%{_initrddir} +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name} +mkdir -p $RPM_BUILD_ROOT/var/run/winbindd +mkdir -p $RPM_BUILD_ROOT/var/run/ntp_signd +mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/winbindd_privileged +mkdir -p $RPM_BUILD_ROOT/var/log/%{name}/ +mkdir -p $RPM_BUILD_ROOT/var/log/%{name}/old + +mkdir -p $RPM_BUILD_ROOT/var/lib/%{name} +mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/private +mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}/sysvol + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig + +# Install other stuff +install -m755 %{SOURCE5} $RPM_BUILD_ROOT/%{_initrddir}/%{name} +install -m644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name} + +# winbind +mkdir -p $RPM_BUILD_ROOT/%{_lib} +ln -sf ../%{_libdir}/libnss_winbind.so $RPM_BUILD_ROOT/%{_lib}/libnss_winbind.so.2 + +# libs { +mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir} + +# } + +install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} + +#clean out some stuff we don't want in the Fedora package +rm -f $RPM_BUILD_ROOT/%{_bindir}/autoidl* +rm -f $RPM_BUILD_ROOT/%{_bindir}/epdump* +rm -f $RPM_BUILD_ROOT/%{_bindir}/gentest +rm -f $RPM_BUILD_ROOT/%{_bindir}/locktest +rm -f $RPM_BUILD_ROOT/%{_bindir}/masktest +rm -f $RPM_BUILD_ROOT/%{_bindir}/minschema* +rm -f $RPM_BUILD_ROOT/%{_bindir}/rpcclient +rm -f $RPM_BUILD_ROOT/%{_bindir}/samba3dump +rm -f $RPM_BUILD_ROOT/%{_bindir}/setnttoken +rm -f $RPM_BUILD_ROOT/%{_bindir}/getntacl +rm -f $RPM_BUILD_ROOT/%{_datadir}/samba/js/base.js +rm -fr $RPM_BUILD_ROOT/%{_libdir}/python2.4/lib/subunit + +# Whats this doing here? +rm -fr $RPM_BUILD_ROOT/perl5/ + +#This makes the right links, as rpmlint requires that the +#ldconfig-created links be recorded in the RPM. +/sbin/ldconfig -N -n $RPM_BUILD_ROOT/%{_libdir} + +#Fix up permission on perl install +%{_fixperms} $RPM_BUILD_ROOT/%{perl_sitelib} + +#Fix up permissions in source tree, for debuginfo +find source4/heimdal -type f | xargs chmod -x + +%clean +rm -rf $RPM_BUILD_ROOT + +%pre +getent group wbpriv >/dev/null || groupadd -g 88 wbpriv +exit 0 + +%post +/sbin/chkconfig --add %{name} +if [ "$1" -ge "1" ]; then + /sbin/service %{name} condrestart >/dev/null 2>&1 || : +fi +exit 0 + +%preun +if [ $1 = 0 ] ; then + /sbin/service %{name} stop >/dev/null 2>&1 || : + /sbin/chkconfig --del %{name} +fi +exit 0 + +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + + +%files +%defattr(-,root,root) +%{_sbindir}/samba +%{_bindir}/smbstatus + +%attr(755,root,root) %{_initrddir}/%{name} +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%dir %{_datadir}/samba/setup +%{_datadir}/samba/setup/* +%dir /var/lib/%{name}/sysvol +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%attr(0700,root,root) %dir /var/log/%{name} +%attr(0700,root,root) %dir /var/log/%{name}/old + +%files libs +%defattr(-,root,root) +%doc WHATSNEW.txt source4/NEWS PFIF.txt +%dir %{_datadir}/samba +%{_datadir}/samba/*.dat +%{_libdir}/*.so.* +#Only needed if Samba's build produces plugins +#%{_libdir}/samba +%dir %{_sysconfdir}/%{name} +#Need to mark this as being owned by Samba, but it is normally created +#by the provision script, which runs best if there is no existing +#smb.conf +#%config(noreplace) %{_sysconfdir}/%{name}/smb.conf + +%files winbind +%defattr(-,root,root) +%{_bindir}/ntlm_auth +%{_bindir}/wbinfo +%{_libdir}/libnss_winbind.so +/%{_lib}/libnss_winbind.so.2 +%dir /var/run/winbindd +%attr(750,root,wbpriv) %dir /var/lib/%{name}/winbindd_privileged + +%files python +%defattr(-,root,root) +%{python_sitearch}/* + +%files devel +%defattr(-,root,root) +%{_libdir}/libdcerpc.so +%{_libdir}/libdcerpc_atsvc.so +%{_libdir}/libdcerpc_samr.so +%{_libdir}/libgensec.so +%{_libdir}/libldb.so +%{_libdir}/libndr.so +%{_libdir}/libregistry.so +%{_libdir}/libsamba-hostconfig.so +%{_libdir}/libtorture.so + +%{_libdir}/pkgconfig +%{_includedir}/* +%{_bindir}/ndrdump +%{_bindir}/nsstest + +%files pidl +%defattr(-,root,root,-) +%{perl_sitelib}/* +%{_mandir}/man1/pidl* +%{_mandir}/man3/Parse* +%attr(755,root,root) %{_bindir}/pidl + +%files client +%defattr(-,root,root) +%{_bindir}/nmblookup +%{_bindir}/smbclient +%{_bindir}/cifsdd + +%files common +%defattr(-,root,root) +%{_bindir}/mymachinepw +%{_bindir}/net +%{_bindir}/testparm +%{_bindir}/ldbadd +%{_bindir}/ldbdel +%{_bindir}/ldbedit +%{_bindir}/ldbmodify +%{_bindir}/ldbsearch +%{_bindir}/ldbrename +%{_bindir}/ad2oLschema +%{_bindir}/oLschema2ldif +%{_bindir}/regdiff +%{_bindir}/regpatch +%{_bindir}/regshell +%{_bindir}/regtree +%{_bindir}/subunitrun +%{_bindir}/smbtorture + +%dir /var/lib/%{name} +%attr(700,root,root) %dir /var/lib/%{name}/private +# We don't want to put a smb.conf in by default, provision should create it +#%config(noreplace) %{_sysconfdir}/%{name}/smb.conf + +%doc COPYING +%doc WHATSNEW.txt + +%changelog +* Fri Aug 29 2008 Andrew Bartlett - 0:4.0.0-0.5.alpha5.fc10 +- Fix licence tag (the binaries are built into a GPLv3 whole, so the BSD licence need not be mentioned) + +* Fri Jul 25 2008 Andrew Bartlett - 0:4.0.0-0.4.alpha5.fc10 +- Remove talloc and tdb dependency (per https://bugzilla.redhat.com/show_bug.cgi?id=453083) +- Fix deps on chkconfig and service to main pkg (not -common) + (per https://bugzilla.redhat.com/show_bug.cgi?id=453083) + +* Mon Jul 21 2008 Brad Hards - 0:4.0.0-0.3.alpha5.fc10 +- Use --sysconfdir instead of --with-configdir +- Add patch for C++ header compatibility + +* Mon Jun 30 2008 Andrew Bartlett - 0:4.0.0-0.2.alpha5.fc9 +- Update per review feedback +- Update for alpha5 + +* Thu Jun 26 2008 Andrew Bartlett - 0:4.0.0-0.1.alpha4.fc9 +- Rework Fedora's Samba 3.2.0-1.rc2.16 spec file for Samba4 diff --git a/packaging4/RPM/samba.sysconfig b/packaging4/RPM/samba.sysconfig new file mode 100644 index 00000000000..a081c478f37 --- /dev/null +++ b/packaging4/RPM/samba.sysconfig @@ -0,0 +1,2 @@ +# Options to smbd +SMBDOPTIONS="" diff --git a/source4/Makefile b/source4/Makefile index 335e77e0082..da277428080 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -356,7 +356,7 @@ tdb.srpm:: ../packaging4/RPM/tdb.spec define_version_info="$$GIT_INFO" \ "$<" -samba.srpm:: ../packaging4/Fedora/samba4.spec +samba.srpm:: ../packaging4/RPM/samba.spec # RELEASE specifies a commit or tag that we want to build an SRPM for. # The special value LOCAL means local uncomitted changes in contrast to HEAD # If RELEASE isn't specified, default to latest tagged release matching RELEASE_PATTERN -- 2.11.4.GIT