From 46b3f817f6218c1cf611ee1df74ae06387c084b0 Mon Sep 17 00:00:00 2001 From: Phil Bajsicki Date: Mon, 18 Nov 2024 19:14:32 +0100 Subject: [PATCH] Update --- README.org | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/README.org b/README.org index 004627a..570cead 100644 --- a/README.org +++ b/README.org @@ -14,32 +14,30 @@ The post-receive hook is like so: #!/bin/bash # Directory on the server where the website will be mapped. export GIT_WORK_TREE=/srv/bajsicki.com/ - -echo `pwd` -echo "post-receive: Generating https://bajsicki.com with Hugo..." - -# Create the directory and all subdirectories if they don't exist. -echo "post-receive: Creating directory and subdirs if they don't exist." -mkdir -p $GIT_WORK_TREE -chmod 755 $GIT_WORK_TREE +cd $GIT_WORK_TREE +echo "post-receive: Generating https://bajsicki.com with Hugo in $(pwd)" # Remove any files already in the public directory, a fresh copy will be generated by hugo -echo "post-receive: Cleaning the /public directory." -rm -rf $GIT_WORK_TREE/public +echo "post-receive: Cleaning the /public and /content directory to ensure we're in line." +rm -rf public/ && echo "removing /public in $(pwd)" +rm -rf content/ && echo "removing /content in $(pwd)" # Update the modules in case of changes and pull the new pages -echo "post-receive: pulling git repo and submodules" -cd $GIT_WORK_TREE && git pull --recurse-submodules +echo "post-receive: pulling git repo and submodules in $(pwd) w/ subshell" +( + unset $(env | sed -ne 's/^\(GIT_.*\)=.*/\1/p') + cd /srv/bajsicki.com + git pull origin main --recurse-submodules --force +) # Generate the site with hugo -echo "post-receive: running hugo" -cd $GIT_WORK_TREE && hugo - +echo "post-receive: running hugo in $(pwd)" +hugo # Fix any permission problems. -echo "post-receive: fixing permissions" -find $GIT_WORK_TREE/public -type f -print | xargs -d '\n' chmod 644 -find $GIT_WORK_TREE/public -type d -print | xargs -d '\n' chmod 755 +echo "post-receive: fixing permissions in $(pwd)" +find public -type f -print | xargs -d '\n' chmod 644 +find public -type d -print | xargs -d '\n' chmod 755 -echo "post-receive: Hugo site deployment complete" +echo "post-receive: Hugo site deployment in $(pwd) complete" #+end_src