1#!/bin/bash 2# 3# How to use: 4# From directory {root}/docs/source.android.com/scripts run: 5# $ ./build2stage.sh <server number> 6# 7# For example, to build and stage on staging instance 13, run: 8# $ ./build2stage.sh 13 9# 10 11echo 'Please run this script from the docs/source.android.com/scripts directory ' \ 12 ' branch/docs/source.android.com/scripts' 13echo ' ' 14 15# Read the configuration file to retrieve the App Engine staging - AE_STAGING - value 16source /etc/profile.d/build2stage-conf.sh 17 18# Go up three directories to build content 19cd ../../.. 20 21# Delete old output 22rm -rf out/target/common/docs/online-sac* 23 24# Initialize the environment 25source build/envsetup.sh 26 27# Set up the Java environment 28set_stuff_for_environment 29 30# Note: if that stops working, try the lunch command with any build target, 31# For example: 32# lunch aosp_arm-eng 33 34# Make the docs 35make online-sac-docs 36 37# Go to the output directory to stage content 38cd out/target/common/docs 39 40# Edit the app.yaml file to upload to the specified server. 41sed 's/staging[0-9]*$/staging'$1'/' online-sac/app.yaml > .temp 42 43# Copy in new app.yaml content 44cp .temp online-sac/app.yaml 45rm .temp 46 47# Stage the data on the server. 48$AE_STAGING update online-sac 49 50echo 'Your staged content is available at staging instance '$1'' 51