D3V-Server/blog-starter/scripts/bootstrap-theme.sh

25 lines
693 B
Bash

#!/bin/sh
set -eu
THEME_DIR="themes/LoveIt"
THEME_REPO="https://github.com/dillonzq/LoveIt.git"
THEME_REF="${LOVEIT_REF:-master}"
mkdir -p themes
if [ -d "${THEME_DIR}/.git" ]; then
echo "Updating LoveIt theme..."
git -C "${THEME_DIR}" fetch --depth 1 origin "${THEME_REF}"
git -C "${THEME_DIR}" checkout -f FETCH_HEAD
else
echo "Cloning LoveIt theme..."
git clone --depth 1 --branch "${THEME_REF}" "${THEME_REPO}" "${THEME_DIR}"
fi
if [ -f "${THEME_DIR}/.gitmodules" ]; then
echo "Initializing LoveIt submodules..."
git -C "${THEME_DIR}" submodule sync --recursive
git -C "${THEME_DIR}" submodule update --init --recursive
fi
echo "LoveIt theme is ready in ${THEME_DIR}"