33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
|
#!/bin/bash
|
||
|
[[ ! $1 ]] && echo must specify a site name to build && exit
|
||
|
RDIR=$(cd $(dirname $(readlink -f "$0")) >/dev/null 2>&1 ; pwd -P)
|
||
|
# source any environment for particular site
|
||
|
shopt -s extglob
|
||
|
ENV_FILE=$(ls $RDIR/sites/${1}* 2> /dev/null | grep -v '.off$\|.example$\|.tmpl$\|.template$')
|
||
|
|
||
|
if [[ $ENV_FILE ]]; then
|
||
|
source $ENV_FILE
|
||
|
echo '***********************'
|
||
|
echo "sourcing $ENV_FILE environment file for hugo build"
|
||
|
cat $ENV_FILE
|
||
|
echo '************************'
|
||
|
else
|
||
|
echo warning no environoment file set for $1 in $RDIR/sites
|
||
|
fi
|
||
|
DATA_DIR=${DATA_DIR:-${HOME}/.local/hugo}
|
||
|
SOURCE_DIR=${DATA_DIR}/${1}$([[ $DATA_SUB_DIR ]] && echo "/$DATA_SUB_DIR")
|
||
|
DEPLOY_DIR=${DEPLOY_DIR:-${DATA_DIR}/${1}$([[ $DEPLOY_SUB_DIR ]] && echo "/$DEPLOY_SUB_DIR" || echo "/deploy")}
|
||
|
HUGO=${HUGO:-$(command -v hugo)}
|
||
|
PORT=${PORT:-8096}
|
||
|
echo site files output to ${DEPLOY_DIR}
|
||
|
CMD="$HUGO
|
||
|
--themesDir $RDIR/themes
|
||
|
--source $SOURCE_DIR
|
||
|
--baseURL ${DEPLOY_URL:-localhost}
|
||
|
--destination ${DEPLOY_DIR}
|
||
|
"
|
||
|
echo '*********** building site for deployment **********'
|
||
|
echo $CMD
|
||
|
echo '**************************************'
|
||
|
eval $CMD
|