trilium/docs-new/prepare.sh
2024-07-20 12:26:52 +03:00

18 lines
462 B
Bash
Executable File

if [ ! -f .env ]; then
echo "Missing .env file, cannot proceed."
exit 1
fi
output_dir="output"
rm -rf "$output_dir"
mkdir -p "$output_dir"
source ./.env
# Download everything in output/notes.example.com/share/...
share_url="$SHARE_PROTOCOL://$SHARE_HOST/share/$ROOT_NOTE_ID"
wget -rp -e robots=off "$share_url" -P "$output_dir"
# Get rid of the domain in the output folder
mv "$output_dir/$SHARE_HOST"/* "$output_dir/"
rmdir "$output_dir/$SHARE_HOST"