Files
oopt-goldstone/setup.env
Wataru Ishida d59952ef4c add sonic switch state service (swss) package
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2018-08-25 16:09:06 +00:00

99 lines
2.7 KiB
Bash

#!/bin/bash
############################################################
#
# The settings in this script are required
# and should be sourced into your local build shell.
#
############################################################
# The root of the X1 build tree is here
export X1=$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
export X1_TEMPLATES=$X1/packages/base/any/templates
# The root of the ONL tree is here
export ONL=$X1/sm/ONL
export SONIC=$X1/sm/sonic-buildimage
pushd $SONIC
DIRTY_SUFFIX=
. functions.sh
export SONIC_VERSION=$(sonic_get_version)
popd
# Checkout ONL if necessary
if [ ! -f $ONL/LICENSE ]; then
git submodule update --init sm/ONL
# Versions and setup.
(cd sm/ONL && . setup.env)
fi
# Checkout sonic-buildimage if necessary
if [ ! -f $SONIC/LICENSE ]; then
git submodule update --init sm/sonic-buildimage
# Versions and setup.
make -C $SONIC init
fi
# All package directories.
export ONLPM_OPTION_PACKAGEDIRS="$ONL/packages:$ONL/builds:$X1/packages:$X1/builds:$ONLPM_OPTION_PACKAGEDIRS"
# Repo directory.
export ONLPM_OPTION_REPO="$X1/REPO"
# RELEASE directory.
export ONLPM_OPTION_RELEASE_DIR="$X1/RELEASE"
# The ONL build tools should be included in the local path:
export PATH="$ONL/tools/scripts:$ONL/tools:$PATH"
# Parallel Make Jobs
# Default parallel build settings
export ONL_MAKE_PARALLEL=-j16
# Export the current debian suite
export ONL_DEBIAN_SUITE=$(lsb_release -c -s)
export BUILDER_MODULE_DATABASE_ROOT=$X1
export INIT=systemd
# Version files
$ONL/tools/make-versions.py --force --import-file=$X1/tools/x1vi --class-name=OnlVersionImplementation --output-dir $X1/make/versions
( . $X1/make/versions/version-x1.sh && echo BuildID is $FNAME_BUILD_ID )
# Enable local post-merge githook
if [ ! -f $X1/.git/hooks/post-merge ]; then
cp $ONL/tools/scripts/post-merge.hook $X1/.git/hooks/post-merge
fi
export ONL_SUBMODULE_UPDATED_SCRIPTS="$X1/tools/scripts/submodule-updated.sh:$ONL/tools/scripts/submodule-updated.sh"
# Update X1 REPO from ONL build-artifacts
cp -R $ONL/sm/build-artifacts/REPO/* $X1/REPO
# TODO Quick hack to make https work
# remove this after ONL builder has https support
# https://github.com/opennetworklinux/X1/pull/3/files#r201783677
sudo apt install -qy apt-transport-https
# Install Docker cli
if [ ! -f /usr/bin/docker ]; then
wget -O /tmp/docker.tgz https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz
tar xf /tmp/docker.tgz -C /tmp
sudo mv /tmp/docker/docker /usr/bin/
rm /tmp/docker.tgz
fi
# This incur security risk
sudo chmod 666 /var/run/docker.sock
# Install j2
if [ ! -f /usr/local/bin/j2 ]; then
sudo apt install -qy python-setuptools
sudo easy_install pip
sudo pip install j2cli
fi