blob: d7495ad97eaff9e811c3f2341f64d17e356d1151 [file] [log] [blame]
#!/bin/bash
set -x -e
ALL_IDS="prod public pdfium chromevr"
print_usage() {
echo "Usage: $0 MESSAGE INSTANCE_ID"
echo " MESSAGE is the message to be included in the release package."
echo " INSTANCE_ID is the id of the instance targeted by this package."
echo " This should be one of: '$ALL_IDS' or 'all'."
exit 1
}
if [ "$#" -ne 2 ]; then
print_usage
fi
TARGET_INSTANCE_IDS=$2
# Strip the second argument to keep this compatible with the shared build script.
set -- "$1"
# Determine the instance ids we want to build
if [ "$TARGET_INSTANCE_IDS" = "all" ]; then
TARGET_INSTANCE_IDS=$ALL_IDS
fi
for INSTANCE_ID in $TARGET_INSTANCE_IDS; do
APPNAME=skiacorrectness-$INSTANCE_ID
SERVICE_FILE="./sys/$APPNAME.service"
WHITELIST_FILE="./sys/$APPNAME-whitelist.json5"
if [ ! -f ${SERVICE_FILE} ]; then
print_usage
fi
# Builds and uploads a debian package for skiacorrectness.
SYSTEMD="${APPNAME}.service"
DESCRIPTION="Manages baseline images."
DEPENDS=git
# Copy files into the right locations in ${ROOT}.
copy_release_files()
{
set -e
INSTALL="fakeroot install -D --verbose --backup=none --group=root --owner=root"
INSTALL_DIR="fakeroot install -d --verbose --backup=none --group=root --owner=root"
${INSTALL} --mode=755 -T ${GOPATH}/bin/correctness_migratedb ${ROOT}/usr/local/bin/correctness_migratedb
${INSTALL} --mode=755 -T ${GOPATH}/bin/skiacorrectness ${ROOT}/usr/local/bin/${APPNAME}
# If the whitelist file exists, package it.
if [ -f ${WHITELIST_FILE} ]; then
${INSTALL} --mode=644 -T $WHITELIST_FILE ${ROOT}/usr/local/share/skiacorrectness/${APPNAME}-whitelist.json5
fi
${INSTALL_DIR} --mode=755 ${ROOT}/usr/local/share/skiacorrectness/frontend/res/img
${INSTALL} --mode=644 ./frontend/res/img/favicon.ico ${ROOT}/usr/local/share/skiacorrectness/frontend/res/img/favicon.ico
${INSTALL_DIR} --mode=755 ${ROOT}/usr/local/share/skiacorrectness/frontend/res/js
${INSTALL} --mode=644 ./frontend/res/js/core.js ${ROOT}/usr/local/share/skiacorrectness/frontend/res/js/core.js
${INSTALL_DIR} --mode=755 ${ROOT}/usr/local/share/skiacorrectness/frontend/res/vul
${INSTALL} --mode=644 ./frontend/res/vul/elements.html ${ROOT}/usr/local/share/skiacorrectness/frontend/res/vul/elements.html
${INSTALL} --mode=644 ./frontend/index.html ${ROOT}/usr/local/share/skiacorrectness/frontend/index.html
${INSTALL} --mode=644 -T $SERVICE_FILE ${ROOT}/etc/systemd/system/${APPNAME}.service
}
source ../bash/release.sh
done