gerrit/contrib/mitm-ui/mitm-theme.sh
viktard fd72a50e29 Force or replace local site theme on *.googlesource.com
Sample usage:
   ~/mitm-gerrit/mitm-theme.sh ./path/to/theme.html

Change-Id: I9c445d5c8354952771d73b1de0a29626787c8634
2019-01-10 15:59:48 -08:00

32 lines
742 B
Bash
Executable File

#!/bin/sh
if [[ -z "$1" ]]; then
echo This script forces or replaces default site theme on *.googlesource.com
echo Provide path to the theme.html as a parameter.
exit 1
fi
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(basename "$1")
while [ -L "$LINK" ]; do
LINK=$(readlink "$LINK")
cd "$(dirname "$LINK")"
LINK="$(basename "$1")"
done
REAL_DIR=`pwd -P`
RESULT=$REAL_DIR/$LINK
cd "$OURPWD"
echo "$RESULT"
}
theme=$(realpath "$1")
theme_dir=$(dirname "${theme}")
mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
"${mitm_dir}"/dev-chrome.sh &
"${mitm_dir}"/mitm-docker.sh -v "${theme_dir}":"${theme_dir}" "serve-app-dev.py --strip_assets --theme \"${theme}\""