fix fork script
This commit is contained in:
parent
63b9f8a8c1
commit
16a50615f9
@ -113,39 +113,45 @@ update_links() {
|
|||||||
|
|
||||||
print_info "Scanning for hardcoded links..."
|
print_info "Scanning for hardcoded links..."
|
||||||
|
|
||||||
# Find all markdown and shell files
|
# Update ALL shell scripts and markdown files that contain the repo URL
|
||||||
local -a files_to_update=(
|
# This includes ct/, install/, misc/, vm/, tools/, docs/
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo ""
|
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
|
if [[ -f "$file" ]]; then
|
||||||
# Count occurrences
|
# Count occurrences of the old repo URL
|
||||||
local count=$(grep -c "github.com/$old_repo/$old_name" "$file" 2>/dev/null || echo 0)
|
local count=$(grep -c "community-scripts/ProxmoxVED" "$file" 2>/dev/null || echo 0)
|
||||||
|
|
||||||
if [[ $count -gt 0 ]]; then
|
if [[ $count -gt 0 ]]; then
|
||||||
# Backup original
|
# Replace all variations of the URL
|
||||||
cp "$file" "$file.backup"
|
|
||||||
|
|
||||||
# Replace links
|
|
||||||
sed -i "s|github.com/$old_repo/$old_name|github.com/$new_owner/$new_repo|g" "$file"
|
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++))
|
((files_updated++))
|
||||||
print_success "Updated $file ($count links)"
|
print_success "Updated $file ($count links)"
|
||||||
fi
|
fi
|
||||||
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
|
return $files_updated
|
||||||
}
|
}
|
||||||
@ -269,7 +275,7 @@ fi
|
|||||||
# Show what we'll do
|
# Show what we'll do
|
||||||
echo -e "${BLUE}Configuration Summary:${NC}"
|
echo -e "${BLUE}Configuration Summary:${NC}"
|
||||||
echo " Repository URL: https://github.com/$USERNAME/$REPO_NAME"
|
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 ""
|
echo ""
|
||||||
|
|
||||||
# Ask for confirmation
|
# Ask for confirmation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user