Changeset 452


Ignore:
Timestamp:
10/04/2009 23:46:14 (3 years ago)
Author:
blee
Message:

Implement bulk operations for confman rmmod and robustify error handling.

See #72

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.in

    r451 r452  
    744744 
    745745function rmmod { 
    746     local module=$1 
    747     if [ -z $module ] ; then 
    748         print_usage 1 
    749     fi 
    750     conf_lock_wcopy 
    751     conf_rmmod $module 
    752     conf_unlock_wcopy 
     746    if [ -z "$*" ] ; then 
     747        print_usage 1 
     748    else 
     749        conf_lock_wcopy 
     750        conf_remove_modules "$@" || exit 1 
     751        conf_unlock_wcopy 
     752    fi 
    753753} 
    754754 
  • trunk/confmanlib.sh.in

    r451 r452  
    713713} 
    714714 
     715function conf_remove_modules { 
     716    local module 
     717    local rc=0 
     718 
     719    for module in "$@"; do 
     720        conf_rmmod "$module" || rc=1 
     721    done 
     722 
     723    return $rc 
     724} 
     725 
    715726function conf_rmmod { 
    716         local module=$1 
    717         @SVN@ rm ${WORK_PATH}/${module} 
    718         @SVN@ rm ${WORK_PATH}/${REPO_CHECKPTS}/${module} 
     727        local module="$1" 
     728    local dir 
     729    local rc=0 
     730 
     731    for dir in ${WORK_PATH}/{,${REPO_CHECKPTS}/}${module}; do 
     732        if ! [ -d "$dir" ]; then 
     733            echo "No such directory: $dir" >&2 
     734            rc=1 
     735        else 
     736            @SVN@ rm $dir || rc=1 
     737        fi 
     738    done 
     739 
     740    return $rc 
    719741} 
    720742 
Note: See TracChangeset for help on using the changeset viewer.