summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-10-10 18:04:10 +0000
committerGerald Carter <jerry@samba.org>2003-10-10 18:04:10 +0000
commitf0f94187925c5551c68a438dc0424d946447a5e7 (patch)
treeead63d73fa0096480a05d36fc583d6b4e95d2438 /packaging
parent57e99bfb967ce068308d70cf08ec11598ea9750c (diff)
downloadsamba-f0f94187925c5551c68a438dc0424d946447a5e7.tar.gz
syncing up for 3.0.1pre1
Diffstat (limited to 'packaging')
-rw-r--r--packaging/RedHat/samba.spec.tmpl192
1 files changed, 102 insertions, 90 deletions
diff --git a/packaging/RedHat/samba.spec.tmpl b/packaging/RedHat/samba.spec.tmpl
index 063af05dd38..7afb30bb31e 100644
--- a/packaging/RedHat/samba.spec.tmpl
+++ b/packaging/RedHat/samba.spec.tmpl
@@ -68,10 +68,18 @@ autoheader
autoconf
EXTRA="-D_LARGEFILE64_SOURCE"
%endif
+
+## Get number of cpu's, default for 1 cpu on error
NUMCPU=`grep processor /proc/cpuinfo | wc -l`
+if [ $NUMCPU -eq 0 ]; then
+ NUMCPU=1;
+fi
+
+## run autogen if missing the configure script
if [ ! -f "configure" ]; then
./autogen.sh
fi
+
CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
--prefix=%{prefix} \
--localstatedir=/var \
@@ -88,9 +96,8 @@ CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
--with-swatdir=%{prefix}/share/swat \
--with-libsmbclient
make -j${NUMCPU} proto
-make -j${NUMCPU} all nsswitch/libnss_wins.so modules
+make -j${NUMCPU} all nsswitch/libnss_wins.so
make -j${NUMCPU} debug2html
-make -j${NUMCPU} bin/smbspool
# Remove some permission bits to avoid to many dependencies
find examples docs -type f | xargs -r chmod -x
@@ -154,11 +161,11 @@ cd ..
# Install the nsswitch wins library
install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
-( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2; )
+( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2 )
# Install winbind shared libraries
install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
-( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2; )
+( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2 )
install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
# Install pam_smbpass.so
@@ -189,6 +196,9 @@ find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
rm -rf $RPM_BUILD_ROOT
%post
+##
+## only needed if this is a new install (not an upgrade)
+##
if [ "$1" -eq "1" ]; then
/sbin/chkconfig --add smb
/sbin/chkconfig --add winbind
@@ -196,113 +206,119 @@ if [ "$1" -eq "1" ]; then
/sbin/chkconfig winbind off
fi
-echo "Looking for old /etc/smb.conf..."
-if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
- echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
- mv /etc/smb.conf /etc/samba/smb.conf
-fi
+##
+## we only have to wory about this if we are upgrading
+##
+if [ "$1" -eq "2" ]; then
+ if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
+ echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
+ mv /etc/smb.conf /etc/samba/smb.conf
+ fi
-echo "Looking for old /etc/smbusers..."
-if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
- echo "Moving old /etc/smbusers to /etc/samba/smbusers"
- mv /etc/smbusers /etc/samba/smbusers
-fi
+ if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
+ echo "Moving old /etc/smbusers to /etc/samba/smbusers"
+ mv /etc/smbusers /etc/samba/smbusers
+ fi
-echo "Looking for old /etc/lmhosts..."
-if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
- echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
- mv /etc/lmhosts /etc/samba/lmhosts
-fi
+ if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
+ echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
+ mv /etc/lmhosts /etc/samba/lmhosts
+ fi
-echo "Looking for old /etc/MACHINE.SID..."
-if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
- echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
- mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
-fi
+ if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
+ echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
+ mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
+ fi
-echo "Looking for old /etc/smbpasswd..."
-if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
- echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
- mv /etc/smbpasswd /etc/samba/smbpasswd
-fi
+ if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
+ echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
+ mv /etc/smbpasswd /etc/samba/smbpasswd
+ fi
-#
-# For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
-# to preserve across reboots.
-#
-echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
-for i in /var/lock/samba/*.tdb
-do
-if [ -f $i ]; then
- newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
- echo "Moving $i to $newname"
- mv $i $newname
-fi
-done
+ #
+ # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
+ # to preserve across reboots.
+ #
+ for i in /var/lock/samba/*.tdb; do
+ if [ -f $i ]; then
+ newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
+ echo "Moving $i to $newname"
+ mv $i $newname
+ fi
+ done
-# Remove the transient tdb files.
-if [ -e /var/cache/samba/brlock.tdb ]; then
- rm -f /var/cache/samba/brlock.tdb
-fi
+ # Remove the transient tdb files.
+ if [ -e /var/cache/samba/brlock.tdb ]; then
+ rm -f /var/cache/samba/brlock.tdb
+ fi
-if [ -e /var/cache/samba/unexpected.tdb ]; then
- rm -f /var/cache/samba/unexpected.tdb
-fi
+ if [ -e /var/cache/samba/unexpected.tdb ]; then
+ rm -f /var/cache/samba/unexpected.tdb
+ fi
-if [ -e /var/cache/samba/connections.tdb ]; then
- rm -f /var/cache/samba/connections.tdb
-fi
+ if [ -e /var/cache/samba/connections.tdb ]; then
+ rm -f /var/cache/samba/connections.tdb
+ fi
-if [ -e /var/cache/samba/locking.tdb ]; then
- rm -f /var/cache/samba/locking.tdb
-fi
+ if [ -e /var/cache/samba/locking.tdb ]; then
+ rm -f /var/cache/samba/locking.tdb
+ fi
-if [ -e /var/cache/samba/messages.tdb ]; then
- rm -f /var/cache/samba/messages.tdb
-fi
+ if [ -e /var/cache/samba/messages.tdb ]; then
+ rm -f /var/cache/samba/messages.tdb
+ fi
-if [ -d /var/lock/samba ]; then
- rm -rf /var/lock/samba
+ if [ -d /var/lock/samba ]; then
+ rm -rf /var/lock/samba
+ fi
fi
+##
+## New things
+##
+
# Add swat entry to /etc/services if not already there.
-if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
+if [ ! "`grep ^\s**swat /etc/services`" ]; then
echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
fi
# Add swat entry to /etc/inetd.conf if needed.
if [ -f /etc/inetd.conf ]; then
- if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
+ if [ ! "`grep ^\s*swat /etc/inetd.conf`" ]; then
echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
- killall -1 inetd || :
+ killall -HUP inetd || :
fi
fi
# Add swat entry to xinetd.d if needed.
-if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
+if [ -d /etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
else
rm -f /etc/samba/samba.xinetd
fi
# Install the correct version of the samba pam file, depending on pam version.
-if [ -f /lib/security/pam_stack.so ]; then
- echo "Installing stack version of /etc/pam.d/samba..."
- mv /etc/samba/samba.stack /etc/pam.d/samba
-else
- echo "Installing non-stack version of /etc/pam.d/samba..."
- rm -f /etc/samba/samba.stack
+# (always keep an existing PAM config file)
+if [ ! -f /etc/pam.d/samba ]; then
+ if [ -f /lib/security/pam_stack.so ]; then
+ echo "Installing stack version of /etc/pam.d/samba..."
+ mv /etc/samba/samba.stack /etc/pam.d/samba
+ else
+ echo "Installing non-stack version of /etc/pam.d/samba..."
+ rm -f /etc/samba/samba.stack
+ fi
fi
## call ldconfig to create the version symlink for libsmbclient.so
/sbin/ldconfig
%preun
-if [ $1 = 0 ] ; then
+if [ "$1" -eq "0" ] ; then
/sbin/chkconfig --del smb
/sbin/chkconfig --del winbind
- # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
+ # We want to remove the browse.dat and wins.dat files
+ # so they can not interfer with a new version of samba!
if [ -e /var/cache/samba/browse.dat ]; then
rm -f /var/cache/samba/browse.dat
fi
@@ -330,45 +346,42 @@ if [ $1 = 0 ] ; then
if [ -e /var/cache/samba/messages.tdb ]; then
rm -f /var/cache/samba/messages.tdb
fi
-
- # Remove winbind nss client symlink
-
- if [ -L /lib/libnss_winbind.so.2 ]; then
- rm -f /lib/libnss_winbind.so.2
- fi
fi
%postun
# Only delete remnants of samba if this is the final deletion.
-if [ $1 = 0 ] ; then
+if [ "$1" -eq "0" ] ; then
if [ -x /etc/pam.d/samba ]; then
rm -f /etc/pam.d/samba
fi
+
if [ -e /var/log/samba ]; then
rm -rf /var/log/samba
fi
- if [ -e /var/cache/samba ]; then
- rm -rf /var/cache/samba
- fi
+
+ if [ -e /var/cache/samba ]; then
+ rm -rf /var/cache/samba
+ fi
# Remove swat entries from /etc/inetd.conf and /etc/services
cd /etc
tmpfile=/etc/tmp.$$
- if [ -f /etc/inetd.conf ]; then
+ if [ -f /etc/inetd.conf ]; then
# preserve inetd.conf permissions.
cp -p /etc/inetd.conf $tmpfile
sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
mv $tmpfile inetd.conf
- fi
+ fi
+
# preserve services permissions.
cp -p /etc/services $tmpfile
sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
mv $tmpfile /etc/services
- # Remove swat entry from /etc/xinetd.d
- if [ -f /etc/xinetd.d/swat ]; then
- rm -r /etc/xinetd.d/swat
- fi
+ # Remove swat entry from /etc/xinetd.d
+ if [ -f /etc/xinetd.d/swat ]; then
+ rm -r /etc/xinetd.d/swat
+ fi
fi
/sbin/ldconfig
@@ -427,7 +440,6 @@ fi
%{prefix}/share/swat/lang/*/images/*
%{prefix}/share/swat/lang/*/include/*.html
%{prefix}/share/swat/using_samba/*
-%attr(755,root,root) %{prefix}/lib/samba/*.msg
%config(noreplace) /etc/samba/lmhosts
%config(noreplace) /etc/samba/smb.conf
%config(noreplace) /etc/samba/smbusers
@@ -445,6 +457,6 @@ MANDIR_MACRO/man8/*
%dir /var/log/samba
%dir /var/run/samba
%attr(1777,root,root) %dir /var/spool/samba
-%attr(-,root,root) /lib/libnss_winbind.so
+%attr(-,root,root) /lib/libnss_winbind.so*
%attr(-,root,root) /lib/security/pam_winbind.so
%attr(-,root,root) /lib/security/pam_smbpass.so