Changeset 1396

Show
Ignore:
Timestamp:
01/20/08 20:32:46 (4 years ago)
Author:
matthias
Message:

merged r1281 (Added detection of setr* at build time. The OSes without these functions will work anyway.)
merged r1282 (Add commented out lines for user/group detection on OSX.)

Files:

Legend:

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

    r1395 r1396  
    156156                    -e 's|@@GROUP@@|$(GROUP)|g'                         \ 
    157157                    -e 's|@@PLUGINUSER@@|$(PLUGINUSER)|g'               \ 
     158                    -e 's|@@GOODSH@@|$(GOODSH)|g'                       \ 
     159                    -e 's|@@BASH@@|$(BASH)|g'                           \ 
     160                    -e 's|@@HASSETR@@|$(HASSETR)|g'                     \ 
    158161                    $$file > build/$$destname;                          \ 
    159162        done 
  • branches/1.2-stable/Makefile.config

    r929 r1396  
    5252PYTHON     = /usr/bin/env python 
    5353 
     54# A modern (posix) shell.  We're not looking for arrays, but $() and 
     55# other modern stuff is expected.  On a posix-system the expression 
     56# below will find the right shell.  Most Unixes released the last 10 
     57# years are POSIX compliant enough for this to work (he said bravely). 
     58#  
     59# On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh 
     60# In general: bash or ksh will work 
     61# 
     62GOODSH     = $(shell PATH=`getconf PATH` sh -c 'type sh | sed "s/.* //"') 
     63 
     64# Path of bash for bash specific plugins 
     65BASH       = /bin/bash 
     66 
    5467# Server only - Where to install the perl libraries 
    55 PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d= -f2 | sed "s/[\';]//g"
     68PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2
    5669 
    5770# Client only - Install plugins for this architecture 
     
    8295CHECKGROUP = $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2")) 
    8396 
     97# For OSX, comment out the previous two lines and comment in these  
     98#CHECKUSER  = $(shell nicl . -read /users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))  
     99#CHECKGROUP = $(shell nicl . -read /groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))  
     100 
    84101CHOWN      = chown 
    85102CHMOD      = chmod 
    86103CHGRP      = chgrp 
     104# Check whether setruid functionality can be used 
     105HASSETR = $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' ) 
     106 
  • branches/1.2-stable/node/munin-node.in

    r1382 r1396  
    2929use Net::Server::Fork; # any personality will do 
    3030 
     31# Variable is set at build, with values detected by the makefiles 
     32my $HAS_SETR = @@HASSETR@@; 
     33 
    3134chdir ("/"); 
    3235 
     
    4245$0 =~ /^(.*)$/; # for some strange reason won't "$0 = $0;" work. 
    4346$0 = $1; 
     47 
    4448# Make configuration settings available at runtime. 
    4549$ENV{'MUNIN_PREFIX'}     = '@@PREFIX@@'; 
     
    260264        closedir (DIR); 
    261265    } 
    262      
     266 
    263267    opendir (DIR,$servicedir) || die "Cannot open plugindir: $servicedir $!"; 
    264268FILES: 
     
    430434                print "# Want to run as euid/egid $u/$g\n" if $DEBUG; 
    431435 
    432                 $( = $g    unless $g == 0; 
     436                if ($HAS_SETR) 
     437                { 
     438                        $( = $g    unless $g == 0; 
     439                        $< = $u    unless $u == 0; 
     440                } 
    433441                $) = $gs   unless $g == 0; 
    434                 $< = $u    unless $u == 0; 
    435442                $> = $u    unless $u == 0; 
    436443 
  • branches/1.2-stable/node/munin-run.in

    r1382 r1396  
    2424use vars qw(@ISA); 
    2525use Getopt::Long; 
     26 
     27# Variable is set at build, with values detected by the makefiles 
     28my $HAS_SETR = @@HASSETR@@; 
    2629 
    2730# "Clean" environment to disable taint-checking on the environment. We _know_ 
     
    354357                print "# Want to run as euid/egid $u/$g\n" if $DEBUG; 
    355358 
    356                 $( = $g    unless $g == 0; 
     359                if ($HAS_SETR) 
     360                { 
     361                        $( = $g    unless $g == 0; 
     362                        $< = $u    unless $u == 0; 
     363                } 
    357364                $) = $gs   unless $g == 0; 
    358                 $< = $u    unless $u == 0; 
    359365                $> = $u    unless $u == 0; 
    360366