From f32fb168dc03e28e3e43a0e49e722d4aba0a5bd6 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 27 Jul 2024 23:27:11 +0300 Subject: [PATCH] docs: Fix the prepare script if run from a different dir --- bin/docs/prepare.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) mode change 100755 => 100644 bin/docs/prepare.sh diff --git a/bin/docs/prepare.sh b/bin/docs/prepare.sh old mode 100755 new mode 100644 index 84ef77f6c..386941b78 --- a/bin/docs/prepare.sh +++ b/bin/docs/prepare.sh @@ -1,17 +1,22 @@ #!/usr/bin/env bash -if [ ! -f .env ]; then +script_dir=$(realpath $(dirname $0)) + +cd "$script_dir" + +env_file="$script_dir/.env" + +if [ ! -f "$env_file" ]; then echo "Missing .env file, cannot proceed." exit 1 fi -script_dir=$(realpath $(dirname $0)) -output_dir="$script_dir/../docs" +output_dir="$script_dir/../../docs" mkdir -p "$output_dir" rm -f "$output_dir"/* rm -rf "$output_dir"/{assets,share} -source ./.env +source "$env_file" # Download everything in output/notes.example.com/share/... share_url="$SHARE_PROTOCOL://$SHARE_HOST/share/$ROOT_NOTE_ID" @@ -30,5 +35,5 @@ sed -i "s/{{ROOT_NOTE_ID}}/$ROOT_NOTE_ID/g" "$index_dest_path" sed -i "s/