#!/bin/bash set -euf -o pipefail #exit on fail, unset variables, file-globs/expansion and piping problems function finish { read -n 1 -s -r -p "Press any key to continue" } trap finish EXIT ROOTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" cd "$ROOTPATH" echo Running from "$ROOTPATH" #Create initial structure and data-set mkdir temp || true #in .gitignore . Make dir, ignore fail if exists for set -e mkdir -p "out/images" || true #in .gitignore . Make dir, ignore fail if exists for set -e rm -rf out/ cp -r static out cd temp #We loop over all projects several times, each stage of the generation. #Instead of doing one project fully at a time, creating one giant nested loop. #Administration first, the processing! PROJECTS=(laborejo patroneo vico fluajho argodejo) #The order here is the order on the page. Each of these gets its own entry. #Gather and update data for PROJECT in ${PROJECTS[*]} template do GIT="https://git.laborejo.org/lss/$PROJECT.git" echo "$GIT" if [ -d "$PROJECT" ]; then cd "$PROJECT" git pull cd .. else git clone "$GIT" fi done cd "$ROOTPATH" #reset for next step #Generate Menu. n^2 loop. For each project all projects for PROJECT in ${PROJECTS[*]} do echo "" > "temp/$PROJECT/module_menu" #empty file #Index/Home is the same for all sub-pages. index is not included in the list so we do not care about the "this is the current page" highlight here. echo "