Skip to content

Commit

Permalink
fix: make the import_to_hugo.sh script work on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
viktomas committed Aug 2, 2023
1 parent e286fa3 commit 03e5782
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions import_to_hugo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e

# Check if the correct number of arguments is provided
if [ "$#" -ne 2 ]; then
echo "Usage: move_logseq_content.sh <export_folder> <blog_folder>"
exit 1
echo "Usage: move_logseq_content.sh <export_folder> <blog_folder>"
exit 1
fi

# Extract arguments
Expand All @@ -14,14 +14,14 @@ blog_folder="$2"

# Check if the export folder exists
if [ ! -d "$export_folder" ]; then
echo "Error: The export folder does not exist."
exit 1
echo "Error: The export folder does not exist."
exit 1
fi

# Check if the blog folder exists
if [ ! -d "$blog_folder" ]; then
echo "Error: The blog folder does not exist."
exit 1
echo "Error: The blog folder does not exist."
exit 1
fi

blog_content_folder="${BLOG_CONTENT_FODLER:-/graph}"
Expand All @@ -48,7 +48,8 @@ cp -R "$export_folder/logseq-pages"/* "$pages_destination/"
cp -R "$export_folder/logseq-assets"/* "$assets_destination/"

# replace the /logseq-asstes/ paths with the hugo image folder
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-assets/@$images_folder/@g" {} \;
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-pages/@$blog_content_folder/@g" {} \;
find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-assets/@$images_folder/@g" {} \;
find "$pages_destination" -type f -exec sed -i.bak -e "s@/logseq-pages/@$blog_content_folder/@g" {} \;
rm -f "$pages_destination"/*.bak

echo "Content moved successfully."

0 comments on commit 03e5782

Please sign in to comment.