amaharacya.one/mk.sh

30 lines
944 B
Bash
Executable file

#!/bin/sh
if [ ! -e ssg/main.php ]; then
if ! git --version >>/dev/null; then
echo "error: dummy-ssg submodule is uninitialized, and git not installed"
echo "Try to install git, then run this script again"
exit 1
fi
if ! git submodule update --init ssg; then
if [ ! -e ssg/main.php ]; then
echo "error: failed to init submodule dummy-ssg"
echo "Check your network connection and the error message above"
exit 1
fi
fi
fi
if ! php --version >>/dev/null; then
echo "error: Please install PHP, prefer version 8+"
exit 1
fi
if ! echo "<?php mb_strlen(\"\") ?>" | php 2>>/dev/null; then
echo "error: php_mbstring is not installed, dummy-ssg will not work"
exit 1
fi
if ! echo "<?php new DOMDocument ?>" | php 2>>/dev/null; then
echo "warning: php-xml is not installed, dummy-ssg will lack XML tag support in markdown"
fi
exec php ssg/main.php --template tpl --input src --output out --clean