From 9f9877b8b4b83c6478e1b6c0ff9d407a365ba8fb Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Fri, 21 Feb 2020 13:07:10 +0100 Subject: [PATCH] prepared deploymant script for better code replacement handling --- deployment-script.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deployment-script.sh b/deployment-script.sh index f85298a..1f0d5f2 100755 --- a/deployment-script.sh +++ b/deployment-script.sh @@ -1,11 +1,15 @@ +function rewrite_code { + echo "Replacing $1 with $2 in all HTML and PHP files." + echo -e "`find ./ -name '*.html' -or -name '*.php' | sed "s/^/workingfile=\'/;s/\$/\'\; cat \\\$workingfile > .\/tmpdeploymentfile\; cat tmpdeploymentfile | sed \'s#$1#$2#\' > \\\$workingfile/"`\nrm tmpdeploymentfile" | bash - +} + + #!/bin/bash echo "Deployment script for repository \"web-deployment\" `date` ==============================================================================" -echo "Replacing %CONTENT_DIR% in all HTML and PHP files." -CONTENT_DIR="\/common\/threadr" -echo -e "`find ./ -name '*.html' -or -name '*.php' | sed "s/^/workingfile=\'/;s/\$/\'\; cat \\\$workingfile > .\/tmpdeploymentfile\; cat tmpdeploymentfile | sed \'s#%CONTENT_DIR%#$CONTENT_DIR#\' > \\\$workingfile/"`\nrm tmpdeploymentfile" | bash - +rewrite_code %CONTENT_DIR% "\/common\/threadr" echo "============================================================================== Done."