]> arthur.barton.de Git - netatalk.git/blobdiff - bin/cnid/cnid_maint.in
Add a missing '/'.
[netatalk.git] / bin / cnid / cnid_maint.in
index fed6f23f5216ac6191e9e6bc5d84f94c3902cda0..584664251ba6ca4265033c6da5e3df9fa6a7a6c6 100755 (executable)
@@ -1,5 +1,11 @@
 #!@PERL@
 
+#
+# cnid_maint: A script to maintain the consistency of CNID databases.
+#
+# $Id: cnid_maint.in,v 1.5 2002-02-09 20:29:40 jmarcus Exp $
+#
+
 use strict;
 use Getopt::Std;
 use vars qw(
@@ -26,16 +32,16 @@ $START_CMD = '/usr/local/etc/rc.d/netatalk.sh start';
 # Below is the example of a BSD ps.  A SYSV example is:
 # /bin/ps -eflouid,pid,ppid,comm
 $PS_CMD             = '@PS@ -axouser,pid,ppid,command';
-$GREP               = '@GREP@';
-$DB_STAT            = '@DB3_PATH@db3_stat';
-$DB_RECOVER         = '@DB3_PATH@bin/db3_recover';
-$DB_VERIFY          = '@DB3_PATH@db3_verify';
+$DB_STAT            = '@DB3_PATH@bin/db_stat';
+$DB_RECOVER         = '@DB3_PATH@bin/db_recover';
+$DB_VERIFY          = '@DB3_PATH@bin/db_verify';
 $APPLE_VOLUMES_FILE = '@PKGCONFDIR@/AppleVolumes.default';
 ## End edit section
 
 $VERSION = '1.0';
+$GREP           = '@GREP@';
 $START_NETATALK = 0;
-$LOCK_FILE      = '/tmp/cnid_maint.LOCK';
+$LOCK_FILE      = tmpdir() . '/cnid_maint.LOCK';
 $HOLDING_LOCK   = 0;
 
 sub LOCK_SH { 1 }
@@ -78,7 +84,7 @@ if ( -f $LOCK_FILE ) {
 
 unless ( open( LOCK, ">" . $LOCK_FILE ) ) {
     error( 2, "Unable to create $LOCK_FILE: $!" );
-}  
+}
 flock( LOCK, LOCK_EX );
 $HOLDING_LOCK = 1;
 
@@ -251,6 +257,18 @@ foreach $path (@paths) {
 
 end();
 
+sub tmpdir {
+    my $tmpdir;
+
+    foreach ( $ENV{TMPDIR}, "/tmp" ) {
+        next unless defined && -d && -w _;
+        $tmpdir = $_;
+        last;
+    }
+    $tmpdir = '' unless defined $tmpdir;
+    return $tmpdir;
+}
+
 sub error {
     my ( $code, $msg ) = @_;