Annotation of elwix/config/rc.subr, revision 1.2.4.2
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.2 ! misho 7: # $Id: rc.subr,v 1.2.4.1 2011/12/19 20:43:07 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
1.2.4.2 ! misho 63: # $2 = From dir
! 64: # $3 = To dir
1.2 misho 65: InstallFiles()
66: {
1.2.4.2 ! misho 67: if [ -d "$2" ]; then
! 68: cd $2
! 69: find . -type f -name "$1" |
! 70: tar -cvf - -T - | tar -C $3 -xf -
! 71: cd -
! 72: fi
1.2 misho 73: }
1.2.4.1 misho 74:
75: # $1 = Directory for clean
76: CleanCVS()
77: {
78: find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1
79: find $1 -type f -name .#\* -exec rm -f {} \; >/dev/null 2>&1
80: }
81:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>