#!/bin/bash set -e # make sure 'node' is in path (debian calls it nodejs) mkdir -p bin ln -sf /usr/bin/nodejs bin/node export PATH=$PATH:`pwd`/bin [[ -z "$WORKSPACE" ]] && WORKSPACE=$(pwd -P) echo "Using workspace $WORKSPACE" TMPDIR=${TMPDIR:-$WORKSPACE/docs-webtemplate} HTDOCS=${HTDOCS:-$WORKSPACE/htdocs} mkdir -p $HTDOCS trap "rm -rf $WORKSPACE/setupdocs.sh $TMPDIR" STOP INT QUIT EXIT # setupdocs is already imported from automotive-grade-linux/docs-webtemplate #wget -O $WORKSPACE/setupdocs.sh https://raw.githubusercontent.com/automotive-grade-linux/docs-webtemplate/master/setupdocs.sh wget -O $WORKSPACE/setupdocs.sh https://git.automotivelinux.org/ci-management/plain/jjb/daily-jjb-doc-multiversion-update/setupdocs.sh chmod +x $WORKSPACE/setupdocs.sh function gensite() { local branch=${1:-master} local tmp=$TMPDIR/$branch mkdir -p $tmp $WORKSPACE/setupdocs.sh -w master -d $tmp pushd $tmp tocsdir="tocs_$branch" # exception for master branch to keep aligned with legacy tocs_agl [[ "$branch" == "master" ]] && tocsdir="tocs" sed -i "s|^baseurl:.*$|baseurl: \"/$branch\"|g" conf/_dev.yml sed -i "s|^docsurl:.*$|docsurl: \"/$branch/docs\"|g" conf/_config.yml cat <<-EOF >>conf/AppDefaults.js config.TOCS_DIR="$PWD/content/$tocsdir"; config.AGL_GERRIT_BRANCH="$branch"; config.AGL_GITHUB_BRANCH="$branch"; EOF navbarColor="#222" typeDocStr="master branch" if [ "$branch" == "flounder" ]; then navbarColor="darkslategray" typeDocStr="Flounder release" fi git apply < -