aredn/build/buildsteps/001-prepbuild

56 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
cd "$BUILDROOTBASE"
# Prep the feeds file
AREDN_PACKAGES_DIR=$(readlink -f "$BUILDROOTBASE/../aredn_packages")
if [ -n "$GERRIT_PROJECT" ] && [ "$GERRIT_PROJECT" = "aredn_packages" ]
then
# This is a Gerrit build for aredn_packages, lets run the single commit
echo "src-git arednpackages file://$AREDN_PACKAGES_DIR^$GERRIT_PATCHSET_REVISION" > feeds.conf
else
# If $GIT_BRANCH is set lets try and check locally to be sure the branch exists. If we haven't checked out aredn_packages
# locally then lets assume this may not be in the build environment and fall back to some sane defaults.
if [ -n "$GIT_BRANCH" ] && [ -d "$AREDN_PACKAGES_DIR" ] && [ -n "$(git --git-dir="$AREDN_PACKAGES_DIR/.git" branch --list -r "$GIT_BRANCH")" ]
then
BASE_BRANCH=$(echo "$GIT_BRANCH"|sed 's/.*\///')
else
case $GIT_BRANCH in
origin/release-* ) BASE_BRANCH="master";;
origin/hotfix-* ) BASE_BRANCH="master";;
origin/master ) BASE_BRANCH="master";;
* ) BASE_BRANCH="develop";;
esac
fi
echo "src-git arednpackages git://git.aredn.org/aredn_packages;$BASE_BRANCH" > feeds.conf
fi
cat feeds.conf.default >> feeds.conf
./scripts/feeds update -a
./scripts/feeds install -p arednpackages olsrd
./scripts/feeds install perl
./scripts/feeds install -p arednpackages vtun
./scripts/feeds install -a -p arednpackages
./scripts/feeds install snmpd
./scripts/feeds install ntpclient
./scripts/feeds install socat
./scripts/feeds install xinetd
./scripts/feeds install luci-base
./scripts/feeds install luci-lib-nixio
./scripts/feeds install luci-lib-ip
./scripts/feeds install luci-lib-jsonc
./scripts/feeds install luaposix
SHORT_COMMIT=$(echo "$GIT_COMMIT" | awk '{ string=substr($0, 1, 8); print string; }' )
SHORT_BRANCH=$(echo "$GIT_BRANCH" | awk 'match($0,"/"){print substr($0,RSTART+1)}')
if [ ! -z "$BUILD_SET_VERSION" ]; then
echo "$BUILD_SET_VERSION" > "$BUILDROOTBASE/files/etc/mesh-release"
else
echo "${SHORT_BRANCH}-${BUILD_NUMBER}-${SHORT_COMMIT}" > "$BUILDROOTBASE/files/etc/mesh-release"
fi