homebrew-fonts/iterate.sh
2024-09-27 12:28:56 -05:00

47 lines
No EOL
1.1 KiB
Bash

#!/bin/zsh
mydir=$(dirname "$0")
# Define the absolute path to the prep script
PREP_SCRIPT="$(cd "$(dirname "$0")" && pwd)/prep 1 font.sh"
#activate python environment
source "$mydir"/.env/bin/activate
#move orphans before we do anything else
python3 "$mydir"/orphans.py
# Check if the prep script exists
if [[ ! -f "$PREP_SCRIPT" ]]; then
echo "Prep script not found: $PREP_SCRIPT"
exit 1
fi
# Ensure the prep script is executable
chmod u+x "$PREP_SCRIPT"
# Check if the prep script is executable
if [[ ! -x "$PREP_SCRIPT" ]]; then
echo "Prep script not executable: $PREP_SCRIPT"
exit 1
fi
# Define the absolute path to the font_files directory
FONT_FILES_DIR="$(cd "$(dirname "$0")" && pwd)/font_files"
# Check if the font_files directory exists
if [[ ! -d "$FONT_FILES_DIR" ]]; then
echo "font_files directory not found: $FONT_FILES_DIR"
exit 1
fi
# Iterate over each folder in font_files
for folder in "$FONT_FILES_DIR"/*; do
if [[ -d "$folder" ]]; then
cd "$folder" || continue
zsh "$PREP_SCRIPT"
cd ..
else
echo "No such directory: $folder"
fi
done