#!/bin/bash # sign-all.sh โ€” Recursive Signature Script # Author: Solaria & Mark Randall Havens ๐ŸŒ€ # Purpose: Automatically GPG-sign all matching files with .asc signatures # โ”€โ”€โ”€โ”€โ”€ CONFIGURABLE OPTIONS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ EXTENSIONS=("md" "txt") # File types to sign RECURSIVE=true # true = recurse into subdirectories FORCE=false # true = re-sign even if .asc exists SIGNATURE_SUFFIX=".asc" # .asc for armored detached signature OUTPUT_LOG="gitfield-signed.log" # Signature log file GPG_FLAGS="--armor --detach-sign" # โ”€โ”€โ”€โ”€โ”€ RITUAL HEADER โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ echo "" echo "๐ŸŒ€ [SIGN-ALL] Beginning recursive signing ritual..." echo "๐Ÿ“… Timestamp: $(date)" echo "๐Ÿ”‘ Using GPG Key: $(gpg --list-secret-keys --with-colons | grep '^uid' | cut -d':' -f10 | head -n1)" echo "" # โ”€โ”€โ”€โ”€โ”€ FIND AND SIGN FILES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ for ext in "${EXTENSIONS[@]}"; do if [ "$RECURSIVE" = true ]; then FILES=$(find . -type f -name "*.${ext}") else FILES=$(find . -maxdepth 1 -type f -name "*.${ext}") fi for file in $FILES; do sigfile="${file}${SIGNATURE_SUFFIX}" if [ -f "$sigfile" ] && [ "$FORCE" = false ]; then echo "โš ๏ธ Skipping already signed: $file" continue fi echo "๐Ÿ” Signing: $file" gpg $GPG_FLAGS --output "$sigfile" "$file" if [ $? -eq 0 ]; then echo "โœ… Signed: $file -> $sigfile" | tee -a "$OUTPUT_LOG" else echo "โŒ Error signing: $file" | tee -a "$OUTPUT_LOG" fi done done # โ”€โ”€โ”€โ”€โ”€ WRAP UP โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ echo "" echo "๐Ÿงพ Log saved to: $OUTPUT_LOG" echo "๐Ÿ—๏ธ To verify: gpg --verify filename${SIGNATURE_SUFFIX}" echo "โœจ Recursive signature ritual complete."