Changeset 174


Ignore:
Timestamp:
09/22/2007 00:27:52 (4 years ago)
Author:
arjun
Message:

Fixed the import bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman/confman

    r171 r174  
    1 #! /bin/bash  
     1#! /bin/bash   
    22# 
    33# confman provides a command-line interface to Rescomp's server configuration  
     
    443443 
    444444        # Find the "real" directory's path if not already specified 
    445         if [[ ! $dir =~ "^\/" ]] ; then 
     445        if [[ ! $dir =~ ^/ ]] ; then 
    446446            dir="${workdir}/${dir}" 
    447447        fi 
     
    874874} 
    875875 
    876 # Dubug mode? 
     876function audit { 
     877    tarball=$(conf_fetch) 
     878    if ! [ -s $tarball ]  
     879    then 
     880        echo "Could not fetch the tarball." >&2 
     881        exit 1 
     882    fi 
     883 
     884    tmpcopy=$(mktemp -d -t confman) 
     885    tmproot=$(mktemp -d -t confman) 
     886 
     887    tar -xzf $tarball -C $tmpcopy 
     888    rm -rf $tarball 
     889     
     890    for layer in $LAYERS 
     891    do 
     892        local module="${layer}" 
     893        local moduledir="$tmpcopy/$module" 
     894 
     895        for directory in `find $moduledir -type d -mindepth 1| grep -v "\.svn"`; do 
     896            local tmpdir=`echo $directory | sed "s:$moduledir::"` 
     897            tmpdir="$tmproot${tmpdir}" 
     898            local owner=`conf_get_prop ${directory} owner` 
     899            local group=`conf_get_prop ${directory} group` 
     900            local mode=`conf_get_prop ${directory} mode` 
     901            local opts="-d -o $owner -g $group -m $mode" 
     902            local cmd="sudo install $opts $tmpdir" 
     903            $cmd 
     904        done 
     905        for file in `find $moduledir -type f | grep -v "\.svn"` ; do 
     906            local tmpfile=`echo "$file" | sed "s:$moduledir::"` 
     907            local owner=`conf_get_prop ${file} owner` 
     908            local group=`conf_get_prop ${file} group` 
     909            local mode=`conf_get_prop ${file} mode` 
     910            local opts="-Sp -o $owner -g $group -m $mode" 
     911            local cmd="sudo install $opts $file $tmproot$tmpfile" 
     912            $cmd 
     913        done 
     914    done 
     915 
     916    for file in $SINGULARITIES 
     917    do 
     918        local livefile="$tmproot${file}" 
     919        local tmpfile=`mktemp -t confman` || exit 1 
     920        local owner group mode flag livepart msg 
     921        for layer in $LAYERS ; do 
     922            livepart="$tmproot${file}-${layer}" 
     923            myfile="$tmpcopy/${layer}/${file}-${layer}" 
     924            if [ -f $myfile -a -f $livepart ] ; then 
     925                    owner=`conf_get_prop ${myfile} owner` 
     926                    group=`conf_get_prop ${myfile} group` 
     927                    mode=`conf_get_prop ${myfile} mode` 
     928                    comment=`conf_get_prop      ${myfile} comment` 
     929                cat $livepart >> $tmpfile 
     930                sudo rm $livepart 
     931                flag=1 
     932            fi 
     933        done 
     934        if [ ! -z $flag ] ; then 
     935            local opts="-Sp -o $owner -g $group -m $mode" 
     936            local cmd="sudo install $opts $tmpfile $livefile" 
     937            $cmd 
     938        fi 
     939        rm -f $tmpfile 
     940    done 
     941    rm -rf $tmpcopy 
     942    sudo /usr/bin/diff -rPu / $tmproot | grep -v "^Only in" 
     943    sudo rm -rf $tmproot 
     944     
     945} 
     946 
     947function tester { 
     948local asd="asddsa" 
     949    local output=`echo $asd | grep -v "qw"` 
     950echo $output 
     951} 
     952 
     953# Debug mode? 
    877954while getopts "d" opt ; do 
    878955        case $opt in 
     
    922999    checkclear|chcl|chrm )          checkclear "$@" ;; 
    9231000    rollback|ro* )                  rollback "$@" ;; 
     1001    audit )                         audit "$@" ;; 
     1002    tester )                        tester "$@" ;; 
    9241003    * )                             print_usage 1 ;; 
    9251004esac  
Note: See TracChangeset for help on using the changeset viewer.