Annotation of elwix/build_init.sh, revision 1.5
1.1 misho 1: #!/bin/sh
2: #
3: # ELWIX build script for setup host cross compile process - *** START FIRST *** -
4: #
5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
6: # by Michael Pounov <misho@elwix.org>
7: #
1.5 ! misho 8: # $Id: build_init.sh,v 1.4.4.2 2017/10/08 00:05:36 misho Exp $
1.1 misho 9: #
10:
1.5 ! misho 11: # ./build_init.sh [custom build rc.elwix config]
1.4 misho 12: if [ -n "$1" ]; then
13: cd config
14: ln -sf $1 rc.elwix
15: cd -
16: fi
17:
1.1 misho 18: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
19: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
20: echo
21: echo "ELWIX project is not configured !?!"
22: echo
23: exit 1
24: fi
25:
26: if [ ! -d $BSDSRC ]; then
27: echo
28: echo "ELWIX project is not configured - missing BSD sources !?!"
29: echo
30: exit 1
31: fi
32:
33: if [ "${USER}" != "root" ]; then
34: echo
35: echo "ELWIX project is not configured - Init must build under root !?!"
36: echo
37: exit 1
38: fi
39:
1.3 misho 40: clean_pkgsrc()
41: {
42: echo "+++ Clean ELWIX pkgsrc ..."
43: # MNTEXISTS=$(mount | awk -vpkgsrc="${PKGSRC_DIR}" -vdstmnt="${WORLD}/usr/pkgsrc" \
44: # '($1 == pkgsrc && $3 == dstmnt) { printf("YES"); }')
45: # if [ "${MNTEXISTS}" != "YES" ]; then
46: # umount ${WORLD}/usr/pkgsrc
47: # fi
48:
49: rm -f /elwix ${WORLD}/usr/pkgsrc
50: echo "+++ Erased pkgsrc helper dirs!"
51: }
52:
1.1 misho 53: clean_init()
54: {
55: echo "+++ Clean ELWIX Projects ..."
56: echo -n "Erase *ALL* builded ELWIX projects [NO/yes]? "
57: read LINE
58: if [ X"$LINE" = X"yes" ]; then
1.3 misho 59: clean_pkgsrc
60:
1.5 ! misho 61: find ${BSDSRC} -name "*.o" -exec rm {} +
! 62:
1.4 misho 63: chflags -Rf noschg,nosunlink ${TOPDIR}
1.1 misho 64: rm -rf $TOPDIR
65: mkdir -p $TOPDIR
66: echo "+++ Erased *ALL* builded ELWIX projects!"
67: fi
68: }
69:
70: install_init()
71: {
72: echo "+++ Install ELWIX Project directories ..."
73:
74: install -d $REL
75: install -d $DEST
76: install -d $OBJS
77: install -d $ADIR
78:
79: install -d $BSDOBJ
80:
1.2 misho 81: # ln -sf $BSDSRC
82:
1.1 misho 83: echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${TOPDIR}/elwix.ver
84: }
85:
86: ### main()
87: install -d ${TOPDIR}
88:
89: V=$(CheckVer ${TOPDIR}/elwix.ver)
90: if [ $? -ne 0 -o X"$V" != X"${VERSION}" ]; then
91: echo " Not found valid version or different version from current - Start CLEAN *ALL*"
92: rm -rf $TOPDIR
93: mkdir -p $TOPDIR
94: echo "+++ CLEAN *ALL* complete"
95: else
96: clean_init
97: fi
98:
99: install_init
100:
101: echo "+++ Complete Init ELWIX"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>