#!/bin/sh
if [ ! -f "public/index.html" ]; then
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
hexo n post "README"
sed -i "5i academia: true" source/_posts/README.md
cat /tmp/README.md >> source/_posts/README.md
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
fi
hexo generate