#!/bin/bash set -e GREEN='\033[0;32m' YELLOW='\033[1;33m' CYAN='\033[0;36m' RESET='\033[0m' DEBUG=false UPLOAD=false CLEAN=false usage() { echo "Usage: $(basename "$0") [-d] [-u] [-c] [-h]" echo "" echo "Options:" echo " -d Debug build (adds -debug flag to odin)" echo " -u Upload HTML to webserver after build" echo " -c Clean old HTML files before generating" echo " -h Show this help message" exit 0 } while getopts "duch" opt; do case $opt in d) DEBUG=true ;; u) UPLOAD=true ;; c) CLEAN=true ;; h) usage ;; *) usage ;; esac done if $CLEAN; then echo -e "${YELLOW}[INFO]${RESET} Removing old HTML files..." find /Users/simon/website_backup/NEW/HTML -type f -name "*.html" -delete echo -e "${GREEN}[ OK ]${RESET} Old HTML removed" fi if $DEBUG; then echo -e "${CYAN}[INFO]${RESET} Debug build" odin build . -debug else echo -e "${CYAN}[INFO]${RESET} Release build" odin build . -o:speed fi echo -e "${GREEN}[ OK ]${RESET} Build complete" ./cm -dir="/Users/simon/website_backup/NEW/" -out="/Users/simon/website_backup/NEW/HTML" echo -e "${GREEN}[ OK ]${RESET} HTML generated" if $UPLOAD; then echo -e "${YELLOW}[INFO]${RESET} Uploading to server..." rsync -aP /Users/simon/website_backup/NEW/HTML/* root@www.simonkellet.xyz:/var/www/cabin/ echo -e "${GREEN}[ OK ]${RESET} Upload complete" fi