Blob Blame History Raw
diff -ur bdii-5.2.12.orig/bin/bdii-update bdii-5.2.12/bin/bdii-update
--- bdii-5.2.12.orig/bin/bdii-update	2012-02-08 16:39:55.000000000 +0100
+++ bdii-5.2.12/bin/bdii-update	2012-07-27 16:03:57.335533593 +0200
@@ -74,6 +74,9 @@
     if ( not config.has_key('BDII_DAEMON') ):
         config['BDII_DAEMON'] = False
         
+    if ( not config.has_key('BDII_PID_FILE') ):
+        config['BDII_PID_FILE'] = '/var/run/bdii/bdii-update.pid'
+        
     for parameter in ['BDII_LOG_FILE', 'BDII_LOG_LEVEL', 'BDII_LDIF_DIR',
                       'BDII_PROVIDER_DIR', 'BDII_PLUGIN_DIR',
                       'BDII_READ_TIMEOUT']:
@@ -176,7 +179,7 @@
     sys.stderr = os.fdopen(2, 'a', 0)
 
     # Write PID
-    pid_file = open("%s/bdii-update.pid" % (config['BDII_VAR_DIR']),'w')
+    pid_file = open(config['BDII_PID_FILE'],'w')
     pid_file.write("%s\n" % (str(os.getpid())))
     pid_file.close()
 
diff -ur bdii-5.2.12.orig/etc/bdii.conf bdii-5.2.12/etc/bdii.conf
--- bdii-5.2.12.orig/etc/bdii.conf	2011-11-02 17:05:05.000000000 +0100
+++ bdii-5.2.12/etc/bdii.conf	2012-07-27 16:03:57.335533593 +0200
@@ -1,4 +1,5 @@
 BDII_LOG_FILE=/var/log/bdii/bdii-update.log
+BDII_PID_FILE=/var/run/bdii/bdii-update.pid
 BDII_LOG_LEVEL=ERROR
 BDII_LDIF_DIR=/var/lib/bdii/gip/ldif
 BDII_PROVIDER_DIR=/var/lib/bdii/gip/provider
diff -ur bdii-5.2.12.orig/etc/bdii-slapd.conf bdii-5.2.12/etc/bdii-slapd.conf
--- bdii-5.2.12.orig/etc/bdii-slapd.conf	2012-02-08 11:00:50.000000000 +0100
+++ bdii-5.2.12/etc/bdii-slapd.conf	2012-07-27 16:03:57.337533609 +0200
@@ -11,9 +11,9 @@
 
 allow bind_v2 
 
-pidfile         /var/run/bdii/slapd.pid
-argsfile        /var/run/bdii/slapd.args
-loglevel	0
+pidfile         /var/run/bdii/db/slapd.pid
+argsfile        /var/run/bdii/db/slapd.args
+loglevel        0
 idletimeout     120
 sizelimit       unlimited
 timelimit       2400
@@ -24,11 +24,11 @@
 
 database        hdb
 suffix          "o=grid"
-cachesize 	30000
+cachesize       30000
 checkpoint      1024 0
 dbnosync
 rootdn          "o=grid"
-rootpw          fc78ApbTj
+rootpw          secret
 directory       /var/lib/bdii/db/grid
 
 index GlueCEAccessControlBaseRule eq
@@ -57,11 +57,11 @@
 
 database        hdb
 suffix          "o=glue"
-cachesize 	3000
+cachesize       3000
 checkpoint      1024 0
 dbnosync
 rootdn          "o=glue"
-rootpw          fc78ApbTj
+rootpw          secret
 directory       /var/lib/bdii/db/glue
 
 index GLUE2GroupID eq
@@ -90,10 +90,10 @@
 #######################################################################
 database        hdb
 suffix          "o=infosys"
-cachesize 	10
+cachesize       10
 checkpoint      1024 0
 dbnosync
 rootdn          "o=infosys"
-rootpw          fc78ApbTj
+rootpw          secret
 directory       /var/lib/bdii/db/stats
 
diff -ur bdii-5.2.12.orig/etc/bdii-top-slapd.conf bdii-5.2.12/etc/bdii-top-slapd.conf
--- bdii-5.2.12.orig/etc/bdii-top-slapd.conf	2012-02-08 11:00:50.000000000 +0100
+++ bdii-5.2.12/etc/bdii-top-slapd.conf	2012-07-27 16:03:57.338533616 +0200
@@ -11,9 +11,9 @@
 
 allow bind_v2 
 
-pidfile         /var/run/bdii/slapd.pid
-argsfile        /var/run/bdii/slapd.args
-loglevel	0
+pidfile         /var/run/bdii/db/slapd.pid
+argsfile        /var/run/bdii/db/slapd.args
+loglevel        0
 idletimeout     120
 sizelimit       unlimited
 timelimit       2400
@@ -29,7 +29,7 @@
 cachesize       300000
 dbnosync
 suffix          "o=shadow"
-checkpoint	1024 0
+checkpoint      1024 0
 rootdn          "o=shadow"
 rootpw          secret
 directory       /var/lib/bdii/db/grid
@@ -71,7 +71,7 @@
 cachesize       20000
 dbnosync
 suffix          "o=glue"
-checkpoint	1024 0
+checkpoint      1024 0
 rootdn          "o=glue"
 rootpw          secret
 directory       /var/lib/bdii/db/glue
@@ -104,7 +104,7 @@
 cachesize       10
 dbnosync
 suffix          "o=infosys"
-checkpoint	1024 0
+checkpoint      1024 0
 rootdn          "o=infosys"
 rootpw          secret
 directory       /var/lib/bdii/db/stats
diff -ur bdii-5.2.12.orig/etc/init.d/bdii bdii-5.2.12/etc/init.d/bdii
--- bdii-5.2.12.orig/etc/init.d/bdii	2012-08-09 16:49:43.449329015 +0200
+++ bdii-5.2.12/etc/init.d/bdii	2012-08-09 16:49:25.364120651 +0200
@@ -4,7 +4,7 @@
 # $Id: bdii,v 1.9 2009/06/18 14:26:52 lfield Exp $
 # chkconfig: - 95 5
 # description: BDII Service
-# config: /opt/bdii/etc/bdii.conf
+# config: /etc/bdii/bdii.conf
 
 ### BEGIN INIT INFO
 # Provides:          bdii
@@ -36,7 +36,15 @@
 }
 
 prog=bdii
-lockfile=/var/lock/subsys/$prog
+
+# Debian does not have /var/lock/subsys
+if [ -d /var/lock/subsys ] ; then
+    LOCK_DIR=/var/lock/subsys
+else
+    LOCK_DIR=/var/lock
+fi
+
+lockfile=${LOCK_DIR}/$prog
 
 RUN=yes
 
@@ -59,9 +67,9 @@
     . "${BDII_CONF}"
 fi
 
-UPDATE_LOCK_FILE=${UPDATE_LOCK_FILE:-/var/lock/subsys/bdii-update}
-SLAPD_LOCK_FILE=${SLAPD_LOCK_FILE:-/var/lock/subsys/bdii-slapd}
-UPDATE_PID_FILE=${PID_FILE:-/var/run/bdii/bdii-update.pid}
+UPDATE_LOCK_FILE=${UPDATE_LOCK_FILE:-${LOCK_DIR}/bdii-update}
+SLAPD_LOCK_FILE=${SLAPD_LOCK_FILE:-${LOCK_DIR}/bdii-slapd}
+UPDATE_PID_FILE=${BDII_PID_FILE:-/var/run/bdii/bdii-update.pid}
 BDII_USER=${BDII_USER:-ldap}
 BDII_VAR_DIR=${BDII_VAR_DIR:-/var/lib/bdii}
 BDII_UPDATE=${BDII_UPDATE:-/usr/sbin/bdii-update}
@@ -72,7 +80,7 @@
 BDII_IPV6_SUPPORT=${BDII_IPV6_SUPPORT:-no}
 SLAPD_HOST6=${SLAPD_HOST6:-::}
 SLAPD_DB_DIR=${SLAPD_DB_DIR:-$BDII_VAR_DIR/db}
-SLAPD_PID_FILE=${SLAPD_PID_FILE:-/var/run/bdii/slapd.pid}
+SLAPD_PID_FILE=${SLAPD_PID_FILE:-/var/run/bdii/db/slapd.pid}
 DB_CONFIG=${DB_CONFIG:-/etc/bdii/DB_CONFIG}
 
 
@@ -88,21 +96,6 @@
     RUNUSER=su
 fi
 
-rundir=/var/run/${prog}
-
-if [ ! -d ${rundir} ]; then
-    mkdir -p ${rundir}
-fi
-
-chown ldap:ldap ${rundir}
-
-if [ ! -d ${SLAPD_DB_DIR} ]; then
-    mkdir -p ${SLAPD_DB_DIR}
-fi
-
-chown -R ${BDII_USER}:${BDII_USER} ${BDII_VAR_DIR} 
-chown -R ${BDII_USER}:${BDII_USER} ${SLAPD_DB_DIR}
-
 function start(){
 
     # Check status
@@ -120,6 +113,7 @@
 
     # Create RAM Disk
     if [ "${BDII_RAM_DISK}" = "yes" ]; then
+	mkdir -p ${SLAPD_DB_DIR}
 	mount -t tmpfs -o size=1500M,mode=0744 tmpfs ${SLAPD_DB_DIR}
     fi
 
@@ -128,18 +122,22 @@
     mkdir -p ${SLAPD_DB_DIR}/glue
     mkdir -p ${SLAPD_DB_DIR}/grid
     mkdir -p ${BDII_VAR_DIR}/archive
-    mkdir -p /var/lock/subsys
 
     chown -R ${BDII_USER}:${BDII_USER} ${BDII_VAR_DIR}
-    [ -x /sbin/restorecon ] && /sbin/restorecon -R ${BDII_VAR_DIR}
     chown -R ${BDII_USER}:${BDII_USER} ${SLAPD_DB_DIR}
+    [ -x /sbin/restorecon ] && /sbin/restorecon -R ${SLAPD_DB_DIR}
+
+    mkdir -p /var/run/bdii/db
+    chown -R ${BDII_USER}:${BDII_USER} /var/run/bdii
+    [ -x /sbin/restorecon ] && /sbin/restorecon -R /var/run/bdii/db
+
     $RUNUSER -s /bin/sh ${BDII_USER} -c "rm -f ${SLAPD_DB_DIR}/stats/* 2>/dev/null"
     $RUNUSER -s /bin/sh ${BDII_USER} -c "rm -f ${SLAPD_DB_DIR}/glue/* 2>/dev/null"
     $RUNUSER -s /bin/sh ${BDII_USER} -c "rm -f ${SLAPD_DB_DIR}/grid/* 2>/dev/null"
     $RUNUSER -s /bin/sh ${BDII_USER} -c "rm -f ${BDII_VAR_DIR}/old.ldif 2>/dev/null"
-    $RUNUSER -s /bin/sh ${BDII_USER} -c "ln -sf ${DB_CONFIG} ${SLAPD_DB_DIR}/grid/"
     $RUNUSER -s /bin/sh ${BDII_USER} -c "ln -sf ${DB_CONFIG} ${SLAPD_DB_DIR}/stats/"
     $RUNUSER -s /bin/sh ${BDII_USER} -c "ln -sf ${DB_CONFIG} ${SLAPD_DB_DIR}/glue/"
+    $RUNUSER -s /bin/sh ${BDII_USER} -c "ln -sf ${DB_CONFIG} ${SLAPD_DB_DIR}/grid/"
  
     if [ ${SLAPD_CONF} = "/etc/bdii/bdii-top-slapd.conf" ] ; then
 	$RUNUSER -s /bin/sh ${BDII_USER} -c "ln -sf ${DB_CONFIG}_top ${SLAPD_DB_DIR}/grid/DB_CONFIG"
@@ -177,13 +175,10 @@
     $RUNUSER -s /bin/sh ${BDII_USER} -c "${BDII_UPDATE} -c ${BDII_CONF} -d"
     touch ${UPDATE_LOCK_FILE}
 
-    if [ ! -f ${BDII_VAR_DIR}/bdii-update.pid ]; then
+    if [ ! -f ${UPDATE_PID_FILE} ]; then
         sleep 2
     fi
-    if [ -f ${BDII_VAR_DIR}/bdii-update.pid ]; then
-        touch ${UPDATE_PID_FILE}
-        chown ${BDII_USER} ${UPDATE_PID_FILE}
-        mv ${BDII_VAR_DIR}/bdii-update.pid ${UPDATE_PID_FILE}
+    if [ -f ${UPDATE_PID_FILE} ]; then
         ps $(cat ${UPDATE_PID_FILE}) >/dev/null 2>&1
         RETVAL=$?
     else