]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Next round of packaging updates:
authorjmcd@samba.org <>
Mon, 28 May 2007 15:38:04 +0000 (11:38 -0400)
committerjmcd@samba.org <>
Mon, 28 May 2007 15:38:04 +0000 (11:38 -0400)
- Create/delete source symlink as needed during rpm build
- init script updates:
- optional port, debuglevel, logfile
- autodetect logfile location if smbd exists
- build cluster_addresses file
- create tmp dbdir (Tridge, do you want this to be a fixed location instead?)

(This used to be ctdb commit 6695ec4845b71135db3fc5ed76afde7f20d8e24e)

ctdb/packaging/RHEL/makerpms.sh
ctdb/packaging/RHEL/setup/ctdb.init
ctdb/packaging/RHEL/setup/ctdb.sysconfig

index 8d847bbd51a4fcb4b90140685cf27fdea7b8a5b1..3becfa65ec712c6d0a138876787774d6c489dba9 100755 (executable)
@@ -48,16 +48,20 @@ fi
 popd
 
 pushd .
-cd ../../../
-chown -R ${USERID}.${GRPID} ctdb
+cd ../../
+BASEDIR=`basename $PWD`
+cd ..
+chown -R ${USERID}.${GRPID} $BASEDIR
 if [ ! -d ctdb-${VERSION} ]; then
-       ln -s ctdb ctdb-${VERSION} || exit 1
+       ln -s $BASEDIR ctdb-${VERSION} || exit 1
+       REMOVE_LN=$PWD/ctdb-$VERSION
 fi
 echo -n "Creating ctdb-${VERSION}.tar.bz2 ... "
 tar --exclude=.bzr --exclude .bzrignore --exclude packaging -cf - ctdb-${VERSION}/. | bzip2 > ${SRCDIR}/ctdb-${VERSION}.tar.bz2
 echo "Done."
 if [ $? -ne 0 ]; then
         echo "Build failed!"
+       [ ${REMOVE_LN} ] && rm $REMOVE_LN
         exit 1
 fi
 
@@ -78,4 +82,5 @@ cd ${SPECDIR}
 ${RPM} -ba --clean --rmsource $EXTRA_OPTIONS $SPECFILE
 
 echo "$(basename $0): Done."
+[ ${REMOVE_LN} ] && rm $REMOVE_LN
 
index 2ea65d1e117fb23fad579a2c4ba25550f493fb6d..2d6b9205c9cf42417f30f89c11a1ebb46b7f9d1f 100755 (executable)
@@ -1,13 +1,9 @@
 #!/bin/sh
 #
-# chkconfig: - 91 35
-# description: Starts and stops the Samba smbd and nmbd daemons \
-#             used to provide SMB network services.
+# chkconfig: - 90 36
+# description: Starts and stops the clustered tdb daemon
 #
-# pidfile: /var/run/samba/smbd.pid
-# pidfile: /var/run/samba/nmbd.pid
-# config:  /etc/samba/smb.conf
-
+# pidfile: /var/run/ctdbd/ctdbd.pid
 
 # Source function library.
 if [ -f /etc/init.d/functions ] ; then
@@ -24,18 +20,48 @@ unset TMPDIR
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# There is no "default" config so we must have this file with 
+# CLUSTER_NODES and PUBLIC_ADDRESSES
 if [ -f /etc/sysconfig/ctdb ]; then
    . /etc/sysconfig/ctdb 
+   if [ -z $CLUSTER_NODES ] || [ -z $PUBLIC_ADDRESSES ]; then
+       exit 0
+   fi
+else
+    exit 0
 fi
 
 # Check that networking is up.
 [ ${NETWORKING} = "no" ] && exit 0
 
-# Check that smb.conf exists.
-[ -f /etc/samba/smb.conf ] || exit 0
 
-RETVAL=0
+CLUSTER_BASEDIR=`dirname $CLUSTER_NODES`
+CLUSTER_ADDRESSES=$CLUSTER_BASEDIR/cluster_addresses.txt
+[ -z $CTDB_PORT ] && CTDB_PORT=9001
+[ -z $DEBUGLEVEL ] && DEBUGLEVEL=0
+if [ -z $LOGFILE ]; then
+    LOGFILEBASE=`smbd -b | grep LOGFILEBASE | awk '{print $2}'`
+    if [ -z $LOGFILEBASE ]; then
+       echo "must have LOGFILE specified or smbd installed"
+       return 0
+    fi
+    LOGFILE=$LOGFILEBASE/log.ctdb
+fi
+
+# build the cluster addresses file
+TMP_ADDRESSES=`mktemp -t cluster_addresses.XXXXXXXX`
+rm -f $TMP_ADDRESSES
+for a in `egrep '^[[:alnum:]]' $CLUSTER_NODES`; do
+    echo "$a:$CTDB_PORT" >> $TMP_ADDRESSES
+done
+mv -f $TMP_ADDRESSES $CLUSTER_ADDRESSES
+
+# create the temporary local dbdir
+DBDIR=`mktemp -td ctdb.XXXXXXXX`
+CTDBOPTIONS="--nlist=$CLUSTER_ADDRESSES --public-addresses=$PUBLIC_ADDRESSES --public-interface=$PUBLIC_INTERFACE --dbdir=$DBDIR --logfile=$LOGFILE -d $DEBUGLEVEL"
 
+echo ctdbd $CTDBOPTIONS
+exit 0
 
 start() {
        echo -n $"Starting ctdbd services: "
index e9e5774a404aab6a38712590ea5932b5d0e0caae..7dd49877cfa044c1c7c575008d4b50990cec4e4e 100644 (file)
@@ -1,2 +1,8 @@
 # Options to ctdbd
-CTDBDOPTIONS="--nlist=/etc/samba/cluster_addresses.txt --dbdir=/var/lock/samba/ctdb --logfile=/var/log/samba/log.ctdb --public-addresses=/etc/samba/public_addresses.txt --public-interface=eth0"
+CLUSTER_NODES=/etc/samba/cluster_nodes.txt
+PUBLIC_ADDRESSES=/etc/samba/public_addresses.txt
+PUBLIC_INTERFACE=eth0
+#CTDB_PORT=9001
+#LOGFILE=/var/log/samba/log.ctdb
+#DEBUGLEVEL=0
+