4
Fork 0
CronosAgent/OpenWRT/build.sh
Artem Prilutskiy 3d79575f03 Fixes
2016-08-03 18:33:47 +03:00

47 lines
933 B
Bash
Executable file

#!/bin/bash
PACKAGE=cronosagent
PROJECT=$(pwd)/..
OPENWRT=${HOME}/openwrt
test -d $OPENWRT/package/$PACKAGE
STATE=$?
if [ "$STATE" -eq "0" ]
then
# Remove existing package in buildroot
rm -rf $OPENWRT/package/$PACKAGE
fi
# Create package directory and copy all stuff
mkdir -p $OPENWRT/package/$PACKAGE/source
cp -R $PROJECT $OPENWRT/package/$PACKAGE/source
rm -rf $OPENWRT/package/$PACKAGE/source/.git
pushd . > /dev/null
cd $OPENWRT
if [ "$STATE" -eq "1" ]
then
# Build predefined packages for the first run
make
fi
# Make Makefile visible to Buildroot
mv package/$PACKAGE/source/OpenWRT/Makefile package/$PACKAGE
if [ "$STATE" -eq "1" ]
then
# Give user to choose package $PACKAGE
make menuconfig
fi
# Build package
make package/$PACKAGE/compile V=ws 2>&1 | tee $PROJECT/../build.log | grep -i error
# Copy built packages
find bin -name ${PACKAGE}*.ipk | xargs -l -I {} mv {} $PROJECT/..
popd > /dev/null