Annotation of elwix/config/rc.subr, revision 1.3.2.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.3.2.1 ! misho 7: # $Id: rc.subr,v 1.3 2012/10/12 08:22:43 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: {
1.3.2.1 ! misho 43: local TMPFILE=$(mktemp -q /tmp/instlist.XXXXXX)
! 44: if [ $? -ne 0 ]; then
! 45: echo "Error:: Can't create temp file, exiting..."
! 46: exit 1
! 47: fi
! 48:
! 49: sed -nE -e 's/^ *([^ #]+) */\1/p' < $1 | tr ':' '\n' >$TMPFILE
! 50: cd $2
! 51: for i in $(cat $TMPFILE); do
! 52: if [ -x $i ]; then
! 53: echo "Strip '$i'"
! 54: strip -s $i
! 55: fi
! 56: done
! 57: cd -
! 58: tar -C $2 -cvf - -T $TMPFILE | tar -C $3 -x -f -
! 59: rm -f $TMPFILE
1.1 misho 60: }
61:
62: # $1 = From dir
63: # $2 = To dir
1.2 misho 64: InstallDir()
1.1 misho 65: {
66: cd $1
67: pax -rw -pe -X . $2
68: cd -
69: }
70:
71: # $* = Program arguments for install tool
72: InstallProg()
73: {
74: install -c $*
75: }
1.2 misho 76:
77: # $1 = file_pattern
1.3 misho 78: # $2 = From dir
79: # $3 = To dir
1.2 misho 80: InstallFiles()
81: {
1.3 misho 82: if [ -d "$2" ]; then
83: cd $2
84: find . -type f -name "$1" |
85: tar -cvf - -T - | tar -C $3 -xf -
86: cd -
87: fi
88: }
89:
90: # $1 = Directory for clean
91: CleanCVS()
92: {
93: find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1
94: find $1 -type f -name .#\* -exec rm -f {} \; >/dev/null 2>&1
1.2 misho 95: }
1.3 misho 96:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>