32 lines
944 B
Bash
Executable File
32 lines
944 B
Bash
Executable File
#!/bin/bash
|
|
echo -e "********** Docs Server Initialization ***************"
|
|
|
|
source $LIB_DIR/verbose.lib
|
|
source $LIB_DIR/helpers.lib
|
|
source $ENV_DIR/run.env
|
|
|
|
echo setting up document directory $DOC_HOME with git, making first commit
|
|
mkdir -p $DOC_HOME
|
|
[[ ! -f $DOC_HOME/mkdocs.yml ]] && echo intializing mkdocs in $DOC_HOME && /usr/local/bin/mkdocs new $DOC_HOME
|
|
chown -R $USER:$USER $DOC_HOME
|
|
# TODO allow setting up a remote for branch
|
|
sudo -u doc /bin/bash << CMD
|
|
cd $DOC_HOME
|
|
git init
|
|
git add .
|
|
git config user.email ${USER_EMAIL:-doc@somedomain.com}
|
|
git config user.name "${USER_NAME:-doc}"
|
|
git commit -m="initial documentation commit"
|
|
git log --stat
|
|
CMD
|
|
echo "done setting up $DOC_HOME"
|
|
|
|
echo "setting up caddy for password secured access to editor and docs"
|
|
source $LIB_DIR/caddy.lib
|
|
mkdir -p $CADDY_HOME/bin $CADDY_HOME/settings $CADDY_HOME/data
|
|
|
|
chown -R $USER:$USER /opt
|
|
|
|
echo -e "********** Done: initialization ***************"
|
|
|