Annotation of elwix/config/rc.subr, revision 1.2.4.1

1.1       misho       1: #
                      2: # ELWIX project build helper subroutines
                      3: #
                      4: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
                      5: #    by Michael Pounov <misho@elwix.org>
                      6: #
1.2.4.1 ! misho       7: # $Id: rc.subr,v 1.2 2011/10/18 09:02:06 misho Exp $
1.1       misho       8: #
                      9: 
                     10: ### Dont edit this file !!!
                     11: 
                     12: CheckVer()
                     13: {
                     14:        [ -z "$1" -o ! -r "$1" ] && return 1
                     15: 
                     16:        cat $1 | awk '($1 == "ELWIX") { split($3, arr, ":"); printf("%s", arr[2]); }'
                     17:        return 0
                     18: }
                     19: 
                     20: SnitVer()
                     21: {
                     22:        install -d ${TOPDIR}
                     23: 
                     24:        V=$(CheckVer $1)
                     25: 
                     26:        if [ $? -ne 0 ]; then
                     27: # file not found
                     28:                return 1
                     29:        elif [ X"$V" != X"${VERSION}" ]; then
                     30: # different ELWIX version
                     31:                return 2
                     32:        fi
                     33: 
                     34: # already present file with same version
                     35:        return 0
                     36: }
                     37: 
                     38: # $1 = ELWIX install list config
                     39: # $2 = From World dir
                     40: # $3 = To Dest dir
                     41: InstallList()
                     42: {
                     43:        sed -nE -e 's/^ *([^ #]+) */\1/p' < $1 | tr ':' '\n' | 
                     44:                tar -C $2 -cvf - -T - | tar -C $3 -x -f -
                     45: }
                     46: 
                     47: # $1 = From dir
                     48: # $2 = To dir
1.2       misho      49: InstallDir()
1.1       misho      50: {
                     51:        cd $1
                     52:        pax -rw -pe -X . $2
                     53:        cd -
                     54: }
                     55: 
                     56: # $* = Program arguments for install tool
                     57: InstallProg()
                     58: {
                     59:        install -c $*
                     60: }
1.2       misho      61: 
                     62: # $1 = file_pattern
                     63: # $2 = To dir
                     64: # $3 = From dir
                     65: InstallFiles()
                     66: {
                     67:        cd $2
                     68:        find . -type f -name "$1" | 
                     69:                tar -cvf - -T - | tar -C $3 -xf -
                     70:        cd -
                     71: }
1.2.4.1 ! misho      72: 
        !            73: # $1 = Directory for clean
        !            74: CleanCVS()
        !            75: {
        !            76:        find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1
        !            77:        find $1 -type f -name .#\* -exec rm -f {} \; >/dev/null 2>&1
        !            78: }
        !            79: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>