universalisos/fix_naming.sh

75 lines
3.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# fix_naming.sh — correction pass for naming errors
set -euo pipefail
DST="/home/fabiorafaelcoutada/portugalfuturista/universalisos/pikeos-rebrand"
echo "=== Fix 1: universalisos.com → portugalfuturista.org ==="
FIX1=0
while IFS= read -r -d '' f; do
mime=$(file --mime-type -b "$f" 2>/dev/null)
case "$mime" in
text/*|application/json|application/xml|application/javascript|application/x-shellscript|application/x-perl|application/x-python*)
if grep -q 'universalisos\.com' "$f" 2>/dev/null; then
sed -i 's/universalisos\.com/portugalfuturista.org/g' "$f"
FIX1=$((FIX1 + 1))
fi
;;
esac
done < <(find "$DST" -type f -not -path "*/log/BUILD-LOGS/*" -print0)
echo " Fixed $FIX1 files"
echo "=== Fix 2: UniversalISOS → UniversalisOS ==="
FIX2=0
while IFS= read -r -d '' f; do
mime=$(file --mime-type -b "$f" 2>/dev/null)
case "$mime" in
text/*|application/json|application/xml|application/javascript|application/x-shellscript|application/x-perl|application/x-python*)
if grep -q 'UniversalISOS' "$f" 2>/dev/null; then
sed -i 's/UniversalISOS/UniversalisOS/g' "$f"
FIX2=$((FIX2 + 1))
fi
;;
esac
done < <(find "$DST" -type f -not -path "*/log/BUILD-LOGS/*" -print0)
echo " Fixed $FIX2 files"
echo "=== Fix 3: Java package com.universalisos → com.portugalfuturista.aurelio ==="
find "$DST/share/xsd" -type f -name '*.xsd' -exec sed -i \
's/com\.universalisos\.universalisos\./com.portugalfuturista.aurelio./g' {} +
echo " Done"
echo "=== Fix 4: Author emails ==="
sed -i 's/bre@universalisos\.com/bre@portugalfuturista.org/g; s/azu@universalisos\.com/azu@portugalfuturista.org/g' \
"$DST/share/hwvirt-linux/universalisos/p4bus-vmchar.c" \
"$DST/share/hwvirt-linux/universalisos/p4bus-vmnet.c" \
"$DST/share/hwvirt-linux/universalisos/p4bus-vmtty.c" \
"$DST/share/hwvirt-linux/universalisos/vmm-earlycon.c"
echo " Done"
echo "=== Fix 5: File/directory names with UniversalISOS ==="
FIX5=0
while IFS= read -r -d '' item; do
parent=$(dirname "$item")
base=$(basename "$item")
new=$(echo "$base" | sed 's/UniversalISOS/UniversalisOS/g')
if [[ "$base" != "$new" ]]; then
mv "$item" "$parent/$new"
FIX5=$((FIX5 + 1))
fi
done < <(find "$DST" -iname '*UniversalISOS*' -depth -print0 2>/dev/null)
echo " Renamed $FIX5 items"
echo ""
echo "=== Verification ==="
echo "universalisos.com remaining: $(grep -rIl 'universalisos\.com' "$DST" 2>/dev/null | grep -v 'build/log/' | wc -l)"
echo "UniversalISOS remaining: $(grep -rIl 'UniversalISOS' "$DST" 2>/dev/null | grep -v 'build/log/' | wc -l)"
echo "com.universalisos remaining: $(grep -rIl 'com\.universalisos' "$DST" 2>/dev/null | grep -v 'build/log/' | wc -l)"
echo ""
echo "=== Spot checks ==="
grep 'portugalfuturista.org' "$DST/rpm/buildenv-provides/buildenv-provides.spec.in" | head -2
grep 'UniversalisOS' "$DST/share/boot/bs.diskimage" | head -2
grep 'com.portugalfuturista.aurelio' "$DST/share/xsd/prj/project-5.1.xsd" | head -2
grep 'portugalfuturista.org' "$DST/share/hwvirt-linux/universalisos/vmm-earlycon.c" | head -2
echo ""
echo "=== Fix complete ==="