Changeset 122


Ignore:
Timestamp:
12/04/2006 16:38:25 (5 years ago)
Author:
ccowart
Message:

Created the attributes features for storing arbitrary metadata associated
with files. These attributes will be the framework for syntax verification
and {pre,post}-install scripts.

Location:
trunk/confman
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman/confman

    r120 r122  
    552552} 
    553553 
     554function lsattr { 
     555    if [ -z "$1" ] ; then 
     556        conf_lsattr * 
     557    else 
     558        conf_lsattr "$@" 
     559    fi 
     560} 
     561 
     562function chattr { 
     563    local attr="$1" 
     564    shift 
     565    local value="${1:-true}" 
     566    shift 
     567    if [ -z "$1" ] ; then print_usage 1 ; fi 
     568 
     569    conf_chattr "$attr" "$value" "$@" 
     570} 
     571 
     572function rmattr { 
     573    local attr="$1" 
     574    shift 
     575    if [ -z "$1" ] ; then print_usage 1 ; fi 
     576 
     577    conf_rmattr "$attr" "$@" 
     578} 
     579 
    554580# Dubug mode? 
    555581while getopts "d" opt ; do 
     
    570596shift 
    571597case $subcommand in 
    572         help )                                                  print_help $* ; exit 0 ;; 
    573         setup|se* )                                             setup $* ;; 
    574         status|st* )                                    status $* ;; 
    575         create|cr* )                                    create $* ;; 
    576         update|u* )                                             update $* ;; 
    577         commit|com* )                                   commit $* ;; 
    578         import|im* )                                    import $* ;; 
    579         install|in* )                                   inst $* ;; 
    580         remove|rem*|rm )                                remove $* ;; 
    581         rev* )                                                  revert $* ;; 
    582         ren* )                                                  rename $* ;; 
    583         rmmod )                                                 rmmod $* ;; 
    584         mkdir|mkd* )                                    newdir $* ;; 
    585         list|ls )                                               list $* ;; 
    586         move|mv )                                               move $* ;; 
    587         copy|cp )                                               copy $* ;; 
    588         diff )                                                  diff $* ;; 
    589         log )                                                   log $* ;; 
    590         chmod )                                                 chmode $* ;; 
    591         chown )                                                 chowner $* ;; 
    592         chcom )                                                 chcom $* ;; 
    593         chgrp )                                                 chgroup $* ;; 
    594         checklook|checklist|chls|chlk ) checklook $* ;; 
    595         checknew|chnw )                                 checknew $* ;; 
    596         checkclear|chcl|chrm )                  checkclear $* ;; 
    597         rollback|ro* )                                  rollback $* ;; 
    598         * )                                                             print_usage 1 ;; 
     598    help )                          print_help "$@" ; exit 0 ;; 
     599    setup|se* )                     setup "$@" ;; 
     600    status|st* )                    status "$@" ;; 
     601    create|cr* )                    create "$@" ;; 
     602    update|u* )                     update "$@" ;; 
     603    commit|com* )                   commit "$@" ;; 
     604    import|im* )                    import "$@" ;; 
     605    install|in* )                   inst "$@" ;; 
     606    remove|rem*|rm )                remove "$@" ;; 
     607    rev* )                          revert "$@" ;; 
     608    ren* )                          rename "$@" ;; 
     609    rmmod )                         rmmod "$@" ;; 
     610    mkdir|mkd* )                    newdir "$@" ;; 
     611    list|ls )                       list "$@" ;; 
     612    lsattr )                        lsattr "$@" ;; 
     613    chattr )                        chattr "$@" ;; 
     614    rmattr )                        rmattr "$@" ;; 
     615    move|mv )                       move "$@" ;; 
     616    copy|cp )                       copy "$@" ;; 
     617    diff )                          diff "$@" ;; 
     618    log )                           log "$@" ;; 
     619    chmod )                         chmode "$@" ;; 
     620    chown )                         chowner "$@" ;; 
     621    chcom )                         chcom "$@" ;; 
     622    chgrp )                         chgroup "$@" ;; 
     623    checklook|checklist|chls|chlk ) checklook "$@" ;; 
     624    checknew|chnw )                 checknew "$@" ;; 
     625    checkclear|chcl|chrm )          checkclear "$@" ;; 
     626    rollback|ro* )                  rollback "$@" ;; 
     627    * )                             print_usage 1 ;; 
    599628esac  
    600629 
    601 # We shouldn't be here. 
    602 exit 1 
     630exit 
    603631 
    604632# vim:ts=4 
  • trunk/confman/confmancommon.sh

    r121 r122  
    2323else 
    2424        exec 3>&1 
    25         exec $0 $* 5>&1 1>&3 | logger -t "$MYNAME[$$]: $USER" -s 
     25        exec $0 "$@" 5>&1 1>&3 | logger -t "$MYNAME[$$]: $USER" -s 
    2626        exit ${PIPESTATUS[0]} 
    2727fi 
  • trunk/confman/confmandoc.sh

    r121 r122  
    2929  $MYNAME install workingfile [ workingfile ... ] 
    3030  $MYNAME ls [ workingfile | workingdirectory ] 
     31  $MYNAME lsattr [ workingfile | workingdirectory ] 
     32  $MYNAME chattr attribute value [ workingfile | workingdirectory ] 
     33  $MYNAME rmattr attribute [ workingfile | workingdirectory ] 
    3134  $MYNAME rm workingfile 
    3235  $MYNAME cp src_working_copy dest_working_copy 
     
    278281EOF 
    279282;; 
     283          lsattr ) 
     284cat<<EOF 
     285$MYNAME provides a command-line interface to Rescomp's server configuration 
     286management system. 
     287 
     288Usage: 
     289  $MYNAME lsattr [ file | directory ] 
     290 
     291The lsattr subcommand lists out the confman attributes of files in the 
     292repository. These attributes can be used to store information such as 
     293file permissions, ownership, comment characters, syntax checkers, and 
     294even commands to execute when changing the file. 
     295 
     296EOF 
     297;; 
     298          chattr ) 
     299cat<<EOF 
     300$MYNAME provides a command-line interface to Rescomp's server configuration 
     301management system. 
     302 
     303Usage: 
     304  $MYNAME chattr attribute value [ file | directory ] 
     305 
     306The chattr subcommand alters the confman attributes of files in the 
     307repository. These attributes can be used to store information such as 
     308file permissions, ownership, comment characters, syntax checkers, and 
     309even commands to execute when changing the file. 
     310 
     311EOF 
     312;; 
     313          rmattr ) 
     314cat<<EOF 
     315$MYNAME provides a command-line interface to Rescomp's server configuration 
     316management system. 
     317 
     318Usage: 
     319  $MYNAME rmattr attribute [ file | directory ] 
     320 
     321The rmattr subcommand removes the confman attributes of files in the 
     322repository. These attributes can be used to store information such as 
     323file permissions, ownership, comment characters, syntax checkers, and 
     324even commands to execute when changing the file. 
     325 
     326EOF 
     327;; 
    280328          cho* ) 
    281329cat <<EOF 
  • trunk/confman/confmanlib.sh

    r121 r122  
    441441# Accepts log messages on stdin until EOF 
    442442function conf_logger { 
    443    cat | logger -t "$MYNAME[$$]: $USER" -s 
     443   logger -t "$MYNAME[$$]: $USER" -s 2>&4 
     444} 
     445 
     446function conf_chattr { 
     447    local attr="confman:$1" 
     448    shift 
     449    local value="$1" 
     450    shift 
     451    svn propset "$attr" "$value" "$@" 
     452} 
     453 
     454function conf_lsattr { 
     455    local file="$1" 
     456    shift 
     457    echo "$file" 
     458    for prop in $(svn proplist $file | grep 'confman:' | sort) ; do 
     459        echo -e "\t${prop#confman:}\t" $(svn propget $prop $file) 
     460    done 
     461    if [ -n "$1" ] ; then 
     462        conf_lsattr "$@" 
     463    fi 
     464} 
     465 
     466function conf_rmattr { 
     467    local attr="confman:$1" 
     468    shift 
     469    svn propdel "$attr" "$@" 
    444470} 
    445471 
     
    449475# process, which is receiving its input from our fd 2. 
    450476function conf_cleanexit { 
    451     echo "Confman received a signal. Exiting cleanly." | conf_logger 
     477    echo "Received a signal. Exiting cleanly." | conf_logger 
    452478        echo "Abort, Abort! Patience is a virtue." >&4 
    453479        echo "Please wait until I finish cleaning up after you." >&4 
Note: See TracChangeset for help on using the changeset viewer.