#!/bin/sh
#
# ELWIX build script for setup host cross compile process - *** START FIRST *** -
#
# (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
# by Michael Pounov <misho@elwix.org>
#
# $Id: build_init.sh,v 1.3.14.1 2014/01/14 09:11:13 misho Exp $
#
if [ -n "$1" ]; then
cd config
ln -sf $1 rc.elwix
cd -
fi
[ -r ./config/rc.elwix ] && . ./config/rc.elwix
if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
echo
echo "ELWIX project is not configured !?!"
echo
exit 1
fi
if [ ! -d $BSDSRC ]; then
echo
echo "ELWIX project is not configured - missing BSD sources !?!"
echo
exit 1
fi
if [ "${USER}" != "root" ]; then
echo
echo "ELWIX project is not configured - Init must build under root !?!"
echo
exit 1
fi
clean_pkgsrc()
{
echo "+++ Clean ELWIX pkgsrc ..."
# MNTEXISTS=$(mount | awk -vpkgsrc="${PKGSRC_DIR}" -vdstmnt="${WORLD}/usr/pkgsrc" \
# '($1 == pkgsrc && $3 == dstmnt) { printf("YES"); }')
# if [ "${MNTEXISTS}" != "YES" ]; then
# umount ${WORLD}/usr/pkgsrc
# fi
rm -f /elwix ${WORLD}/usr/pkgsrc
echo "+++ Erased pkgsrc helper dirs!"
}
clean_init()
{
echo "+++ Clean ELWIX Projects ..."
echo -n "Erase *ALL* builded ELWIX projects [NO/yes]? "
read LINE
if [ X"$LINE" = X"yes" ]; then
clean_pkgsrc
chflags -Rf noschg ${TOPDIR}
rm -rf $TOPDIR
mkdir -p $TOPDIR
echo "+++ Erased *ALL* builded ELWIX projects!"
fi
}
install_init()
{
echo "+++ Install ELWIX Project directories ..."
install -d $REL
install -d $DEST
install -d $OBJS
install -d $ADIR
install -d $BSDOBJ
# ln -sf $BSDSRC
echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${TOPDIR}/elwix.ver
}
### main()
install -d ${TOPDIR}
V=$(CheckVer ${TOPDIR}/elwix.ver)
if [ $? -ne 0 -o X"$V" != X"${VERSION}" ]; then
echo " Not found valid version or different version from current - Start CLEAN *ALL*"
rm -rf $TOPDIR
mkdir -p $TOPDIR
echo "+++ CLEAN *ALL* complete"
else
clean_init
fi
install_init
echo "+++ Complete Init ELWIX"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>