Skip to content

Conversation

@igorpecovnik
Copy link
Member

@igorpecovnik igorpecovnik commented May 3, 2025

Description

OpenMediaVault (OMV) is a free and open-source NAS (Network-Attached Storage) operating system based on Debian Linux. It provides a web-based interface for managing storage devices, file sharing (via SMB, NFS, FTP, etc.), user permissions, and services like RAID, backups, and monitoring—making it ideal for home and small office servers.

Implementation Details

APT installation, to Bookworm only.

Testing Procedure

  • Tested install on Bookworm
  • CI finishes succesfully

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have ensured that my changes do not introduce new warnings or errors
  • No new external dependencies are included
  • Changes have been tested and verified
  • I have included necessary metadata in the code, including associative arrays

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 3, 2025

Warning

Rate limit exceeded

@igorpecovnik has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between dfa75a3 and f5f66a9.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)

"""

Walkthrough

A new shell module named module_omv has been added to manage OpenMediaVault (OMV) installation, removal, status checking, and help display on supported systems. The module includes metadata, usage examples, and command handlers for install, remove, status, and help commands. The installation process adds the OMV GPG key and repository with dynamic architecture specification, updates package lists, and installs the openmediavault package with options for configuration handling and downgrades. The removal command uninstalls the package if present, and the status command reports installation state. The module relies on helper functions for package management. Additionally, a new test configuration file tests/omv.conf has been added, defining a test case for the "bookworm" release that automates removal and installation of the module_omv, starts the openmediavault-engined.service, and verifies its active status, failing immediately on any command error. Two new markdown documentation files, OMV001-header.md and OMV001-footer.md, provide introductory and user guidance content for OMV, covering features, usage, plugins, and troubleshooting commands. Furthermore, two new software operation entries for installing and removing OpenMediaVault have been added under the "Media" category in tools/json/config.software.json, each conditioned on the current installation status of OMV. Finally, a line was added to update the "Software" → "Media" → "OMV002" submenu with a URL pointing to the OMV web interface using the local IP address and configured port.

Possibly related PRs

Suggested labels

ready to merge
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added 05 Milestone: Second quarter release size/medium PR with more then 50 and less then 250 lines Unit Tests labels May 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 5

🧹 Nitpick comments (4)
tools/modules/software/module_omv.sh (3)

32-38: Consider documenting the purpose of each installation flag.

The installation command uses several flags that might not be immediately clear to future maintainers.

Add comments explaining the purpose of each flag:

 pkg_install --yes --auto-remove --show-upgraded \
   --allow-downgrades --allow-change-held-packages \
   --no-install-recommends \
+  # Use default action for conffiles
   --option DPkg::Options::="--force-confdef" \
+  # Keep the old version of the conffile
   --option DPkg::Options::="--force-confold" \
   openmediavault

44-48: Consider enhancing the status check functionality.

The current status check only verifies if the package is installed but doesn't check if the service is running.

Enhance the status check to include service status:

 if pkg_installed openmediavault; then
-   echo "$title is installed."
+   echo "$title is installed."
+   if systemctl is-active --quiet openmediavault-engined.service; then
+     echo "OpenMediaVault service is running."
+   else
+     echo "OpenMediaVault service is not running."
+   fi
 else
   echo "$title is not installed."
 fi

1-1: Missing shebang in the script file.

The file is missing a shebang line which defines the shell interpreter to be used.

Add a shebang to the beginning of the file:

+#!/bin/bash
 module_options+=(
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/omv.conf (1)

7-10: Add more comprehensive testing for the module.

The current test only verifies installation and service start. Consider adding more test cases that verify all module functionalities.

Enhance the test to cover more functionality:

 	./bin/armbian-config --api module_omv remove
+	# Verify removal worked
+	if ./bin/armbian-config --api module_omv status | grep -q "not installed"; then
+		echo "Removal confirmed"
+	else
+		echo "Removal failed"
+		exit 1
+	fi
 	./bin/armbian-config --api module_omv install
+	# Verify installation worked
+	if ./bin/armbian-config --api module_omv status | grep -q "is installed"; then
+		echo "Installation confirmed"
+	else
+		echo "Installation failed"
+		exit 1
+	fi
 	sudo systemctl start openmediavault-engined.service
 	sleep 5
 	sudo systemctl is-active --quiet openmediavault-engined.service
+	# Final verification
+	echo "OpenMediaVault test completed successfully"
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 6-10: editorconfig-checker: Wrong indentation type (spaces instead of tabs) detected on lines 6-10.

🛑 Comments failed to post (5)
tools/modules/software/module_omv.sh (3)

22-28: 🛠️ Refactor suggestion

Consider using a more secure approach for adding the GPG key.

The current implementation downloads and imports the GPG key in one pipeline, which has security implications:

  1. The data passes through multiple processes
  2. No validation is performed before importing the key
  3. No specific timeout for the GPG operation

Consider using a more secure approach:

- curl --max-time 60 -4 -fsSL "https://packages.openmediavault.org/public/archive.key" | \
-   gpg --dearmor -o /usr/share/keyrings/openmediavault-archive-keyring.gpg
+ KEY_FILE=$(mktemp)
+ if curl --max-time 60 -4 -fsSL "https://packages.openmediavault.org/public/archive.key" -o "${KEY_FILE}"; then
+   gpg --dearmor -o /usr/share/keyrings/openmediavault-archive-keyring.gpg "${KEY_FILE}"
+   rm -f "${KEY_FILE}"
+ else
+   echo "Failed to download GPG key"
+   rm -f "${KEY_FILE}"
+   exit 1
+ fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			KEY_FILE=$(mktemp)
			if curl --max-time 60 -4 -fsSL "https://packages.openmediavault.org/public/archive.key" -o "${KEY_FILE}"; then
			  gpg --dearmor -o /usr/share/keyrings/openmediavault-archive-keyring.gpg "${KEY_FILE}"
			  rm -f "${KEY_FILE}"
			else
			  echo "Failed to download GPG key"
			  rm -f "${KEY_FILE}"
			  exit 1
			fi

			echo "Adding OMV sources.list..."
			echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
https://packages.openmediavault.org/public sandworm main" | \
				tee /etc/apt/sources.list.d/openmediavault.list
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh around lines 22 to 28, the current method of downloading and importing the GPG key uses a pipeline without validation or timeout for the GPG operation, which is insecure. To fix this, first download the key to a temporary file with curl using a timeout, then verify the key's integrity or fingerprint before importing it with gpg --dearmor, also applying a timeout or limiting the operation. Finally, move the verified key to /usr/share/keyrings/openmediavault-archive-keyring.gpg. This approach ensures the key is validated and the process is more secure.

41-41: 🛠️ Refactor suggestion

Add error handling for remove operation.

Similar to the installation process, the removal process doesn't check for failures.

Add error handling:

- pkg_remove openmediavault
+ if pkg_remove openmediavault; then
+   echo "OpenMediaVault removed successfully."
+ else
+   echo "Failed to remove OpenMediaVault."
+   exit 1
+ fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			if pkg_remove openmediavault; then
				echo "OpenMediaVault removed successfully."
			else
				echo "Failed to remove OpenMediaVault."
				exit 1
			fi
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh at line 41, the pkg_remove openmediavault command lacks error handling. Modify the script to check the exit status of the pkg_remove command and handle any failure appropriately, such as logging an error message and exiting or returning a failure code, similar to how errors are handled during the installation process.

33-38: 🛠️ Refactor suggestion

Add error handling for install operation.

The installation process doesn't check for failures and doesn't provide feedback to the user if installation fails.

Add error handling:

- pkg_install --yes --auto-remove --show-upgraded \
-   --allow-downgrades --allow-change-held-packages \
-   --no-install-recommends \
-   --option DPkg::Options::="--force-confdef" \
-   --option DPkg::Options::="--force-confold" \
-   openmediavault
+ if pkg_install --yes --auto-remove --show-upgraded \
+   --allow-downgrades --allow-change-held-packages \
+   --no-install-recommends \
+   --option DPkg::Options::="--force-confdef" \
+   --option DPkg::Options::="--force-confold" \
+   openmediavault; then
+     echo "OpenMediaVault installed successfully."
+ else
+     echo "Failed to install OpenMediaVault."
+     exit 1
+ fi
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh around lines 33 to 38, the pkg_install command lacks error handling and does not inform the user if the installation fails. Modify the script to check the exit status of the pkg_install command immediately after it runs. If the command fails (non-zero exit code), output an error message to the user indicating the failure and exit the script or handle the error appropriately to prevent silent failures.
tests/omv.conf (2)

5-11: 🛠️ Refactor suggestion

Add a waiting period before checking service status.

The test starts the OpenMediaVault service and immediately checks if it's active. However, services might take a moment to fully initialize.

Add a short waiting period between starting the service and checking its status:

 testcase() {(
	set -e
	./bin/armbian-config --api module_omv remove
	./bin/armbian-config --api module_omv install
	sudo systemctl start openmediavault-engined.service
+	# Wait for service to fully initialize
+	sleep 5
	sudo systemctl is-active --quiet openmediavault-engined.service
 )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

testcase() {(
        set -e
        ./bin/armbian-config --api module_omv remove
        ./bin/armbian-config --api module_omv install
        sudo systemctl start openmediavault-engined.service
        # Wait for service to fully initialize
        sleep 5
        sudo systemctl is-active --quiet openmediavault-engined.service
)}
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 6-10: editorconfig-checker: Wrong indentation type (spaces instead of tabs) detected on lines 6-10.

🤖 Prompt for AI Agents (early access)
In tests/omv.conf around lines 5 to 11, after starting the openmediavault-engined.service, insert a short delay (e.g., using sleep for a few seconds) before running the command that checks if the service is active. This ensures the service has enough time to initialize before the status check.

5-11: ⚠️ Potential issue

Fix indentation: replace spaces with tabs per coding style.

The pipeline failure indicates that lines 6-10 use spaces for indentation instead of tabs.

Replace spaces with tabs in the indented lines:

 testcase() {(
-        set -e
-        ./bin/armbian-config --api module_omv remove
-        ./bin/armbian-config --api module_omv install
-        sudo systemctl start openmediavault-engined.service
-        sudo systemctl is-active --quiet openmediavault-engined.service
+	set -e
+	./bin/armbian-config --api module_omv remove
+	./bin/armbian-config --api module_omv install
+	sudo systemctl start openmediavault-engined.service
+	sudo systemctl is-active --quiet openmediavault-engined.service
 )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

testcase() {(
	set -e
	./bin/armbian-config --api module_omv remove
	./bin/armbian-config --api module_omv install
	sudo systemctl start openmediavault-engined.service
	sudo systemctl is-active --quiet openmediavault-engined.service
)}
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 6-10: editorconfig-checker: Wrong indentation type (spaces instead of tabs) detected on lines 6-10.

🤖 Prompt for AI Agents (early access)
In tests/omv.conf around lines 5 to 11, the indentation uses spaces instead of tabs, which violates the coding style. Replace all leading spaces on lines 6 to 10 with tabs to fix the indentation and comply with the project's style guidelines.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🧹 Nitpick comments (2)
tools/modules/software/module_omv.sh (2)

52-60: Include Help Description for the help Command
The help block lists install, status, and remove, but doesn’t document help itself. For completeness, add a line describing the help command.
Apply this diff:

-			echo -e "\tremove\t- Remove $title."
-			echo
+			echo -e "\tremove\t- Remove $title."
+			echo -e "\thelp\t- Show this help message."
+			echo

61-64: Quote Invocation Arguments
Although this works with fixed strings, it’s safer to quote expansions to prevent word-splitting edge cases.
Apply this diff:

-			${module_options["module_omv,feature"]} ${commands[3]}
+			"${module_options["module_omv,feature"]}" "${commands[3]}"
🛑 Comments failed to post (4)
tools/modules/software/module_omv.sh (4)

1-12: ⚠️ Potential issue

Add a Shebang and Shell Directive
ShellCheck (SC2148) reports a missing shebang. To ensure the script runs under Bash and to avoid ambiguity about the target shell, add a shebang and a shell directive at the top of the file.
Apply this diff:

+#!/usr/bin/env bash
+# shellcheck shell=bash
 module_options+=(
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

#!/usr/bin/env bash
# shellcheck shell=bash

module_options+=(
	["module_omv,author"]="@igorpecovnik"
	["module_omv,maintainer"]="@igorpecovnik"
	["module_omv,feature"]="module_omv"
	["module_omv,example"]="install remove status help"
	["module_omv,desc"]="Install OpenMediaVault (OMV)"
	["module_omv,status"]="Active"
	["module_omv,doc_link"]="https://www.openmediavault.org/"
	["module_omv,group"]="NAS"
	["module_omv,port"]="80"
	["module_omv,arch"]="x86-64 arm64 armhf"
)
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh at the very beginning of the file (lines 1 to 12), add a shebang line specifying the Bash shell (e.g., #!/bin/bash) as the first line to explicitly define the script interpreter and avoid ShellCheck SC2148 warnings. This ensures the script runs under Bash and clarifies the intended shell environment.

40-44: ⚠️ Potential issue

Fix Indentation to Use Tabs
EditorConfig enforcement caught spaces instead of tabs on these lines. Align these lines with tabs to match the rest of the file.
Apply this diff (replace leading spaces with a single tab):

-            if pkg_installed openmediavault; then
-			    pkg_remove openmediavault
-            fi
+       if pkg_installed openmediavault; then
+	       pkg_remove openmediavault
+       fi

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 41-43: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh at lines 40 to 44, the indentation uses spaces instead of tabs, which violates the EditorConfig rules. Replace all leading spaces on these lines with tabs to ensure consistent indentation style throughout the file.

14-18: 🛠️ Refactor suggestion

Enable Immediate Failure on Errors
The module relies on command exit codes but doesn’t explicitly bail on failures. To make the script more robust and catch errors early, enable strict error handling at the start of the function.
Apply this diff:

 function module_omv() {
+   set -euo pipefail
     local title="openmediavault"
     local commands
     IFS=' ' read -r -a commands <<< "${module_options["module_omv,example"]}"
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh around lines 14 to 18, the function module_omv does not enable strict error handling, which can cause silent failures. Add "set -e" at the start of the function to make the script immediately exit on any command failure, ensuring errors are caught early and improving robustness.

19-39: ⚠️ Potential issue

Remove Unsupported --auto-remove Flag
apt-get install does not support --auto-remove. Passing this flag will cause an error. Remove it (and optionally the redundant --yes since pkg_install already uses -y).
Apply this diff:

-pkg_update
-
-echo "Installing OpenMediaVault packages..."
-pkg_install --yes --auto-remove --show-upgraded \
+pkg_update
+echo "Installing OpenMediaVault packages..."
+pkg_install --show-upgraded \
     --allow-downgrades --allow-change-held-packages \
     --no-install-recommends \
     --option DPkg::Options::="--force-confdef" \
     --option DPkg::Options::="--force-confold" \
     openmediavault
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	case "$1" in
		"${commands[0]}")
			echo "Adding GPG key for OpenMediaVault..."
			curl --max-time 60 -4 -fsSL "https://packages.openmediavault.org/public/archive.key" | \
				gpg --dearmor -o /usr/share/keyrings/openmediavault-archive-keyring.gpg

			echo "Adding OMV sources.list..."
			echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
https://packages.openmediavault.org/public sandworm main" | \
				tee /etc/apt/sources.list.d/openmediavault.list

			pkg_update
			echo "Installing OpenMediaVault packages..."
			pkg_install --show-upgraded \
				--allow-downgrades --allow-change-held-packages \
				--no-install-recommends \
				--option DPkg::Options::="--force-confdef" \
				--option DPkg::Options::="--force-confold" \
				openmediavault
		;;
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh between lines 19 and 39, the pkg_install command incorrectly includes the unsupported --auto-remove flag, which causes errors. Remove the --auto-remove flag from the pkg_install invocation, and optionally remove the redundant --yes flag since pkg_install already uses -y internally.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
tools/modules/software/module_omv.sh (4)

41-45: Correct indentation & improve feedback on removal
Lines 42–44 use spaces instead of tabs (editorconfig-checker errors). Also, if OMV isn’t installed, users get no feedback.

-    if pkg_installed openmediavault; then
-		    pkg_remove openmediavault
-            fi
+	if pkg_installed openmediavault; then
+		pkg_remove openmediavault
+	else
+		echo "openmediavault is not installed."
+	fi
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


46-52: Approve: status command logic is sound
The status subcommand correctly checks installation and prints a clear message.

Consider returning exit codes (0 if installed, 1 otherwise) for scripts that consume this output.


53-61: Refactor help output for readability
Multiple echo -e calls can be consolidated into a heredoc.

-			echo -e "\nUsage: ${module_options["module_omv,feature"]} <command>"
-			echo -e "Commands:  ${module_options["module_omv,example"]}"
-			echo "Available commands:"
-			echo -e "\tinstall\t- Install $title."
-			echo -e "\tstatus\t- Installation status $title."
-			echo -e "\tremove\t- Remove $title."
-			echo
+			cat <<EOF
+
+Usage: ${module_options["module_omv,feature"]} <command>
+Commands: ${module_options["module_omv,example"]}
+
+Available commands:
+	install	- Install $title.
+	status	- Show installation status of $title.
+	remove	- Remove $title.
+
+EOF

62-65: Simplify default fallback call
Instead of indirect expansion, use the function name directly for clarity.

-		${module_options["module_omv,feature"]} ${commands[3]}
+		"${FUNCNAME[0]}" help
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e7913d and cd1569c.

📒 Files selected for processing (2)
  • tests/omv.conf (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/omv.conf
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check
tools/modules/software/module_omv.sh

[error] 12-12: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

♻️ Duplicate comments (3)
tools/modules/software/module_omv.sh (3)

1-13: Add shebang and fix indentation errors

The script lacks a shebang (SC2148) and line 12 uses spaces instead of tabs, causing editorconfig failures. Please add #!/usr/bin/env bash at the top and convert the indentation on line 12 to tabs:

+#!/usr/bin/env bash
 module_options+=(
 ...
-    ["module_omv,release"]="bookworm"
+	["module_omv,release"]="bookworm"
 )
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check

[error] 12-12: editorconfig-checker: Wrong indentation type (spaces instead of tabs)


27-29: Use dynamic release variable instead of hardcoded codename

The APT source list hardcodes “sandworm” but the module’s default release is “bookworm”. To keep them in sync, capture the release and use it:

 function module_omv() {
     local title="openmediavault"
+    local release="${module_options["module_omv,release"]}"
     ...
-    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
-https://packages.openmediavault.org/public sandworm main" | \
+    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
+https://packages.openmediavault.org/public $release main" | \
         tee /etc/apt/sources.list.d/openmediavault.list

34-39: Remove unsupported pkg_install flags

pkg_install wraps apt-get -y install, so flags like --auto-remove and --show-upgraded aren’t valid for apt-get install and will fail. Please remove them:

-    DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-        --allow-downgrades --allow-change-held-packages \
-        --no-install-recommends \
-        --option DPkg::Options::="--force-confdef" \
-        --option DPkg::Options::="--force-confold" \
-        openmediavault
+    DEBIAN_FRONTEND=noninteractive pkg_install \
+        --allow-downgrades --allow-change-held-packages \
+        --no-install-recommends \
+        --option DPkg::Options::="--force-confdef" \
+        --option DPkg::Options::="--force-confold" \
+        openmediavault
🧹 Nitpick comments (2)
tools/modules/software/module_omv.sh (2)

54-61: Use portable printf instead of echo -e

Relying on echo -e is not portable across all shells. Consider switching to printf for escape sequences:

-    echo -e "\nUsage: ${module_options["module_omv,feature"]} <command>"
-    echo -e "Commands:  ${module_options["module_omv,example"]}"
+    printf "\nUsage: %s <command>\n" "${module_options["module_omv,feature"]}"
+    printf "Commands: %s\n" "${module_options["module_omv,example"]}"

62-64: Quote variable expansions in the default case

Unquoted expansions may break if values contain spaces. Wrap them in quotes:

-    ${module_options["module_omv,feature"]} ${commands[3]}
+    "${module_options["module_omv,feature"]}" "${commands[3]}"
🛑 Comments failed to post (1)
tools/modules/software/module_omv.sh (1)

42-44: ⚠️ Potential issue

Fix indentation in the remove block

Lines 42–44 use spaces instead of tabs, causing editorconfig-checker errors. Please replace these spaces with tabs to align with the rest of the file:

-            if pkg_installed openmediavault; then
-			    pkg_remove openmediavault
-            fi
+		if pkg_installed openmediavault; then
+			pkg_remove openmediavault
+		fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		if pkg_installed openmediavault; then
			pkg_remove openmediavault
		fi
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 42-44: editorconfig-checker: Wrong indentation type (spaces instead of tabs)

🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh around lines 42 to 44, the indentation uses spaces instead of tabs, causing editorconfig-checker errors. Replace the spaces at the start of these lines with tabs to match the file's indentation style and fix the formatting issue.

@igorpecovnik igorpecovnik force-pushed the omv branch 3 times, most recently from 37102e7 to bfbc4bb Compare May 3, 2025 21:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
tools/modules/software/module_omv.sh (3)

1-13: Duplicate: Add shebang and enforce shell interpreter
As flagged by ShellCheck SC2148, this script lacks a shebang. Add the following at the very top to specify the interpreter:

+#!/usr/bin/env bash
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


26-29: ⚠️ Potential issue

Hardcoded release codename mismatch
The OMV APT source uses sandworm, but the module’s release is declared as bookworm in module_options. This inconsistency may break repository setup.

Use the dynamic release value:

-echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
-https://packages.openmediavault.org/public sandworm main" | \
+local release="${module_options["module_omv,release"]}"
+echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
+https://packages.openmediavault.org/public $release main" | \
 tee /etc/apt/sources.list.d/openmediavault.list

34-39: ⚠️ Potential issue

Remove unsupported pkg_install flags
pkg_install wraps apt-get -y install, so flags like --auto-remove and --show-upgraded are invalid and will cause failures.

Refactor to:

-DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-    --allow-downgrades --allow-change-held-packages \
+DEBIAN_FRONTEND=noninteractive pkg_install \
+    --allow-downgrades --allow-change-held-packages \
     --no-install-recommends \
     --option DPkg::Options::="--force-confdef" \
     --option DPkg::Options::="--force-confold" \
🧹 Nitpick comments (1)
tools/json/config.software.json (1)

1485-1495: Nit: Consistent verb phrasing in description
The OMV002 description currently reads "OpenMediaVault remove". For consistency with other remove operations (e.g., "Remove Home Assistant"), consider changing it to "Remove OpenMediaVault".

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcf04ef and bfbc4bb.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/omv.conf
🚧 Files skipped from review as they are similar to previous changes (2)
  • tools/include/markdown/OMV001-footer.md
  • tools/include/markdown/OMV001-header.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check
tools/modules/software/module_omv.sh

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)
🔇 Additional comments (1)
tools/json/config.software.json (1)

1472-1484: Approve new install operation OMV001
The OMV001 entry correctly defines a stable install operation for OpenMediaVault, with all required fields (id, description, short, module, about, command, status, author, condition) and consistent formatting.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (4)
tools/modules/software/module_omv.sh (4)

42-44: ⚠️ Potential issue

Fix indentation to use tabs
EditorConfig requires tabs for indentation in shell scripts, but this block uses spaces. Convert leading spaces to tabs:

-            if pkg_installed openmediavault; then
-                pkg_remove openmediavault
-            fi
+           if pkg_installed openmediavault; then
+               pkg_remove openmediavault
+           fi

(Note: replace each group of spaces with a single tab character at line start.)

🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


1-13: 🛠️ Refactor suggestion

Add shebang and ensure proper script interpreter
ShellCheck SC2148 warns that the script has no shebang, making the target shell ambiguous. Add #!/usr/bin/env bash at the very top so the module runs under Bash.

Apply this diff:

+#!/usr/bin/env bash
 module_options+=(
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


27-29: ⚠️ Potential issue

Use dynamic release variable instead of hardcoded codename
The APT source list line hardcodes sandworm, which conflicts with the module_omv,release value (bookworm). To avoid mismatches, use the release variable:

- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
- https://packages.openmediavault.org/public sandworm main" | \
-  tee /etc/apt/sources.list.d/openmediavault.list
+ local release="${module_options["module_omv,release"]}"
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
+ https://packages.openmediavault.org/public $release main" | \
+  tee /etc/apt/sources.list.d/openmediavault.list

34-39: ⚠️ Potential issue

Remove unsupported flags from pkg_install invocation
pkg_install wraps apt-get -y install, so flags like --auto-remove and --show-upgraded are invalid for apt-get install and will cause failures. Simplify to:

- DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-   --allow-downgrades --allow-change-held-packages \
-   --no-install-recommends \
-   --option DPkg::Options::="--force-confdef" \
-   --option DPkg::Options::="--force-confold" \
-   openmediavault
+ DEBIAN_FRONTEND=noninteractive pkg_install \
+   --allow-downgrades --allow-change-held-packages \
+   --no-install-recommends \
+   --option DPkg::Options::="--force-confdef" \
+   --option DPkg::Options::="--force-confold" \
+   openmediavault
🧹 Nitpick comments (3)
tools/modules/software/module_omv.sh (3)

15-19: Consider POSIX-compliant function declaration
Declaring functions with the function keyword is Bash-specific. Since we’re already targeting Bash (after adding shebang), this is fine, but if you ever source with sh, it will break. You could make it POSIX-compliant by using:

module_omv() {
  ...
}

55-63: Extend help output to include the help command
The help listing shows install, status, and remove, but omits help itself. For consistency, add a line:

 echo -e "\tremove\t- Remove $title."
 echo
+ echo -e "\thelp\t- Display this help message."

64-66: Handle unknown commands with error exit code
Currently, unknown commands fall through to help, but exit code remains zero. Consider exiting with a non-zero status to signal invalid input:

 *) 
   ${module_options["module_omv,feature"]} ${commands[3]}
+  exit 1
 ;;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfbc4bb and db9b47d.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • tools/include/markdown/OMV001-footer.md
  • tests/omv.conf
  • tools/include/markdown/OMV001-header.md
  • tools/json/config.software.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check
tools/modules/software/module_omv.sh

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)
🔇 Additional comments (2)
tools/modules/runtime/config.runtime.sh (1)

111-113:

Details

✅ Verification successful

Link OMV UI to the Media submenu
Great addition: this ensures the OMV web interface appears under Software → Media → OMV002 with the correct URL. Please verify that the OMV002 entry exists in tools/json/config.software.json so the submenu update targets a valid ID.

Run this script to confirm:


🏁 Script executed:

#!/bin/bash
# Verify OMV002 exists in the software config JSON
if grep -R '"id"[[:space:]]*:[[:space:]]*"OMV002"' tools/json/config.software.json; then
  echo "Found OMV002 entry in config.software.json"
else
  echo "ERROR: OMV002 entry missing in config.software.json" >&2
  exit 1
fi

Length of output: 220


Confirmed OMV002 Submenu ID
The OMV002 entry is found in tools/json/config.software.json, validating the Software → Media submenu link.

tools/modules/software/module_omv.sh (1)

46-54: Installation status handling looks correct
The status command checks installation with pkg_installed, prints a clear message, and returns appropriate exit codes (0 for installed, 1 for not installed`). This aligns with the module conventions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (3)
tools/modules/software/module_omv.sh (3)

1-1: Add a shebang to specify the shell interpreter.

SC2148 indicates the target shell is unknown. Please add at the very top:

#!/usr/bin/env bash

to ensure consistent linting and execution.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


42-44: Fix indentation to use tabs.

EditorConfig requires tabs for indentation, but these lines mix spaces and tabs, causing pipeline failures. Convert leading spaces to a single tab on lines 42–44.

🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


34-39: ⚠️ Potential issue

Remove unsupported apt-get install flags.

pkg_install wraps apt-get -y install, so flags like --auto-remove and --show-upgraded are invalid and will break the command. Please simplify to:

-DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
+DEBIAN_FRONTEND=noninteractive pkg_install \
🧹 Nitpick comments (3)
tools/modules/software/module_omv.sh (3)

1-2: Enable strict error handling.

After the shebang, add:

set -euo pipefail

to catch errors early and prevent use of uninitialized variables.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


54-60: Enhance help output with a help command description.

The help block documents install, status, and remove but omits help. Consider adding:

 echo -e "\tremove\t- Remove $title."
+echo -e "\thelp\t- Display help information."

to make it self-documenting.


62-64: Quote variable expansions to prevent word splitting.

In the default case, the invocation is unquoted. Use:

-${module_options["module_omv,feature"]} ${commands[3]}
+ "${module_options["module_omv,feature"]}" "${commands[3]}"

to guard against unexpected whitespace.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db9b47d and 2223236.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • tools/include/markdown/OMV001-footer.md
  • tests/omv.conf
  • tools/include/markdown/OMV001-header.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • tools/modules/runtime/config.runtime.sh
  • tools/json/config.software.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check
tools/modules/software/module_omv.sh

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)

@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label May 4, 2025
@github-actions github-actions bot removed the Ready to merge Reviewed, tested and ready for merge label May 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (3)
tools/modules/software/module_omv.sh (3)

42-44: ⚠️ Potential issue

Fix indentation to use tabs
Lines 42–44 currently use spaces, which violates EditorConfig and fails the coding style check. Convert to tabs:

-    if pkg_installed openmediavault; then
-        DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
-    fi
+	if pkg_installed openmediavault; then
+		DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
+	fi
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


33-39: 🛠️ Refactor suggestion

Remove unsupported flags from pkg_install invocation
pkg_install wraps apt-get install -y, so flags like --yes, --auto-remove, and --show-upgraded are invalid or redundant and may cause failures. Simplify the call:

- DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-     --allow-downgrades --allow-change-held-packages \
-     --no-install-recommends \
-     --option DPkg::Options::="--force-confdef" \
-     --option DPkg::Options::="--force-confold" \
-     openmediavault
+ DEBIAN_FRONTEND=noninteractive pkg_install \
+     --allow-downgrades --allow-change-held-packages \
+     --no-install-recommends \
+     --option DPkg::Options::="--force-confdef" \
+     --option DPkg::Options::="--force-confold" \
+     openmediavault

26-29: ⚠️ Potential issue

Replace hardcoded release codename with dynamic variable
The APT source line still uses sandworm, which conflicts with the configured module_omv,release="bookworm". This will break on non-sandworm systems. Switch to the variable release:

- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
- https://packages.openmediavault.org/public sandworm main" | \
+ local release="${module_options["module_omv,release"]}"
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
+ https://packages.openmediavault.org/public ${release} main" | \
   tee /etc/apt/sources.list.d/openmediavault.list
🧹 Nitpick comments (2)
tools/modules/software/module_omv.sh (2)

1-2: Add ShellCheck directive to specify shell interpreter
ShellCheck (SC2148) warns about an unknown shell. Since this module is sourced rather than executed, a shebang isn’t required; however, adding a shell directive will satisfy linters.

+ # shellcheck shell=bash
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


63-64: Quote variable expansions in default case
Although names don’t contain spaces today, it’s safer to quote expansions to avoid word splitting:

- ${module_options["module_omv,feature"]} ${commands[3]}
+ "${module_options["module_omv,feature"]}" "${commands[3]}"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2223236 and 9b06126.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • tests/omv.conf
  • tools/modules/runtime/config.runtime.sh
  • tools/include/markdown/OMV001-footer.md
  • tools/include/markdown/OMV001-header.md
  • tools/json/config.software.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

🪛 GitHub Actions: Coding style check
tools/modules/software/module_omv.sh

[error] 42-44: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

♻️ Duplicate comments (3)
tools/modules/software/module_omv.sh (3)

1-2: 🛠️ Refactor suggestion

Add interpreter directive and strict mode
The script currently lacks a shebang and strict error handling, making failures silent and diagnostics harder. Add this at the top to ensure bash is used and the script exits on errors, unset variables, or failed pipes:

+#!/usr/bin/env bash
+set -euo pipefail
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


44-46: 🛠️ Refactor suggestion

Fix indentation to tabs
EditorConfig enforces tabs for indentation. Lines 44–46 use spaces, triggering style-check failures. Convert the leading spaces to tabs to comply:

-    if pkg_installed openmediavault 2>/dev/null; then
-        DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
-    fi
+	if pkg_installed openmediavault 2>/dev/null; then
+		DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
+	fi
🧰 Tools
🪛 GitHub Actions: Coding style check

[error] 44-46: Wrong indentation type (spaces instead of tabs) detected by editorconfig-checker.


35-40: ⚠️ Potential issue

Remove unsupported apt-get install flags
pkg_install wraps apt-get -y install, so flags like --auto-remove and --show-upgraded will cause errors. Simplify the invocation to only use valid options:

-DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-  --allow-downgrades --allow-change-held-packages \
-  --no-install-recommends \
-  --option DPkg::Options::="--force-confdef" \
-  --option DPkg::Options::="--force-confold" \
-  openmediavault
+DEBIAN_FRONTEND=noninteractive pkg_install \
+  --allow-downgrades --allow-change-held-packages \
+  --no-install-recommends \
+  --option DPkg::Options::="--force-confdef" \
+  --option DPkg::Options::="--force-confold" \
+  openmediavault
🧹 Nitpick comments (1)
tools/modules/software/module_omv.sh (1)

55-63: Use printf for portable help output
echo -e behavior can vary between shells. For consistent formatting, prefer printf, for example:

-echo -e "\nUsage: ${module_options["module_omv,feature"]} <command>"
+printf "\nUsage: %s <command>\n" "${module_options["module_omv,feature"]}"

Apply similar changes to all subsequent help lines.

🛑 Comments failed to post (1)
tools/modules/software/module_omv.sh (1)

64-67: 🛠️ Refactor suggestion

Quote subcommand argument
In the default case, wrap the subcommand in quotes to prevent word-splitting and globbing:

-${module_options["module_omv,feature"]} ${commands[3]}
+${module_options["module_omv,feature"]} "${commands[3]}"

This ensures that any future subcommands containing spaces or special characters will be handled safely.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		*)
			${module_options["module_omv,feature"]} "${commands[3]}"
		;;
	esac
🤖 Prompt for AI Agents (early access)
In tools/modules/software/module_omv.sh around lines 64 to 67, the default case executes a subcommand without quoting, which can cause word-splitting and globbing issues. To fix this, wrap the subcommand argument ${commands[3]} in double quotes to ensure it is treated as a single argument, preserving spaces and special characters safely.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
tools/include/markdown/OMV001-header.md (1)

1-8: 💡 Verification agent

🧩 Analysis chain

Enhance markdown structure and verify documentation

  • Add an explicit heading to make this a standalone section:
+ # OpenMediaVault (OMV)
  • Consider converting the feature list into bullet points for readability.
  • Ensure the file ends with a newline.
  • After updating, run the documentation generator to include this header in README.md:

🏁 Script executed:

armbian-config --doc

Length of output: 127


🏁 Script executed:

#!/bin/bash
echo "Checking tools/include/markdown/OMV001-header.md..."
if [[ -f "tools/include/markdown/OMV001-header.md" ]]; then
  echo "✅ File exists"
  last_byte=$(tail -c1 "tools/include/markdown/OMV001-header.md" | od -An -t uC | tr -d ' ')
  if [[ "$last_byte" == "10" ]]; then
    echo "✅ Ends with a newline (ASCII 10)"
  else
    echo "❌ Does not end with a newline (last byte ASCII: $last_byte)"
  fi
else
  echo "❌ tools/include/markdown/OMV001-header.md not found"
fi

echo
echo "Searching for 'armbian-config' references..."
rg -n "armbian-config" || echo "ℹ️ No occurrences of armbian-config found"

Length of output: 8434


🏁 Script executed:

#!/bin/bash
echo "1) Verifying newline at end of tools/include/markdown/OMV001-header.md"
python3 - << 'EOF'
import sys
path = "tools/include/markdown/OMV001-header.md"
try:
    with open(path, "rb") as f:
        data = f.read()
    print("✅ Ends with newline" if data.endswith(b"\n") else "❌ Does not end with newline")
except Exception as e:
    print("Error reading file:", e)
EOF

echo
echo "2) Searching for '# OpenMediaVault' in README.md"
rg -n "# OpenMediaVault" README.md || echo "ℹ️ No such heading found in README.md"

echo
echo "3) Checking if 'armbian-config --doc' is supported in the CLI"
rg -n "\-\-doc" bin/armbian-config || echo "ℹ️ '--doc' option not implemented in bin/armbian-config"

Length of output: 681


Add explicit Markdown heading and improve feature readability

  • Prepend a top-level heading to tools/include/markdown/OMV001-header.md:
+ # OpenMediaVault (OMV)
  • Break out the “OMV supports…” sentence into a bullet list for clarity, e.g.:
- File systems: EXT4, XFS, BTRFS, etc.
- Software RAID configurations
- Scheduled backups
- User and group management
- Network protocols: SMB/CIFS, NFS, FTP, SSH
- Plugin support: Docker, media servers, cloud sync, BitTorrent, etc.
  • The file already ends with a newline—no change needed there.
  • Regenerate the top‐level README.md to pick up this new header:
bin/armbian-config --doc
  • Confirm that README.md now contains a “# OpenMediaVault (OMV)” section.
♻️ Duplicate comments (2)
tools/modules/software/module_omv.sh (2)

1-1: Add shebang for shell script interpreter
Without a shebang, the target shell is ambiguous (SC2148). Please add the following at the top of the file to ensure consistent execution:

+#!/usr/bin/env bash
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


35-40: Remove unsupported flags from pkg_install
Flags like --auto-remove and --show-upgraded are invalid for apt-get install and will cause failures. Use the -y/--yes flag only:

-           DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
+           DEBIAN_FRONTEND=noninteractive pkg_install --yes \
            --allow-downgrades --allow-change-held-packages \
            --no-install-recommends \
            --option DPkg::Options::="--force-confdef" \
            --option DPkg::Options::="--force-confold" \
🧹 Nitpick comments (2)
tools/modules/software/module_omv.sh (2)

43-47: Cleanup repository and keyring on removal
After uninstalling OpenMediaVault, the APT source list and GPG key remain on the system. Consider removing them:

         if pkg_installed openmediavault 2>/dev/null; then
             DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
+            rm -f /etc/apt/sources.list.d/openmediavault.list
+            rm -f /usr/share/keyrings/openmediavault-archive-keyring.gpg
         fi

55-63: Refactor help output for clarity and maintainability
Using a here‐document can simplify the help text and avoid multiple echo -e calls:

-           echo -e "\nUsage: ${module_options["module_omv,feature"]} <command>"
-           echo -e "Commands:  ${module_options["module_omv,example"]}"
-           echo "Available commands:"
-           echo -e "\tinstall\t- Install $title."
-           echo -e "\tstatus\t- Installation status $title."
-           echo -e "\tremove\t- Remove $title."
-           echo
+           cat <<EOF
+Usage: ${module_options["module_omv,feature"]} <command>
+Commands: ${module_options["module_omv,example"]}
+  install  - Install $title.
+  status   - Show installation status of $title.
+  remove   - Remove $title.
+EOF
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c77605 and 2206ac7.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/omv.conf
🚧 Files skipped from review as they are similar to previous changes (3)
  • tools/modules/runtime/config.runtime.sh
  • tools/include/markdown/OMV001-footer.md
  • tools/json/config.software.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label May 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (5)
tools/modules/software/module_omv.sh (5)

1-1: 🛠️ Refactor suggestion

Add shebang and shell directive
ShellCheck (SC2148) suggests specifying the target shell. Please add at the top of the file:

+#!/usr/bin/env bash
+# shellcheck shell=bash
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


15-19: 🛠️ Refactor suggestion

Extract release codename into a variable
Declare release once from module_options to avoid scattering hardcoded strings:

 function module_omv() {
+	local release="${module_options["module_omv,release"]}"
 	local title="openmediavault"
 	local commands
 	IFS=' ' read -r -a commands <<< "${module_options["module_omv,example"]}"

27-29: 🛠️ Refactor suggestion

Use dynamic release variable in the APT source
Replace the hardcoded sandworm codename with $release:

-	echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
-	https://packages.openmediavault.org/public sandworm main" | \
+	echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openmediavault-archive-keyring.gpg] \
+	https://packages.openmediavault.org/public $release main" | \
 	tee /etc/apt/sources.list.d/openmediavault.list

34-39: 🛠️ Refactor suggestion

Remove unsupported flags from pkg_install
pkg_install wraps apt-get -y install; flags like --auto-remove and --show-upgraded aren’t valid here. Simplify to:

-	DEBIAN_FRONTEND=noninteractive pkg_install --yes --auto-remove --show-upgraded \
-	--allow-downgrades --allow-change-held-packages \
-	--no-install-recommends \
+	DEBIAN_FRONTEND=noninteractive pkg_install \
+	--allow-downgrades --allow-change-held-packages \
+	--no-install-recommends \

42-45: ⚠️ Potential issue

Fix indentation to use tabs
The remove branch is indented with spaces, violating EditorConfig. Convert to tabs:

-	if pkg_installed openmediavault 2>/dev/null; then
-	    DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
-	fi
+	if pkg_installed openmediavault 2>/dev/null; then
+		DEBIAN_FRONTEND=noninteractive pkg_remove openmediavault
+	fi
🧹 Nitpick comments (2)
tools/modules/software/module_omv.sh (2)

47-53: Standardize indentation in status check
Similarly, the status branch uses space indent. Please convert each leading space to a single tab for consistency.


54-62: Use printf instead of echo -e for portability
Relying on echo -e is non-portable. Consider:

-	echo -e "Commands:  ${module_options["module_omv,example"]}"
-	echo "Available commands:"
-	echo -e "\tinstall\t- Install $title."
+	printf "Commands: %s\n" "${module_options["module_omv,example"]}"
+	printf "Available commands:\n"
+	printf "\tinstall\t- Install %s.\n" "$title"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2206ac7 and dfa75a3.

⛔ Files ignored due to path filters (1)
  • tools/include/images/OMV001.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • tests/omv.conf (1 hunks)
  • tools/include/markdown/OMV001-footer.md (1 hunks)
  • tools/include/markdown/OMV001-header.md (1 hunks)
  • tools/json/config.software.json (1 hunks)
  • tools/modules/runtime/config.runtime.sh (1 hunks)
  • tools/modules/software/module_omv.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tools/include/markdown/OMV001-footer.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/omv.conf
  • tools/modules/runtime/config.runtime.sh
  • tools/include/markdown/OMV001-header.md
  • tools/json/config.software.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
tools/modules/software/module_omv.sh (1)
tools/modules/functions/package.sh (4)
  • pkg_update (81-84)
  • pkg_install (41-44)
  • pkg_installed (54-58)
  • pkg_remove (68-71)
🪛 Shellcheck (0.10.0)
tools/modules/software/module_omv.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OpenMediaVault install (bookworm)
🔇 Additional comments (1)
tools/modules/software/module_omv.sh (1)

11-11: Confirm correct architecture metadata
Good to see the arch entry uses amd64, matching dpkg --print-architecture.

@github-actions github-actions bot removed the Ready to merge Reviewed, tested and ready for merge label May 4, 2025
@igorpecovnik igorpecovnik changed the title Software title: OMV Software title: OMV (openmediavault) May 4, 2025
@igorpecovnik igorpecovnik merged commit 681e477 into main May 4, 2025
1 check passed
@igorpecovnik igorpecovnik deleted the omv branch May 4, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Documentation Documentation changes or additions size/medium PR with more then 50 and less then 250 lines Unit Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant