-
Notifications
You must be signed in to change notification settings - Fork 1
Refine workflow #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Refine workflow #106
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # initialize_env | ||
| Detect and expose common environment variables for other config-v2 modules | ||
|
|
||
| ## About | ||
| Provides helpers to detect system and project paths (BIN_ROOT, LIB_ROOT, WEB_ROOT, etc.), OS/release metadata (sourced from /etc/os-release and /etc/armbian-release), and runtime info (kernel, default network adapter, local IP/subnet). Intended to be sourced by callers; includes helpers to print or emit export lines suitable for eval. Keep side effects opt-in (INITIALIZE_AUTO) to avoid surprising behavior on source. | ||
|
|
||
| ## Usage | ||
| ~~~bash | ||
| Usage: initialize_env [help|-h|--help] | ||
|
|
||
| About: | ||
| The 'initialize_env' module provides environment detection utilities. | ||
|
|
||
| Commands: | ||
| help - Show this help message. | ||
|
|
||
| Notes: | ||
| - To set variables in the current shell: source this file and call _initialize_env_vars | ||
| - When executed, this file's test entrypoint verifies the environment and prints variables. | ||
| ~~~ | ||
|
|
||
| - Autogenerated from `./src/core/initialize/initialize_env.conf` and `./src/core/initialize/initialize_env.sh` |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # plexmediaserver | ||
| SDK/development tool to install, remove, or check the status of Plex Media Server via the official repository. Not intended for production use unless otherwise secured and configured. | ||
|
|
||
| ## About | ||
| This module enables quick setup, removal, and status checks for Plex Media Server on Armbian-based systems as part of SDK or workflow automation. It manages the official repository, GPG keys, and installation process. The module is best suited for development, testing, or controlled environments. Production usage is not recommended unless you have reviewed security and configuration. | ||
|
|
||
| ## Usage | ||
| ~~~bash | ||
| Usage: plexmediaserver <command> [options] | ||
|
|
||
| Commands: | ||
| install Install the Plex Media Server. | ||
| remove Remove the Plex Media Server. | ||
| status Check if the Plex Media Server is installed. | ||
| help Show this help message. | ||
|
|
||
| Examples: | ||
|
|
||
| plexmediaserver install | ||
| plexmediaserver remove | ||
| plexmediaserver status | ||
| plexmediaserver help | ||
|
|
||
| Notes: | ||
| - This script is intended for use with Armbian Config V2. | ||
| - It installs the Plex Media Server from the official repository. | ||
| - The server will be available on port 32400 by default. | ||
| - Ensure that you have the necessary permissions to run this script. | ||
| - Use 'sudo' if required to execute commands that need elevated privileges. | ||
| - Keep this help message up to date if commands change. | ||
| ~~~ | ||
|
|
||
| - Autogenerated from `./src/software/management/plexmediaserver.conf` and `./src/software/management/plexmediaserver.sh` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # webmin | ||
| Webmin setup and service control. | ||
|
|
||
| ## About | ||
| Provides installation removal service management and status checks for the Webmin web-based system administration tool. Supports enabling/disabling on boot and verifying service state. | ||
|
|
||
| ## Usage | ||
| ~~~bash | ||
| Usage: webmin <command> | ||
|
|
||
| Commands: | ||
| help - Show this help message | ||
| install - Install Webmin | ||
| remove - Remove Webmin | ||
| start - Start the Webmin service | ||
| stop - Stop the Webmin service | ||
| enable - Enable Webmin to start on boot | ||
| disable - Disable Webmin from starting on boot | ||
| status - Show the status of the Webmin service | ||
| check - Perform a basic check of Webmin | ||
|
|
||
| Examples: | ||
| # Install Webmin | ||
| webmin install | ||
|
|
||
| # Start Webmin | ||
| webmin start | ||
|
|
||
| # Check Webmin status | ||
| webmin status | ||
|
|
||
| Notes: | ||
| - Maintainer: @Tearran | ||
| - Author: @Tearran | ||
| - Status: Active | ||
| - Documentation: https://webmin.com/docs/ | ||
| - Port: 10000 | ||
| - Supported Architectures: x86-64 arm64 armhf | ||
| - Group: Management | ||
| ~~~ | ||
|
|
||
| - Autogenerated from `./src/software/management/webmin.conf` and `./src/software/management/webmin.sh` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # promote_staged_module - Configng V2 metadata | ||
|
|
||
| [promote_staged_module] | ||
| # Main feature provided by this module (usually the same as the module name). | ||
| feature=promote_staged_module | ||
|
|
||
| # Short, single-line summary describing what this module does. | ||
| description= | ||
|
|
||
| # Longer description with more details about the module's features or usage. | ||
| extend_desc= | ||
|
|
||
| # Comma-separated list of commands supported by this module (e.g., help,status,reload). | ||
| options= | ||
|
|
||
| # Main category this module belongs to. Must be one of: network, system, software, locales. | ||
| parent= | ||
|
|
||
| # Group or tag for this module. See docs/readme.md (group index) for options. | ||
| # If none fit, suggest a new group in your pull request. | ||
| group= | ||
|
|
||
| # Contributor's GitHub username (use @username). | ||
| contributor= | ||
|
|
||
| # Comma-separated list of supported CPU architectures. | ||
| arch= | ||
|
|
||
| # Comma-separated list of supported operating systems. | ||
| require_os= | ||
|
|
||
| # What kernel are you using? (minimum required version, e.g., 5.15+) | ||
| require_kernel= | ||
|
|
||
| # Comma-separated list of network ports used by this module (e.g., 8080,8443). Use 'false' if not applicable. | ||
| port=false | ||
|
|
||
| # Comma-separated list of functions in this module (all functions except the main feature). | ||
| # NOTE: You must include the help message function _about_promote_staged_module; validation will fail if it is missing. | ||
| helpers= | ||
|
|
||
| # List each command and its description below. | ||
| # Example: | ||
| # show=Display the current configuration | ||
| [options] | ||
| help=Show help for this module | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # ./promote_staged_module.sh - Armbian Config V2 module | ||
|
|
||
| promote_staged_module() { | ||
| case "${1:-}" in | ||
| help|-h|--help) | ||
| _about_promote_staged_module | ||
| ;; | ||
| *) | ||
| _promote_staged_module_main | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| _promote_staged_module_main() { | ||
| for sh_file in ./staging/*.sh; do | ||
| [[ -f "$sh_file" ]] || continue | ||
| base_name="$(basename "$sh_file" .sh)" | ||
| conf_file="./staging/${base_name}.conf" | ||
| if [[ -f "$conf_file" ]]; then | ||
| parent="$(grep '^parent=' "$conf_file" | head -n1 | cut -d= -f2- | xargs)" | ||
| group="$(grep '^group=' "$conf_file" | head -n1 | cut -d= -f2- | xargs)" | ||
|
|
||
| if [[ -z "$parent" ]]; then | ||
| echo "No parent= in $conf_file, skipping $sh_file" | ||
| continue | ||
| fi | ||
|
|
||
| if [[ -n "$group" ]]; then | ||
| dest_dir="./src/$parent/$group" | ||
| else | ||
| dest_dir="./src/$parent" | ||
| fi | ||
| mkdir -p "$dest_dir" | ||
|
|
||
| echo "Moving $sh_file and $conf_file to $dest_dir/" | ||
| mv "$sh_file" "$dest_dir/" | ||
| mv "$conf_file" "$dest_dir/" | ||
|
|
||
| # Move any matching image files to the module destination directory | ||
| for ext in png jpg jpeg gif svg; do | ||
| img_file="./staging/${base_name}.${ext}" | ||
| if [[ -f "$img_file" ]]; then | ||
| echo "Moving image: $img_file to $dest_dir/" | ||
| mv "$img_file" "$dest_dir/" | ||
| fi | ||
| done | ||
|
Comment on lines
+54
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Protect against overwriting existing files. mv will overwrite silently. Safer: bail if a target already exists to avoid accidental clobbering. - echo "Moving $sh_file and $conf_file to $dest_dir/"
- mv "$sh_file" "$dest_dir/"
- mv "$conf_file" "$dest_dir/"
+ for f in "$sh_file" "$conf_file"; do
+ t="$dest_dir/$(basename "$f")"
+ if [[ -e "$t" ]]; then
+ echo "ERROR: Destination already contains $(basename "$f") at $dest_dir/. Aborting to prevent overwrite."
+ exit 1
+ fi
+ done
+ echo "Moving $sh_file and $conf_file to $dest_dir/"
+ mv "$sh_file" "$dest_dir/"
+ mv "$conf_file" "$dest_dir/"🤖 Prompt for AI Agents |
||
| else | ||
| echo "ERROR: No .conf file for $sh_file, cannot promote." | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| # Check for orphans | ||
| if [[ -d "./staging" ]]; then | ||
| if [[ -z "$(ls -A ./staging)" ]]; then | ||
| echo "Removing empty ./staging directory." | ||
| rmdir ./staging | ||
| else | ||
| echo "ERROR: Orphaned files left in ./staging after promotion!" | ||
| ls -l ./staging | ||
| exit 1 | ||
| fi | ||
| fi | ||
| } | ||
|
|
||
| _about_promote_staged_module() { | ||
| cat <<EOF | ||
| Usage: promote_staged_module <command> [options] | ||
|
|
||
| Commands: | ||
| test - Run a basic test of the promote_staged_module module | ||
| foo - Example 'foo' operation (replace with real command) | ||
| bar - Example 'bar' operation (replace with real command) | ||
| help - Show this help message | ||
|
|
||
| Examples: | ||
| # Run the test operation | ||
| promote_staged_module test | ||
|
|
||
| # Perform the foo operation with an argument | ||
| promote_staged_module foo arg1 | ||
|
|
||
| # Show help | ||
| promote_staged_module help | ||
|
|
||
| Notes: | ||
| - Replace 'foo' and 'bar' with real commands for your module. | ||
| - All commands should accept '--help', '-h', or 'help' for details, if implemented. | ||
| - Intended for use with the config-v2 menu and scripting. | ||
| - Keep this help message up to date if commands change. | ||
|
|
||
| EOF | ||
| } | ||
|
|
||
| ### START ./promote_staged_module.sh - Armbian Config V2 test entrypoint | ||
|
|
||
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
| # --- Capture and assert help output --- | ||
| help_output="$(promote_staged_module help)" | ||
| echo "$help_output" | grep -q "Usage: promote_staged_module" || { | ||
| echo "fail: Help output does not contain expected usage string" | ||
| echo "test complete" | ||
| exit 1 | ||
| } | ||
| # --- end assertion --- | ||
| promote_staged_module "$@" | ||
| fi | ||
|
|
||
| ### END ./promote_staged_module.sh - Armbian Config V2 test entrypoint | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Validate required conf fields before moving; fail fast on unknown parent path.
Per earlier workflow preferences, promotion should only occur for well-formed configs and known destinations to prevent silent tree pollution (e.g., typos creating new directories).
If you prefer, we can invoke the validator first and abort on any failures:
Say the word and I’ll wire this into the main path.
🤖 Prompt for AI Agents