File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / rc.subr
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Tue Oct 18 09:02:06 2011 UTC (12 years, 8 months ago) by misho
Branches: MAIN
CVS tags: elwix1_6, elwix1_5, HEAD, ELWIX1_5
ver 1.5

    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: #
    7: # $Id: rc.subr,v 1.2 2011/10/18 09:02:06 misho Exp $
    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
   49: InstallDir()
   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: }
   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: }

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