Add usage and feature documentation to tools.func
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled

Added detailed comments at the top of misc/tools.func describing its purpose, key features, and usage examples. This improves clarity for maintainers and users of the helper functions.
This commit is contained in:
CanbiZ 2025-11-04 13:54:43 +01:00
parent 175df9e847
commit 03fb8e2da3

View File

@ -3,6 +3,32 @@
# ============================================================================== # ==============================================================================
# HELPER FUNCTIONS FOR PACKAGE MANAGEMENT # HELPER FUNCTIONS FOR PACKAGE MANAGEMENT
# ============================================================================== # ==============================================================================
#
# This file provides unified helper functions for robust package installation
# and repository management across Debian/Ubuntu OS upgrades.
#
# Key Features:
# - Automatic retry logic for transient APT/network failures
# - Unified keyring cleanup from all 3 locations
# - Legacy installation cleanup (nvm, rbenv, rustup)
# - OS-upgrade-safe repository preparation
# - Service pattern matching for multi-version tools
#
# Usage in install scripts:
# source /dev/stdin <<< "$FUNCTIONS" # Load from build.func
# prepare_repository_setup "mysql"
# install_packages_with_retry "mysql-server" "mysql-client"
#
# Quick Reference (Core Helpers):
# cleanup_tool_keyrings() - Remove keyrings from all 3 locations
# stop_all_services() - Stop services by pattern (e.g. "php*-fpm")
# verify_tool_version() - Validate installed version matches expected
# cleanup_legacy_install() - Remove nvm, rbenv, rustup, etc.
# prepare_repository_setup() - Cleanup repos + keyrings + validate APT
# install_packages_with_retry() - Install with 3 retries and APT refresh
# upgrade_packages_with_retry() - Upgrade with 3 retries and APT refresh
#
# ==============================================================================
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Cache installed version to avoid repeated checks # Cache installed version to avoid repeated checks