Repository navigation
Refactor chr_install.sh with improved error handling and UX - #16
Merged
Merged
Conversation
…rsions - Quote all variables; validate version, VM ID and image size inputs - Use exit 1 (via die helper) for error paths instead of exit 0 - Derive Proxmox node name from hostname instead of hardcoding 'pve' - Check results of wget/unzip/qemu-img/qm and clean up on failure (trap) - Fetch current Long-term and Stable RouterOS releases and offer as default - Use conventional disk-0 naming and configurable VM defaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Significantly refactored the MikroTik CHR installation script to improve robustness, user experience, and code maintainability. The script now includes proper error handling, automatic RouterOS version detection, and better validation throughout the deployment process.
Key Changes
set -euo pipefailand adie()helper function for consistent error reporting and early exit on failuresfetch_channel()function to automatically look up current Long-term and Stable RouterOS releases from MikroTik, with sensible defaultsread -rfor safer input handlingTEMP_DIR,MIKROTIK_DL) and improved quoting throughout for safetyvm-$vmID-disk-1.qcow2tovm-$vmID-disk-0.qcow2for consistency with Proxmox conventionsVM_MEMORY,VM_SOCKETS,VM_CORES,VM_BRIDGE,VM_STORAGE) at the top for easy customizationNotable Implementation Details
-pflag to handle existing directories safelyhttps://claude.ai/code/session_016rtazH8tiWw4fqCuLcEPFC