pyt_services/onelineinstall_crafter Routines Documentation¶
Overview¶
The onelineinstall_crafter module provides automated generation of one-liner installation packages for Linux software deployment. It creates self-contained installers that can be executed with a single bash command to deploy complex software stacks remotely.
Core Functions¶
generate(config: str)¶
Purpose: Generates a complete installation package from a configuration file.
Parameters: - config: Path to PackageConfig YAML/JSON file defining the software package
Generated Artifacts: - get.sh: Main installation script (one-liner deployable) - updater-{software_name}.sh: Automatic update script - updater-{software_name}.cronwrapper.sh: Cron-compatible update wrapper - {software_name}-package.tar.gz: Compressed package archive - Cloud-hosted URLs for remote access
Algorithm: 1. Validates PackageConfig specification 2. Resolves dependencies and provider scripts 3. Creates package archive with all components 4. Uploads to cloud storage for global access 5. Generates executable installation scripts
Configuration Model¶
PackageConfig(BaseModel)¶
YAML/JSON Schema:
software_name: "my-app"
swmodule_provider: "scripts/get_package.sh#get_remote_package"
swmodule_io_dependencies: "scripts/deps.sh#get_io_deps"
version_provider: "scripts/version.sh#get_version"
install_worker: "scripts/installer.sh#install_app#param1#param2"
uninstall_script_builder: "scripts/installer.sh#build_uninstall_script"
global_install_script: "scripts/global_setup.sh"
auto_update: true
explicit_getsh_url: "https://example.com/get.sh"
Field Definitions: - software_name: Application identifier - swmodule_provider: Script to fetch package from remote source - swmodule_io_dependencies: Handle input/output dependencies - version_provider: Retrieve current/latest version information - install_worker: Main installation logic and commands - uninstall_script_builder: Generate uninstall scripts - global_install_script: Optional system-wide setup - auto_update: Enable automatic updates via cron - explicit_getsh_url: Override for cloud-hosted get.sh
Helper Functions¶
re_find_bash_dependencies(content: str)¶
Purpose: Extracts bash script dependencies (sourced files).
Algorithm: Uses regex patterns to identify . and source statements.
Example:
Returns: ['/path/to/utils.sh', 'common.sh']
validate_provider(spec: str, main_path: str, provider_name: str) -> tuple¶
Purpose: Validates provider specifications and resolves file paths.
Parameters: - spec: Format "script.sh#function_name#param1#param2" - main_path: Base directory for relative path resolution - provider_name: Provider type name for error reporting
Returns: (file_path, function_name, parameters[], dependencies[], attachments)
Generated Script Types¶
get.sh (Main Installer)¶
Purpose: One-liner executable that performs complete installation.
Features: - System dependency resolution - Package download and validation - Installation execution - Cleanup and verification - Automatic updater setup
Execution:
updater-{software}.sh (Auto-Updater)¶
Purpose: Checks for and applies software updates.
Features: - Version comparison - Safe update process - Rollback on failure - Cron integration support
Typical Usage: - Run manually: ./updater-myapp.sh - Scheduled: Via cron with provided wrapper
Deployment Architecture¶
Cloud Integration¶
Bucket Service: Uses Google Cloud Storage or AWS S3 equivalents Security: Signed URLs with time-limited access Global Access: CDN-backed distribution worldwide
Package Structure¶
{software_name}/
├── get.sh (main installer)
├── updater-{software}.sh
├── updater-{software}.cronwrapper.sh
├── {software_name}-package.tar.gz (cloud-hosted)
└── onelineinstaller-deps/
├── swmodule_provider.sh
├── version_provider.sh
├── install_worker.sh
├── uninstall_script_builder.sh
└── commons.sh
Advanced Features¶
Attach External Files¶
Syntax: Use EXT_F: prefix for external file parameters
Example:
Software Module Files¶
Syntax: Use SWMOD_F: prefix for package-relative files
Example:
Parameter Arrays¶
Syntax: Use @: prefix for comma/semicolon separated arrays
Example:
Error Handling¶
Validation Layers: - Configuration schema validation - File existence checks - Bash syntax validation - Function existence verification - Cloud upload error recovery
Graceful Degradation: - Optional provider fallback - Dependency resolution warnings - Safe cleanup on failure
Use Cases¶
1. Personal Project Deployment¶
software_name: "my-cli-tool"
swmodule_provider: "scripts/github_release.sh#get_latest_release"
version_provider: "scripts/github_api.sh#get_version"
install_worker: "scripts/setup.sh#install_binary"
curl https://my-url.com/get.sh | bash 2. Complex Application Stack¶
software_name: "my-web-app"
swmodule_provider: "scripts/docker_pull.sh#get_containers"
swmodule_io_dependencies: "scripts/network.sh#configure_ports"
install_worker: "scripts/docker_compose.sh#spin_up_stack"
uninstall_script_builder: "scripts/cleanup.sh#build_uninstall"
auto_update: true
3. Multi-Platform Binary Distribution¶
software_name: "cross-platform-app"
swmodule_provider: "scripts/platform_detect.sh#get_platform_package#EXT_F:./platform_matrix.txt"
install_worker: "scripts/native_install.sh#install_package"
Dependencies¶
Required Packages: - pydantic - boto3 / google-cloud-storage - bashlex - yaml/json
Infrastructure: - Cloud storage account (GCS/AWS) - SSH access to MkDocs server (optional)
Performance Considerations¶
- Package Size: Optimized compression and deduplication
- Download Speed: CDN-backed global distribution
- Installation Time: Parallel dependency resolution
- Update Frequency: Configurable cron intervals with jitter
This module transforms complex software deployment into automated, one-click installation experiences, suitable for both personal projects and enterprise distribution.