organized scripts

This commit is contained in:
Dibyashanu Pati 2025-03-02 13:50:52 +05:30
parent abdd7e6ef2
commit 0232b09c81
7 changed files with 146 additions and 102 deletions

View file

@ -1,59 +1,17 @@
#!/usr/bin/env sh
# start with a clean slate
rm -rf ./public/cosmicflow-html/
rm -rf ./public/exocortex-hugo-md/content/
rm -rf ./public/exocortex-hugo-md/public/*
# generate the html and gemini versions of the site using org-publish
emacs -Q --batch -l create-site.el
rsync -avi ./content/ltximg ./public/cosmicflow-html/
#sync exocortex notes
cd ./public/exocortex-hugo-md/
npx quartz build
cd ../../
# run script to copy the generated latex images to the appropiate subdirectories
./copy_latex_images.sh
rsync -avi --delete ./public/exocortex-hugo-md/public/ ./public/cosmicflow-html/exocortex/
# Generate the exocortex
./build_exocortex.sh
# Set the source and destination directories
src_dir="./public/cosmicflow-html"
src_ltximg_dir="./public/cosmicflow-html/ltximg"
# Copy relavent pics to blog subdirectories
./copy-pics.sh
# Loop through each subdirectory
for dir in "$src_dir"/*; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
dst_ltximg_dir="${src_dir}/${dir_name}/ltximg"
# Create the destination subdirectory if it doesn't exist
if [ ! -d "$dst_ltximg_dir" ]; then
mkdir -p "$dst_ltximg_dir"
fi
# Use rsync to copy files starting with the subdirectory name as prefix
rsync -av --include="$dir_name*" --exclude="*" "${src_ltximg_dir}/" "${dst_ltximg_dir}/"
fi
done
# Set the source and destination directories
src_dir="./public/cosmicflow-html"
src_pics_dir="./assets/pics/"
# Loop through each subdirectory
for dir in "$src_dir"/*; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
dst_pics_dir="${src_dir}/${dir_name}/pics"
# Create the destination subdirectory if it doesn't exist
if [ ! -d "$dst_pics_dir" ]; then
mkdir -p "$dst_pics_dir"
fi
# Use rsync to copy files starting with the subdirectory name as prefix
rsync -av --include="$dir_name*" --exclude="*" "${src_pics_dir}/" "${dst_pics_dir}/"
fi
done
# rm -rf ./content/ltximg/