Changeset 929

Show
Ignore:
Timestamp:
08/04/05 19:47:24 (7 years ago)
Author:
lupe
Message:

On second thought, the mktemp solution was a kludge.

Better solution: Add a configurable variable replacement for the tempfile
creation method and use that in plugins that require a tempfile. This
uses a shell script that tries a variety of tempfile creation methods.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2-stable/Makefile

    r915 r929  
    143143                    -e 's|@@OSTYPE@@|$(OSTYPE)|g'                               \ 
    144144                    -e 's|@@HOSTNAME@@|$(HOSTNAME)|g'                   \ 
     145                    -e 's|@@MKTEMP@@|$(MKTEMP)|g'                       \ 
    145146                    -e 's|@@VERSION@@|$(VERSION)|g'                     \ 
    146147                    -e 's|@@PLUGSTATE@@|$(PLUGSTATE)|g'                 \ 
  • branches/1.2-stable/Makefile.config

    r860 r929  
    6262HOSTNAME   = $(shell hostname) 
    6363 
     64# What is the safest way to create a tempfile. 
     65# Default is to figure it out by testing various methods. 
     66# Replace this with a known platform-specific method 
     67MKTEMP     = $(shell ./test-mktemp) 
     68 
    6469# Munin version number. 
    6570VERSION    = $(shell cat RELEASE) 
  • branches/1.2-stable/node/node.d/amavis.in

    r928 r929  
    1515# 
    1616 
     17@@MKTEMP@@ 
     18 
    1719AMAVIS_LOG=${logfile:-/var/log/mail/mail.info} 
    1820LOGTAIL=${logtail:-`which logtail`} 
    1921STATEFILE=@@PLUGSTATE@@/amavis.offset 
    20  
    21 case `uname -s` in 
    22 Linux) 
    23         TEMP_FILE=`mktemp -p /tmp/ munin-amavis.XXXXXX` 
    24         if [ $? != 0 ]; then 
    25                 TEMP_FILE=`mktemp /tmp/munin-amavis.XXXXXX` 
    26         fi 
    27         ;; 
    28 FreeBSD) 
    29         TEMP_FILE=`mktemp -t /tmp` 
    30         STATUS=$? 
    31         ;; 
    32 esac 
     22TEMP_FILE=`mktempfile munin-amavis.XXXXXX` 
    3323 
    3424if [ -z "$TEMP_FILE" ]; then 
  • branches/1.2-stable/node/node.d/courier_.in

    r928 r929  
    3939LOGTAIL=${logtail:-/usr/sbin/logtail} 
    4040 
    41 case `uname -s` in 
    42 Linux) 
    43         TEMP_FILE=`mktemp -p /tmp/ munin-courier.XXXXXX` 
    44         if [ $? != 0 ]; then 
    45                 TEMP_FILE=`mktemp /tmp/munin-courier.XXXXXX` 
    46         fi 
    47         ;; 
    48 FreeBSD) 
    49         TEMP_FILE=`mktemp -t /tmp` 
    50         STATUS=$? 
    51         ;; 
    52 esac 
     41mktempfile () { 
     42@@MKTEMP@@ 
     43
    5344 
    54 if [ -z "$TEMP_FILE" ]; then 
    55         # Yes, this is unsafe 
    56         TEMP_FILE=/tmp/munin-courier.$$ 
    57         rm -rf $TEMP_FILE 
    58         touch $TEMP_FILE 
    59 fi 
     45TEMP_FILE=`mktempfile munin-courier.XXXXXX` 
    6046 
    6147if [ ! -f "$TEMP_FILE" ]; then 
  • branches/1.2-stable/node/node.d/perdition.in

    r928 r929  
    2424# buffy perdition[5139]: Fatal error negotiating setup. Exiting child. 
    2525 
     26mktempfile () { 
     27@@MKTEMP@@ 
     28} 
    2629 
    2730# Set the location of the perdition logs 
     
    2932OFFSET_FILE=@@PLUGSTATE@@/perdition.offset 
    3033LOGTAIL=${logtail:-/usr/sbin/logtail} 
    31  
    32 case `uname -s` in 
    33 Linux) 
    34         TEMP_FILE=`mktemp -p /tmp/ munin-perdition.XXXXXX` 
    35         if [ $? != 0 ]; then 
    36                 TEMP_FILE=`mktemp /tmp/munin-perdition.XXXXXX` 
    37         fi 
    38         ;; 
    39 FreeBSD) 
    40         TEMP_FILE=`mktemp -t /tmp` 
    41         STATUS=$? 
    42         ;; 
    43 esac 
    44  
    45 if [ -z "$TEMP_FILE" ]; then 
    46         # Yes, this is unsafe 
    47         TEMP_FILE=/tmp/munin-perdition.$$ 
    48         rm -rf $TEMP_FILE 
    49         touch $TEMP_FILE 
    50 fi 
     34TEMP_FILE=`mktempfile munin-perdition.XXXXXX 
    5135 
    5236if [ ! -f "$TEMP_FILE" ]; then