#!/bin/sh
if [ ! -f "public/index.html" ]; then
npm install -g hexo-cli
hexo init && npm install
git clone https://github.com/PhosphorW/hexo-theme-academia.git themes/Academia
npm install hexo-renderer-pug hexo-renderer-stylus --save
cp /tmp/hexo_config.yml _config.yml
cp /tmp/narnaud.jpg themes/Academia/source/img/narnaud.jpg
cd themes/Academia
cp /tmp/academia_config.yml _config.yml
sed -i "/Blog: .*/c\ Blog: https:\/\/$DOMAIN\/wordpress" _config.yml
sed -i "/Gitea: .*/c\ Gitea: https:\/\/$DOMAIN\/git" _config.yml
sed -i "/Adminer: .*/c\ Adminer: https:\/\/$DOMAIN\/adminer.php" _config.yml
hexo generate
fi