fix fork script

This commit is contained in:
CanbiZ 2025-12-08 17:34:40 +01:00
parent 63b9f8a8c1
commit 16a50615f9
2 changed files with 120 additions and 114 deletions

View File

@ -113,39 +113,45 @@ update_links() {
print_info "Scanning for hardcoded links..."
# Find all markdown and shell files
local -a files_to_update=(
"docs/DEFAULTS_SYSTEM_GUIDE.md"
"docs/alpine-install.func.md"
"docs/install.func.md"
"docs/APP-install.md"
"docs/APP-ct.md"
"docs/CONTRIBUTION_GUIDE.md"
"docs/INDEX.md"
"docs/README.md"
"docs/EXIT_CODES.md"
"docs/api/README.md"
)
# Update ALL shell scripts and markdown files that contain the repo URL
# This includes ct/, install/, misc/, vm/, tools/, docs/
echo ""
for file in "${files_to_update[@]}"; do
# Find all .sh files and update them
while IFS= read -r -d '' file; do
if [[ -f "$file" ]]; then
# Count occurrences
local count=$(grep -c "github.com/$old_repo/$old_name" "$file" 2>/dev/null || echo 0)
# Count occurrences of the old repo URL
local count=$(grep -c "community-scripts/ProxmoxVED" "$file" 2>/dev/null || echo 0)
if [[ $count -gt 0 ]]; then
# Backup original
cp "$file" "$file.backup"
# Replace links
# Replace all variations of the URL
sed -i "s|github.com/$old_repo/$old_name|github.com/$new_owner/$new_repo|g" "$file"
sed -i "s|raw.githubusercontent.com/$old_repo/$old_name|raw.githubusercontent.com/$new_owner/$new_repo|g" "$file"
((files_updated++))
print_success "Updated $file ($count links)"
fi
fi
done
done < <(find . -type f \( -name "*.sh" -o -name "*.func" \) -not -path "./.git/*" -print0)
# Also update markdown docs
while IFS= read -r -d '' file; do
if [[ -f "$file" ]]; then
local count=$(grep -c "community-scripts/ProxmoxVED" "$file" 2>/dev/null || echo 0)
if [[ $count -gt 0 ]]; then
sed -i "s|github.com/$old_repo/$old_name|github.com/$new_owner/$new_repo|g" "$file"
sed -i "s|raw.githubusercontent.com/$old_repo/$old_name|raw.githubusercontent.com/$new_owner/$new_repo|g" "$file"
((files_updated++))
print_success "Updated $file ($count links)"
fi
fi
done < <(find ./docs -type f -name "*.md" -print0 2>/dev/null)
echo ""
echo "Total files updated: $files_updated"
return $files_updated
}
@ -269,7 +275,7 @@ fi
# Show what we'll do
echo -e "${BLUE}Configuration Summary:${NC}"
echo " Repository URL: https://github.com/$USERNAME/$REPO_NAME"
echo " Files to update: 10 files with documentation"
echo " Directories to scan: ct/, install/, misc/, vm/, tools/, docs/"
echo ""
# Ask for confirmation