help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pouvez-vous m'aider s'il vous plait (can you help me please)


From: Thibaut TERRERAN
Subject: pouvez-vous m'aider s'il vous plait (can you help me please)
Date: Wed, 16 Jan 2002 09:10:28 +0100
User-agent: IMHO/0.97.1 (Webmail for Roxen)

Monsieur,                                                                       
                                                                                
Vous serais t'il possible de me faire parvenir un exemple du fichier de         
configuration cfengine.conf possédant le commentaire de chaque action ou chaque 
commande intervenant dans ce fichier.                                           
                                                                                
En effet, je dois utiliser votre outil pour gérer un parc linux ( gestion des   
mise à jour logiciel, ...).                                                     
                                                                                
J'aimerais également savoir comment s'effectue la "communication" entre le      
client cfengine et le serveur. Quels composants de cfengine dois t'on installer 
pour la version client du produit.                                              
                                                                                
Je vous remercie pour votre aide.                                               
                                                                                
Je vous prie d'aggréer, monsieur, l'expression de mes salutations distinguées.  
                                                                                


From address@hidden Wed Jan 16 05:21:07 2002
Received: from smtp2.oslo.dnmi.no ([157.249.32.203])
        by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian))
        id 16QnBq-0002vD-00
        for <address@hidden>; Wed, 16 Jan 2002 05:21:07 -0500
Received: from amavis by smtp2.oslo.dnmi.no with scanned-ok (Exim 3.33 #1)
        id 16QnBp-0002QF-00 (Debian); Wed, 16 Jan 2002 10:21:05 +0000
Received: from freeze.oslo.dnmi.no [157.249.16.34] (mail)
        by smtp2.oslo.dnmi.no with esmtp (Exim 3.33 #1)
        id 16QnBo-0002Pw-00 (Debian); Wed, 16 Jan 2002 10:21:04 +0000
Received: from tandem by freeze.oslo.dnmi.no with local (Exim 3.33 #1)
        id 16QnBn-0003NN-00; Wed, 16 Jan 2002 11:21:03 +0100
To: Rune Mossige <address@hidden>
Cc: address@hidden
Subject: Re: Need assistance in determining if an rpm is installed
References: <address@hidden>
        <address@hidden>
        <address@hidden>
From: Adrian Phillips <address@hidden>
In-Reply-To: <address@hidden>
Date: 16 Jan 2002 11:21:03 +0100
Message-ID: <address@hidden>
Lines: 165
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Virus-Scanned: by AMaViS snapshot-20010714
Sender: address@hidden
Errors-To: address@hidden
X-BeenThere: address@hidden
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help: <mailto:address@hidden>
List-Post: <mailto:address@hidden>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-cfengine>,
        <mailto:address@hidden>
List-Id: Users list for GNU cfengine  <help-cfengine.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-cfengine>,
        <mailto:address@hidden>
List-Archive: <http://mail.gnu.org/pipermail/help-cfengine/>

>>>>> "Rune" == Rune Mossige <address@hidden> writes:
    Rune> That sounds like a useful module to have. As I have never
    Rune> written such modules, this might be just the right
    Rune> opportunity to learn something new...Until I get time to
    Rune> start that task, I will continue to just install it via
    Rune> shellcommands.

To give you an idea about module writing here is my hack. Any classes
you define have to be given in using AddInstallable in the control
section. 

Sincerely,

Adrian

#!/bin/bash
#
# Generate many of the vars and some classes used by cfengine
#
# This is done in a plugin because I believe it is easier to have one
# script the defines variables that are dependent upon the hardware
# and OS than have cfengine so an exec for every such variable, and
# also that it is better to define vars based upon the hardware and OS
# than hard-coding in the cfengine configuration based upon the machine
# name (class)
#
# module:defvars
#
#set -x

# Arguments to this script
cfengine_cache=$1


# Function to do the printing for vars
# first param is var name, second is value or use
# the value of the first if no second is given
function print_var () {
    [ -n "${2:-${!1}}" ] && echo =$1=${2:-${!1}}
}

# Function to do the printing for classes
# first param is class name
function print_class () {
    [ -n "${2:-${!1}}" ] && echo +$1
}

#********************************************************
#  HARDWARE/SYSTEM VARS

# Boot partition
boot_partition=`df / | awk '/dev/ { print $1 }'`
size=`fdisk -s ${boot_partition}`
boot_partition_size=`expr $size / 1024`

# Boot device type
drive_type=
[ -n "`echo $boot_partition | grep /dev/hd`" ] && drive_type=ide
[ -n "`echo $boot_partition | grep /dev/sd`" ] && drive_type=scsi
[ -n "`echo $boot_partition | grep /dev/rd`" ] && drive_type=dac960

# Boot device - the default is to just strip the trailing number
boot_device=
[ "${drive_type}" != "dac960" ] && boot_device=`echo ${boot_partition} | sed 
's/[[:digit:]]*$//g'`
[ "${drive_type}" == "dac960" ] && boot_device=`echo ${boot_partition} | sed 
's/p[[:digit:]]*$//g'`
size=`fdisk -s ${boot_device}`
boot_device_size=`expr $size / 1024`


# Backup disk (hard code first parition as boot partition)
[ "${boot_device}" = "/dev/hde" ] && backup_device=/dev/hdg
[ "${boot_device}" = "/dev/hde" ] && backup_boot_partition=/dev/hdg1


# LVM partition - assumed to the one marked with the LVM type
# in the partition tables, assumed to be only one on the boot device
# NOTE: other places on cfengine (backup disk for example) assume
# 2 partitons, a small boot and the rest for LVM so this is perhaps
# a bit pointless
lvm_partition=`fdisk -l ${boot_device} | awk '$1 ~ /^\/dev/ && $5 == "8e" { 
print $1}' | head -1`

# Whether this machine is multiple or single CPU
# Doesn't work !! A non SMP kernel doesn't report
# more than one CPU, sigh.
#smp_up=up
#[ `cat /proc/cpuinfo | grep processor | wc -l` -gt 1 ] && smp_up=smp

# How much swap space - grab physical and times by 2 unless there is
# 512MB or more in which case just by 1; round to nearest power of 2
physical_mem=`free | awk '/Mem:/ { print $2 }'`
multiplier=2
[ `expr ${physical_mem} / 1024` -gt 256 ] && multiplier=1
at_least=`expr ${physical_mem} / 1024 \* $multiplier`
swap_space=128M
[ ${at_least} -gt 128 ] && swap_space=256M
[ ${at_least} -gt 256 ] && swap_space=512M
[ ${at_least} -gt 512 ] && swap_space=1024M


# Figure out the ethernet cards and setup variables to be returned
# NOTE: only handles Kingston  (actually any 21142/43 card) currently
# This works by echoing a <var>=<value>; string back for each card
# found then evalling it afterwards
card=0
cards_found=0
result=$(lspci | awk '$2 ~ /Ethernet/ { print }' |
    while read line; do
        if echo $line | grep -q 'DECchip 21142\/43'; then
            echo ethernet_card${card}=tulip\;
            echo 'cards_found=`expr $cards_found + 1`'
            card=`expr $card + 1`
        fi
    done)
eval $result

#********************************************************
#  SOFTWARE VARS

# Which kernel package to use, currently only handles one
# linux version in the directory, eg. k-i-2.2.20
#kernel_package=`find ${cfengine_cache}/debian/archive/kernel/${smp_up} -name 
"kernel-image*${smp_up}*" -maxdepth 1 | sort | tail -1`
#kernel_image_version=`echo ${kernel_package} | sed 
's/.*\(kernel-image.*\)_.*_.*/\1/'`

# Where the kernel and module debian packages are on the server
#kernel_dir=${cfengine_cache}/linux/kernel/${smp_up}


# And print the vars out to cfengine
print_var boot_partition
print_var boot_partition_size
print_var drive_type
print_var boot_device
print_var boot_device_size
print_var backup_device
print_class backup_device
print_var backup_boot_partition
print_var lvm_partition
#print_var smp_up
print_var swaplv_size ${swap_space}
#print_var kernel_package
#print_var kernel_image_version
#print_var kernel_dir

# Set up a class depending upon the drive type so that
# certain hardware tuning can be done (e.g. hdparm)
echo +${drive_type}

# Following currently not used as I cannot figure out
# how to use this info in cfengine (editfiles on an
# unknown number of values - perhaps editfiles should
# have the same iterating over lists function ?)
card=0
while [ $card -lt ${cards_found} ]; do
    print_var ethernet_card${card}
    print_class ethernet_card${card}
    card=$(expr $card + 1)
done

exit 0


-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]