universalisos/rebrand_docs.sh

95 lines
3.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Phase 1.4: Documentation Rebranding
# Replaces PikeOS/SYSGO references in documentation with UniversalisOS/Portugal Futurista
set -euo pipefail
BASE="/home/fabiorafaelcoutada/portugalfuturista/universalisos"
DOCS="$BASE/docs-extracted"
WEBSITE_DOCS="$BASE/website/docs"
echo "=== Phase 1.4: Documentation Rebranding ==="
# Rebrand docs-extracted markdown files
echo ">>> Rebranding docs-extracted/ ..."
REBRAND_COUNT=0
while IFS= read -r -d '' f; do
mime=$(file --mime-type -b "$f" 2>/dev/null)
case "$mime" in
text/*)
sed -i \
-e 's/\bPikeOS D5\.0\b/UniversalisOS D5.0/g' \
-e 's/\bPikeOS 5\.0\b/UniversalisOS 5.0/g' \
-e 's/\bPikeOS 4\.x\b/UniversalisOS 4.x/g' \
-e 's/\bPikeOS 4\.0\b/UniversalisOS 4.0/g' \
-e 's/\bPikeOS 4\.1\b/UniversalisOS 4.1/g' \
-e 's/\bPikeOS 4\.2\b/UniversalisOS 4.2/g' \
-e 's/\bPikeOS\b/UniversalisOS/g' \
-e 's/\bpikeos\b/universalisos/g' \
-e 's/\bPIKEOS\b/UNIVERSALISOS/g' \
-e 's/\bSYSGO AG\b/Portugal Futurista/g' \
-e 's/\bSYSGO\b/Portugal Futurista/g' \
-e 's/\bsysgo\.com\b/portugalfuturista.org/g' \
"$f"
REBRAND_COUNT=$((REBRAND_COUNT + 1))
;;
esac
done < <(find "$DOCS" -type f -name '*.md' -print0 2>/dev/null)
echo " docs-extracted/: $REBRAND_COUNT files"
# Rebrand website/docs markdown files
echo ">>> Rebranding website/docs/ ..."
WEBSITE_COUNT=0
while IFS= read -r -d '' f; do
mime=$(file --mime-type -b "$f" 2>/dev/null)
case "$mime" in
text/*)
sed -i \
-e 's/\bPikeOS D5\.0\b/UniversalisOS D5.0/g' \
-e 's/\bPikeOS 5\.0\b/UniversalisOS 5.0/g' \
-e 's/\bPikeOS 4\.x\b/UniversalisOS 4.x/g' \
-e 's/\bPikeOS 4\.0\b/UniversalisOS 4.0/g' \
-e 's/\bPikeOS 4\.1\b/UniversalisOS 4.1/g' \
-e 's/\bPikeOS 4\.2\b/UniversalisOS 4.2/g' \
-e 's/\bPikeOS\b/UniversalisOS/g' \
-e 's/\bpikeos\b/universalisos/g' \
-e 's/\bPIKEOS\b/UNIVERSALISOS/g' \
-e 's/\bSYSGO AG\b/Portugal Futurista/g' \
-e 's/\bSYSGO\b/Portugal Futurista/g' \
-e 's/\bsysgo\.com\b/portugalfuturista.org/g' \
"$f"
WEBSITE_COUNT=$((WEBSITE_COUNT + 1))
;;
esac
done < <(find "$WEBSITE_DOCS" -type f -name '*.md' -print0 2>/dev/null)
echo " website/docs/: $WEBSITE_COUNT files"
# Integrate docs-extracted into website/docs
echo ">>> Integrating docs-extracted into website/docs ..."
INTEGRATED=0
for subdir in "$DOCS"/*/; do
subdir_name=$(basename "$subdir")
# Skip if already exists in website/docs
if [[ ! -d "$WEBSITE_DOCS/$subdir_name" ]]; then
mkdir -p "$WEBSITE_DOCS/$subdir_name"
fi
while IFS= read -r -d '' f; do
fname=$(basename "$f")
if [[ ! -f "$WEBSITE_DOCS/$subdir_name/$fname" ]]; then
cp "$f" "$WEBSITE_DOCS/$subdir_name/$fname"
INTEGRATED=$((INTEGRATED + 1))
fi
done < <(find "$subdir" -type f -name '*.md' -print0 2>/dev/null)
done
echo " Integrated $INTEGRATED new doc files"
# Verification
echo "" | tee -a "$LOG"
echo "=== Verification ==="
REMAINING_PIKEOS=$(grep -rIl 'PikeOS\|pikeos\|PIKEOS' "$DOCS" "$WEBSITE_DOCS" 2>/dev/null | wc -l)
REMAINING_SYSGO=$(grep -rIl 'SYSGO' "$DOCS" "$WEBSITE_DOCS" 2>/dev/null | wc -l)
echo "Files still containing PikeOS: $REMAINING_PIKEOS"
echo "Files still containing SYSGO: $REMAINING_SYSGO"
echo ""
echo "=== Documentation rebrand complete ==="
echo "Total files rebranded: $((REBRAND_COUNT + WEBSITE_COUNT))"
echo "Files integrated: $INTEGRATED"