Annotation of elwix/config/rc.subr, revision 1.6.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.6.2.1 ! misho 7: # $Id: rc.subr,v 1.6 2013/05/07 20:46:48 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:
1.6.2.1 ! misho 38: # $1 = fs/elwix
! 39: # $2 = config/etc/default
! 40: MakeFS_var()
! 41: {
! 42: cd $1
! 43:
! 44: install -d altroot;
! 45: install -d altroot/var;
! 46: install -d altroot/var/account;
! 47: install -d altroot/var/at;
! 48: install -d altroot/var/at/jobs;
! 49: install -d altroot/var/at/spool;
! 50: install -d -g 63 -m 0770 altroot/var/authpf;
! 51: install -d -m 0750 altroot/var/cron;
! 52: install -d -m 0700 altroot/var/cron/tabs;
! 53: install -d altroot/var/db;
! 54: install -d -m 0555 altroot/var/empty;
! 55: install -d altroot/var/log;
! 56: install -d -o 101 -g 101 altroot/var/log/quagga;
! 57: install -d -o 883 -g 883 altroot/var/mqtt;
! 58: install -d altroot/var/named;
! 59: install -d altroot/var/run;
! 60: install -d altroot/var/sys;
! 61: install -d -o 53 -g 53 altroot/var/run/named;
! 62: install -d -o 101 -g 101 altroot/var/run/quagga;
! 63: install -d altroot/var/spool;
! 64: install -d -o 66 -g 68 -m 0775 altroot/var/spool/lock;
! 65: install -d -g 1 altroot/var/spool/lpd;
! 66: install -d -g 1 altroot/var/spool/output;
! 67: install -d -g 1 altroot/var/spool/output/lpd;
! 68:
! 69: ln -fs /tmp altroot/var/tmp;
! 70:
! 71: touch altroot/var/run/utmp
! 72:
! 73: touch altroot/var/account/acct
! 74:
! 75: touch altroot/var/log/elwix
! 76: touch altroot/var/log/lastlog
! 77: touch altroot/var/log/wifi.log
! 78: touch altroot/var/log/utx.log
! 79:
! 80: touch altroot/var/log/auth.log
! 81: touch altroot/var/log/cron
! 82: touch altroot/var/log/console.log
! 83: touch altroot/var/log/debug.log
! 84: touch altroot/var/log/init.log
! 85: touch altroot/var/log/lpd-errs
! 86: touch altroot/var/log/maillog
! 87: touch altroot/var/log/messages
! 88: touch altroot/var/log/security
! 89: touch altroot/var/log/xferlog
! 90: touch altroot/var/log/ppp.log
! 91: chgrp 69 altroot/var/log/ppp.log
! 92:
! 93: InstallDir ${WORLD}/var/named $1/altroot/var/named
! 94: InstallList ${ELWIX_BSDSRC} ${BSDSRC} $1/altroot/var/named
! 95: install -v $2/resolv.safe altroot/var/run/resolv.conf
! 96:
! 97: chown -hR root:wheel .
! 98: cd -
! 99: }
! 100:
1.1 misho 101: # $1 = ELWIX install list config
102: # $2 = From World dir
103: # $3 = To Dest dir
104: InstallList()
105: {
1.4 misho 106: local TMPFILE=$(mktemp -q /tmp/instlist.XXXXXX)
107: if [ $? -ne 0 ]; then
108: echo "Error:: Can't create temp file, exiting..."
109: exit 1
110: fi
111:
112: sed -nE -e 's/^ *([^ #]+) */\1/p' < $1 | tr ':' '\n' >$TMPFILE
113: cd $2
114: for i in $(cat $TMPFILE); do
115: if [ -x $i ]; then
116: echo "Strip '$i'"
117: strip -s $i
118: fi
119: done
120: cd -
121: tar -C $2 -cvf - -T $TMPFILE | tar -C $3 -x -f -
122: rm -f $TMPFILE
1.1 misho 123: }
124:
125: # $1 = From dir
126: # $2 = To dir
1.2 misho 127: InstallDir()
1.1 misho 128: {
129: cd $1
130: pax -rw -pe -X . $2
131: cd -
132: }
133:
134: # $* = Program arguments for install tool
135: InstallProg()
136: {
137: install -c $*
138: }
1.2 misho 139:
140: # $1 = file_pattern
1.3 misho 141: # $2 = From dir
142: # $3 = To dir
1.2 misho 143: InstallFiles()
144: {
1.3 misho 145: if [ -d "$2" ]; then
146: cd $2
147: find . -type f -name "$1" |
148: tar -cvf - -T - | tar -C $3 -xf -
149: cd -
150: fi
151: }
152:
153: # $1 = Directory for clean
154: CleanCVS()
155: {
156: find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1
157: find $1 -type f -name .#\* -exec rm -f {} \; >/dev/null 2>&1
1.2 misho 158: }
1.3 misho 159:
1.4 misho 160: # $1 = file_pattern
161: # $2 = From dir
162: StripFiles()
163: {
164: if [ -d "$2" ]; then
165: local TMPFILE=$(mktemp -q /tmp/instlist.XXXXXX)
166: if [ $? -ne 0 ]; then
167: echo "Error:: Can't create temp file, exiting..."
168: exit 1
169: fi
170:
171: cd $2
172: find . -type f -name "$1" >$TMPFILE
173: for i in $(cat $TMPFILE); do
174: if [ -x $i ]; then
175: echo "Strip '$i'"
176: strip -s $i
177: fi
178: done
179: cd -
180: rm -f $TMPFILE
181: fi
182: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>