Add Makefile option to set base dir for installation - postreich - Unnamed repository; edit this file 'description' to name the repository. DIR Log DIR Files DIR Refs DIR README --- DIR commit 99a2c4259c904c3aef672e9699a244de865ef283 DIR parent c8562c05cfab1de6ca51d231ba194ca644847383 HTML Author: Scarlett McAllister <no+reply@roygbyte.com> Date: Tue, 30 Jan 2024 20:39:30 -0400 Add Makefile option to set base dir for installation Diffstat: M Makefile | 5 +++-- M src/geomyidae/api/common | 7 ++++--- M src/geomyidae/index.dcgi | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) --- DIR diff --git a/Makefile b/Makefile @@ -1,6 +1,5 @@ -# Path, including hostname and any sub directories. -# for example: roygbyte.com/postreich HOSTNAME = localhost +BASE_DIR = postreich dist: rm -R dist @@ -8,7 +7,9 @@ dist: rsync --exclude="#*#" --exclude="*mailboxes" --exclude=".*" --exclude="*pubkeys" -l -p -r src/geomyidae/ dist/geomyidae mkdir dist/geomyidae/api/mailboxes mkdir dist/geomyidae/api/pubkeys + sed -i -E 's/(BASE_DIR=)""/\1"$(BASE_DIR)"/' dist/geomyidae/api/common sed -i 's/<HOSTNAME>/$(HOSTNAME)/' dist/geomyidae/index.dcgi + sed -i 's/<BASE_DIR>/$(BASE_DIR)\//' dist/geomyidae/index.dcgi devl: rm src/geomyidae/api/mailboxes DIR diff --git a/src/geomyidae/api/common b/src/geomyidae/api/common @@ -1,8 +1,9 @@ #!/bin/sh -BASE_DIR="" # Leave empty if run from server root. Otherwise, show - # directory with a leading slash but no trailing slash. -PUBKEYS="pubkeys" +# BASE_DIR: Where the entire program is installed. +# No touchy! It is set in Makefile during dist step only. +BASE_DIR="" +PUBKEYS="pubkeys" TEMPLATES="templates" MAILBOXES="mailboxes" MAILROOM="mailroom" DIR diff --git a/src/geomyidae/index.dcgi b/src/geomyidae/index.dcgi @@ -39,7 +39,7 @@ Create a mailbox: handle=$1 pubkey=$2 -curl "gopher://<HOSTNAME>/7/api/mailbox/create/$handle?" \ +curl "gopher://<HOSTNAME>/7/<BASE_DIR>api/mailbox/create/$handle?" \ $( cat $pubkey \ | base64 \ | tr -d "\\n" )