Changeset 120 for trunk/confman/confman


Ignore:
Timestamp:
12/04/2006 01:32:20 (5 years ago)
Author:
ccowart
Message:

Modularized some parts of confman for reuse. Used these elements in the
new roll-and-pull features available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman/confman

    r117 r120  
    1212# $Id$ 
    1313 
    14  
    15  
    16 # Some global definitions. Defaults that can be overriden by options. 
    17 GCONF="/usr/local/rescomp/etc/confman.conf" 
    18 UCONF="${HOME}/.confmanrc" 
    19 MYNAME=`basename $0` 
    20  
    21 # First things first. Check to see if the logging fd is open. If it's not, 
    22 # we re-spawn confman inside a pipe. 
    23 if (true >&5) 2>/dev/null ; then 
    24         exec 4>&2 2>&5 >&3- 
    25 else 
    26         exec 3>&1 
    27         exec $0 $* 5>&1 1>&3 | logger -t "$MYNAME ($USER)" -s 
    28         exit ${PIPESTATUS[0]} 
    29 fi 
    30  
    31 # Get the global config 
    32 if [ -f $GCONF ] ; then  
    33         . $GCONF 
    34 else 
    35         echo "Global config file couldn't be located" >&2 
    36         exit 1 
    37 fi 
    38  
    39 # Get the user config 
    40 if [ -f $UCONF ] ; then 
    41         . $UCONF 
    42 fi 
    43  
    44 # Set debugging: 
    45 if [ -z $DEBUG ] ; then 
    46         DEBUG="false" 
    47 fi 
    48  
    49 # Now, we source the library 
    50 if [ -f $REPO_LIBRARY ] ; then 
    51         . $REPO_LIBRARY 
    52 else 
    53         echo "Couldn't source the confman shell library" >&2 
    54         exit 1 
    55 fi 
    56  
    57 # And the documentation library 
    58 if [ -f $REPO_DOCS ] ; then 
    59         . $REPO_DOCS 
    60 else 
    61         echo "Couldn't source the confman shell library" >&2 
    62         exit 1 
    63 fi 
    64  
    65 # And we read in the layers that make this host 
    66 if [ -f $RECIPE_PATH ] ; then 
    67         LAYERS=`cat $RECIPE_PATH | grep "^[^#]"` 
    68 else 
    69         echo "Couldn't read the host's recipe!" >&2 
    70         exit 1 
    71 fi 
     14#. /usr/local/rescomp/lib/confmancommon.sh 
     15. $HOME/src/sysadmin/confman/confmancommon.sh 
    7216 
    7317# Set a default editor 
     
    8327# Have to make this less restrictive due to NFS home dirs. 
    8428umask 022 
    85  
    86 # And we'll set a trap: 
    87 trap "conf_cleanexit" SIGINT SIGTERM SIGHUP 
    88  
    8929 
    9030# This function implements the setup subcommand. It is intended to be called 
     
    14888 
    14989                echo "Commit operation started" >&2 
    150                 for layer in $LAYERS ; do 
    151                         conf_commit $layer $msg || return $? 
    152                 done 
     90        conf_commit "$LAYERS" $msg || return $? 
    15391                for layer in $LAYERS ; do 
    15492                        echo "Rolling on $layer..." 
Note: See TracChangeset for help on using the changeset viewer.