#!/bin/sh
if ! [ -z "$BASEPATH" ]; then
echo "Replacing basepath with: $BASEPATH"
# Escape BASEPATH for sed substitution
# - replaces / with \/
# - replaces " with \"
escaped_basepath=$(printf '%s\n' "$BASEPATH" | sed -e 's/[\/&]/\\&/g' -e 's/"/\\"/g')
# run the substitution
# replaces
# with whatever BASEPATH is set to
sed -i "s///g" /usr/share/nginx/html/index.html
echo "Replaced basepath in index.html"
fi