1: #!/bin/sh
2: #
3: # ELWIX Build script for ELWIX raw base firmware
4: #
5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
6: # by Michael Pounov <misho@elwix.org>
7: #
8: # $Id: build_base.sh,v 1.1.2.4 2013/07/31 15:53:43 misho Exp $
9: #
10:
11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
13: echo
14: echo "ELWIX project is not configured !?!"
15: echo
16: exit 1
17: fi
18:
19: if [ ! -d ${BSDSRC} ]; then
20: echo
21: echo "ELWIX project is not configured - missing BSD sources !?!"
22: echo
23: exit 1
24: fi
25:
26: if [ "${USER}" != "root" ]; then
27: echo
28: echo "ELWIX project is not configured - base must build under root !?!"
29: echo
30: exit 1
31: fi
32:
33: clean_basefs()
34: {
35: echo "+++ Clean ELWIX base firmware ..."
36: chflags -Rf noschg $BASEFS $BASE_FS
37: rm -rf $BASEFS $BASE_FS ${REL}/${BASE_OS}
38: }
39:
40: build_basefs()
41: {
42: echo "+++ Build ELWIX base directory ..."
43: mkdir -p $BASEFS
44:
45: cd $BASEFS
46:
47: install -d bin;
48: install -d boot;
49: install -d boot/defaults;
50: install -d boot/firmware;
51: install -d boot/kernel;
52: install -d boot/modules;
53: install -d boot/zfs;
54: install -d dev;
55: install -d elwix;
56: install -d elwix/altroot;
57: install -d elwix/altroot/var;
58: install -d elwix/cf;
59: install -d elwix/etc;
60: install -d -o 883 -g 883 elwix/etc/mqtt;
61: install -d elwix/exports;
62: install -d elwix/home;
63: install -d -m 0750 elwix/root;
64: install -d -m 0750 elwix/root/.ssh;
65: install -d elwix/system;
66: install -d elwix/tftpboot;
67: install -d elwix/pkg;
68: install -d elwix/pkg/bin;
69: install -d elwix/pkg/lib;
70: install -d elwix/pkg/libexec;
71: install -d elwix/pkg/libdata;
72: install -d elwix/pkg/sbin;
73: ln -fs /elwix/etc etc;
74: ln -fs /elwix/exports exports;
75: ln -fs /elwix/home home;
76: ln -fs /elwix/root root;
77: ln -fs /elwix/system system;
78: ln -fs /elwix/tftpboot tftpboot;
79: install -d mnt;
80: install -d -m 0555 proc;
81: install -d sbin;
82: install -d tmp;
83: install -d usr;
84: install -d usr/bin;
85: install -d usr/lib;
86: ln -fs /usr/lib lib;
87: install -d usr/lib/engines;
88: install -d usr/lib/geom;
89: install -d usr/lib32;
90: install -d usr/libdata;
91: install -d usr/libexec;
92: ln -fs /usr/libexec libexec;
93: install -d usr/local;
94: install -d usr/local/bin;
95: install -d usr/local/lib;
96: install -d usr/local/libexec;
97: install -d usr/local/libdata;
98: install -d usr/local/sbin;
99: install -d usr/sbin;
100: install -d usr/share;
101: install -d usr/share/misc;
102: install -d usr/share/skel;
103: install -d usr/share/zoneinfo;
104: install -d var;
105:
106: chown -hR root:wheel .
107: cd -
108: }
109:
110: install_basefs()
111: {
112: LIBS="${BASEFS}/usr/lib"
113: LIBEXEC="${BASEFS}/usr/libexec"
114: LIBDATA="${BASEFS}/usr/libdata"
115: BIN="${BASEFS}/bin"
116: UBIN="${BASEFS}/usr/bin"
117: SBIN="${BASEFS}/sbin"
118: USBIN="${BASEFS}/usr/sbin"
119: SHARE="${BASEFS}/usr/share"
120: SKEL="${SHARE}/skel"
121: MISC="${SHARE}/misc"
122:
123: echo "+++ Install ELWIX base software ..."
124: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
125: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
126: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
127: else
128: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
129: install -v -m 644 ${BSDSRC}/etc/services $MISC;
130: fi
131:
132: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
133: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
134: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
135: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
136: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
137:
138: find ${WORLD}/libexec -type f -name ld-elf.so\* -exec install {} $LIBEXEC \;
139:
140: find ${WORLD}/lib -type f -name \*.so.\* -exec install {} $LIBS \;
141: find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
142: find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
143: find ${WORLD}/usr/lib -type f -name \*.so.\* -exec install {} $LIBS \;
144: find ${WORLD}/usr/lib/engines -type f -name \*.so -exec install {} $LIBS/engines \;
145:
146: InstallList ${ELWIX_BASEFS} ${WORLD} ${BASEFS}
147:
148: ln ${BIN}/tcsh ${UBIN}/tcsh
149:
150: InstallDir ${WORLD}/usr/local/bin $UBIN
151: InstallDir ${WORLD}/usr/local/sbin $USBIN
152: InstallFiles \*.so\* ${WORLD}/usr/local/lib $LIBS
153: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
154:
155: chown -R root:wheel $SBIN $BIN $USBIN $UBIN $LIBDATA $LIBEXEC $LIBS
156: }
157:
158: prepare_fs()
159: {
160: echo "+++ Prepare ELWIX fs ..."
161: mkdir -p $1
162:
163: if [ -d ${BASEFS} ]; then
164: cd ${BASEFS}
165: pax -rw -pe -X . $1
166: cd -
167: fi
168: }
169:
170: ### main()
171: clean_basefs
172: build_basefs
173:
174: install_basefs
175:
176: # build fs
177: prepare_fs ${BASE_FS}
178: MakeFS_var ${BASE_FS}/elwix ${BASE_ETC}
179:
180: echo "+++ Complete build ELWIX base"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>