* Enhance setup-fork.sh with --full mode and misc/ targeting Added a new --full flag to setup-fork.sh to allow updating all files, not just those in misc/. Updated documentation and usage examples to clarify the new behavior. Improved file search and replacement logic for broader compatibility and flexibility. * add AI.md * fix links in AI.md * Update contribution docs and templates for best practices Refreshed AI.md with new reference scripts, expanded checklist, and improved AI assistant tips. Updated container and install script templates for modern defaults (Debian 13, larger disk, two tags), clarified helper function usage, and improved update/backup patterns. Enhanced JSON template with realistic metadata, new fields, and example notes. * Update fetch_and_deploy_gh_release usage in docs and templates Standardize the usage of fetch_and_deploy_gh_release by specifying all arguments, including mode, version, and target directory, in AI.md and template scripts. This clarifies the function's usage and ensures consistency across documentation and install/update templates. * Revise contribution docs and update CT template Expanded and clarified contribution documentation for forking, local development, cherry-picking, and AI-assisted code generation. Improved explanations for setup-fork.sh, local testing, and PR submission. Enhanced the container script template with detailed comments, clearer update_script structure, and step-by-step guidance for maintainers and contributors. * Update fork and release instructions in contribution docs Replaced placeholder GitHub repo references with 'YourUsername/YourRepo' throughout documentation for clarity. Expanded explanations in FORK_SETUP.md and README.md to clarify the difference between development and production script execution, and emphasized the importance of cherry-picking only relevant files for PRs. Updated install script template examples to use the new repo placeholder. * Update GitHub repo placeholders in docs and templates Replaced 'YourUsername/YourRepo' with 'owner/repo' in documentation and template scripts for consistency and clarity. This change standardizes example usage and reduces confusion for contributors. * Move user submitted guides to guides directory Renamed USER_SUBMITTED_GUIDES.md from docs/contribution to docs/guides for improved documentation organization. * Update contribution docs for improved workflow and clarity Revised multiple documentation files to clarify the recommended development workflow: contributors must test scripts via curl from their GitHub fork (not local bash), use setup-fork.sh for URL rewriting, and submit only new files using cherry-pick. Expanded and modernized install and JSON metadata template guides, emphasizing use of helper functions, resource requirements, and the JSON generator tool. Added detailed step-by-step instructions, best practices, and updated examples throughout. * Update contribution docs for new file structure Updated documentation to reflect the migration of install scripts from install_scripts/ to install/, and JSON metadata from config/ to frontend/public/json/. Adjusted all relevant paths, instructions, and examples to match the new directory structure for improved clarity and consistency. * Update contribution docs for fork setup and metadata Revised documentation to standardize use of 'bash docs/contribution/setup-fork.sh --full' for fork configuration, clarified install script execution flow, and updated JSON metadata template and field references. Improved helper function docs, resource requirements, and category lists. Updated references and instructions throughout for consistency and accuracy. * Docs: add GPU/TUN, update endpoints & tool refs Documentation updates across guides and function references: - Added var_gpu and var_tun configuration entries to CONFIGURATION_REFERENCE (GPU passthrough and TUN/TAP support), including features and prerequisites. - Fixed repository URLs throughout UNATTENDED_DEPLOYMENTS and examples: replaced community-scripts/ProxmoxVED with community-scripts/ProxmoxVE and updated curl usage to the new paths. - Added an "Advanced Configuration Variables" table and examples (var_os, var_version, var_gpu, var_tun, var_nesting) to UNATTENDED_DEPLOYMENTS; adjusted sample apps, hostnames, and container mappings in batch examples. - Switched API endpoints in API_FUNCTIONS_REFERENCE and API_USAGE_EXAMPLES from http://api.community-scripts.org to https://api.community-scripts.org. - Expanded BUILD_FUNC_FUNCTIONS_REFERENCE with container resource/ID management helper descriptions (validate_container_id, get_valid_container_id, maxkeys_check, get_current_ip, update_motd_ip). - Large edits to TOOLS_FUNC_FUNCTIONS_REFERENCE: renamed/refactored helper signatures and docs (pkg_install -> install_packages_with_retry, pkg_update -> upgrade_packages_with_retry), added new tooling functions (fetch_and_deploy_gh_release, check_for_gh_release, prepare_repository_setup, verify_tool_version) and updated examples and feature notes. - Updated vm/README.md to list additional VM scripts (new and reorganized examples). These are documentation-only changes to clarify configuration options, correct links and endpoints, and expand the reference material for tooling and build helpers. * Docs: expand developer/debugging and tools references Add extensive documentation and examples across contribution, guides, templates and tools references. Key changes: - Introduce a Developer Mode & Debugging section (dev_mode flags: trace, keep, pause, breakpoint, logs, dryrun, motd) in CONTRIBUTING.md with usage example. - Provide a standard update_script() pattern and BookStack example in GUIDE.md to clarify update flow (stop services, backup, deploy, restore, migrate, restart). - Add new helper entries (BookLore, KaraKeep) and advanced repository helpers (setup_deb822_repo, prepare_repository_setup, cleanup_tool_keyrings) plus utilities (setup_meilisearch, verify_tool_version) in HELPER_FUNCTIONS.md. - Update install template to suggest PNPM, Java 21 and Meilisearch; update example DB setup notes in AppName-install.sh. - Add var_diagnostics option and switch var_fuse to boolean/toggle wording in CONFIGURATION_REFERENCE.md; clarify privacy and defaults. - Adjust example container definitions in UNATTENDED_DEPLOYMENTS.md (container entries and resource values). - Change storage and flag variables and examples in BUILD_FUNC_USAGE_EXAMPLES.md (ssd-storage, var_fuse/var_tun, etc.). - Expand TOOLS_FUNC_FUNCTIONS_REFERENCE.md with many setup_* function signatures, environment vars, clarified fetch_and_deploy_gh_release modes/parameters, and additional tool docs (nodejs, php, mariadb_db, postgresql_db, java, uv, yq, meilisearch, composer, build tools). These updates improve onboarding, debugging guidance, and operational clarity for contributors and maintainers.
tools.func Documentation
Overview
The tools.func file provides a comprehensive collection of helper functions for robust package management, repository management, and tool installation in Debian/Ubuntu-based systems. It is the central hub for installing services, databases, programming languages, and development tools in containers.
Purpose and Use Cases
- Package Management: Robust APT/DPKG operations with retry logic
- Repository Setup: Prepare and configure package repositories safely
- Tool Installation: Install 30+ tools (Node.js, PHP, databases, etc.)
- Dependency Handling: Manage complex installation workflows
- Error Recovery: Automatic recovery from network failures
Quick Reference
Key Function Groups
- Package Helpers:
pkg_install(),pkg_update(),pkg_remove()- APT operations with retry - Repository Setup:
setup_deb822_repo()- Modern repository configuration - Tool Installation:
setup_nodejs(),setup_php(),setup_mariadb(), etc. - 30+ tool functions - System Utilities:
disable_wait_online(),customize()- System optimization - Container Setup:
setting_up_container(),motd_ssh()- Container initialization
Dependencies
- External:
curl,wget,apt-get,gpg - Internal: Uses functions from
core.func,install.func,error_handler.func
Integration Points
- Used by: All install scripts for dependency installation
- Uses: Environment variables from build.func and core.func
- Provides: Tool installation, package management, and repository services
Documentation Files
📊 TOOLS_FUNC_FLOWCHART.md
Visual execution flows showing package management, tool installation, and repository setup workflows.
📚 TOOLS_FUNC_FUNCTIONS_REFERENCE.md
Complete alphabetical reference of all 30+ functions with parameters, dependencies, and usage details.
💡 TOOLS_FUNC_USAGE_EXAMPLES.md
Practical examples showing how to use tool installation functions and common patterns.
🔗 TOOLS_FUNC_INTEGRATION.md
How tools.func integrates with other components and provides package/tool services.
🔧 TOOLS_FUNC_ENVIRONMENT_VARIABLES.md
Complete reference of environment variables and configuration options.
Key Features
Robust Package Management
- Automatic Retry Logic: 3 attempts with backoff for transient failures
- Silent Mode: Suppress output with
$STDvariable - Error Recovery: Automatic cleanup of broken packages
- Atomic Operations: Ensure consistent state even on failure
Tool Installation Coverage
- Node.js Ecosystem: Node.js, npm, yarn, pnpm
- PHP Stack: PHP-FPM, PHP-CLI, Composer
- Databases: MariaDB, PostgreSQL, MongoDB
- Development Tools: Git, build-essential, Docker
- Monitoring: Grafana, Prometheus, Telegraf
- And 20+ more...
Repository Management
- Deb822 Format: Modern standardized repository format
- Keyring Handling: Automatic GPG key management
- Cleanup: Removes legacy repositories and keyrings
- Validation: Verifies repository accessibility before use
Common Usage Patterns
Installing a Tool
setup_nodejs "20" # Install Node.js v20
setup_php "8.2" # Install PHP 8.2
setup_mariadb # Install MariaDB (distribution packages)
# MARIADB_VERSION="11.4" setup_mariadb # Specific version from official repo
Safe Package Operations
pkg_update # Update package lists with retry
pkg_install curl wget # Install packages safely
pkg_remove old-tool # Remove package cleanly
Setting Up Repositories
setup_deb822_repo "ppa:example/ppa" "example-app" "jammy" "http://example.com" "release"
Function Categories
🔹 Core Package Functions
pkg_install()- Install packages with retry logicpkg_update()- Update package lists safelypkg_remove()- Remove packages completely
🔹 Repository Functions
setup_deb822_repo()- Add repository in deb822 formatcleanup_repo_metadata()- Clean GPG keys and old reposcheck_repository()- Verify repository is accessible
🔹 Tool Installation Functions (30+)
Programming Languages:
setup_nodejs()- Node.js with npmsetup_php()- PHP-FPM and CLIsetup_python()- Python 3 with pipsetup_ruby()- Ruby with gemsetup_golang()- Go programming language
Databases:
setup_mariadb()- MariaDB serversetup_postgresql()- PostgreSQL databasesetup_mongodb()- MongoDB NoSQLsetup_redis()- Redis cache
Web Servers & Proxies:
setup_nginx()- Nginx web serversetup_apache()- Apache HTTP serversetup_caddy()- Caddy web serversetup_traefik()- Traefik reverse proxy
Containers & Virtualization:
setup_docker()- Docker container runtimesetup_podman()- Podman container runtime
Development & System Tools:
setup_git()- Git version controlsetup_docker_compose()- Docker Composesetup_composer()- PHP dependency managersetup_build_tools()- C/C++ compilation tools
Monitoring & Logging:
setup_grafana()- Grafana dashboardssetup_prometheus()- Prometheus monitoringsetup_telegraf()- Telegraf metrics collector
🔹 System Configuration Functions
setting_up_container()- Container initialization messagenetwork_check()- Verify network connectivityupdate_os()- Update OS packages safelycustomize()- Apply container customizationsmotd_ssh()- Configure SSH and MOTDcleanup_lxc()- Final container cleanup
Best Practices
✅ DO
- Use
$STDto suppress output in production scripts - Chain multiple tool installations together
- Check for tool availability before using
- Use version parameters when available
- Test new repositories before production use
❌ DON'T
- Mix package managers (apt and apk in same script)
- Hardcode tool versions directly
- Skip error checking on package operations
- Use
apt-get install -ywithout$STD - Leave temporary files after installation
Recent Updates
Version 2.0 (Dec 2025)
- ✅ Added
setup_deb822_repo()for modern repository format - ✅ Improved error handling with automatic cleanup
- ✅ Added 5 new tool installation functions
- ✅ Enhanced package retry logic with backoff
- ✅ Standardized tool version handling
Integration with Other Functions
tools.func
├── Uses: core.func (messaging, colors)
├── Uses: error_handler.func (exit codes, trapping)
├── Uses: install.func (network_check, update_os)
│
└── Used by: All install/*.sh scripts
├── For: Package installation
├── For: Tool setup
└── For: Repository management
Troubleshooting
"Package manager is locked"
# Wait for apt lock to release
sleep 10
pkg_update
"GPG key not found"
# Repository setup will handle this automatically
# If manual fix needed:
cleanup_repo_metadata
setup_deb822_repo ...
"Tool installation failed"
# Enable verbose output
export var_verbose="yes"
setup_nodejs "20"
Contributing
When adding new tool installation functions:
- Follow the
setup_TOOLNAME()naming convention - Accept version as first parameter
- Check if tool already installed
- Use
$STDfor output suppression - Set version file:
/opt/TOOLNAME_version.txt - Document in TOOLS_FUNC_FUNCTIONS_REFERENCE.md
Related Documentation
- build.func/ - Container creation orchestrator
- core.func/ - Utility functions and messaging
- install.func/ - Installation workflow management
- error_handler.func/ - Error handling and recovery
- UPDATED_APP-install.md - Application script guide
Last Updated: December 2025 Maintainers: community-scripts team License: MIT