From a35c8ff2f1cb1dd0291b97f4750b7018854d9712 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Mon, 14 Jul 2025 10:59:05 -0400 Subject: [PATCH] refactor(install): add debugging to install process - Remove redundant log file handling and display errors directly to users - Add debug information for troubleshooting installation issues ## Summary by CodeRabbit * **Bug Fixes** * Improved installation and verification scripts to display output and error messages directly to the user, rather than writing to a log file. * Enhanced error messages to provide clearer instructions when issues occur during installation or verification. * **New Features** * Added detailed debug output during the API service startup to assist with troubleshooting. * **Chores** * Updated script environments and streamlined directory creation for improved reliability. --- plugin/plugins/dynamix.unraid.net.plg | 37 ++++++++++++------- .../install/scripts/verify_install.sh | 7 +--- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index 208a74b22..cae025d48 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -331,8 +331,7 @@ exit 0 > "$LOGFILE" - # Capture output and add to log file - setup_output=$("$SCRIPTS_DIR/setup_api.sh") - echo "$setup_output" >> "$LOGFILE" + echo "Running setup_api.sh" + # Run and show output to user + "$SCRIPTS_DIR/setup_api.sh" else - echo "ERROR: setup_api.sh not found or not executable" >> "$LOGFILE" + echo "ERROR: setup_api.sh not found or not executable" + echo "ERROR: setup_api.sh not found or not executable" fi # Run post-installation verification if [ -x "$SCRIPTS_DIR/verify_install.sh" ]; then echo "Running post-installation verification..." - echo "Running verify_install.sh" >> "$LOGFILE" - # Capture output and add to log file - verify_output=$("$SCRIPTS_DIR/verify_install.sh") - echo "$verify_output" >> "$LOGFILE" + echo "Running verify_install.sh" + # Run and show output to user + "$SCRIPTS_DIR/verify_install.sh" else - echo "ERROR: verify_install.sh not found or not executable" >> "$LOGFILE" + echo "ERROR: verify_install.sh not found or not executable" + echo "ERROR: verify_install.sh not found or not executable" fi -echo "Installation completed at $(date)" >> "$LOGFILE" +echo "Installation completed at $(date)" ]]> @@ -379,6 +378,18 @@ echo "Installation completed at $(date)" >> "$LOGFILE" /etc/rc.d/rc.unraid-api cleanup-dependencies echo "Starting Unraid API service" +echo "DEBUG: Checking PATH: $PATH" +echo "DEBUG: Checking if unraid-api files exist:" +ls -la /usr/local/unraid-api/dist/ +echo "DEBUG: Checking symlink:" +ls -la /usr/local/bin/unraid-api +echo "DEBUG: Checking Node.js version:" +node --version +echo "DEBUG: Checking if cli.js is executable:" +ls -la /usr/local/unraid-api/dist/cli.js +echo "DEBUG: Attempting to run unraid-api directly:" +/usr/local/unraid-api/dist/cli.js version || echo "Direct execution failed" + echo "If no additional messages appear within 30 seconds, it is safe to refresh the page." /etc/rc.d/rc.unraid-api plugins add unraid-api-plugin-connect -b --no-restart /etc/rc.d/rc.unraid-api start diff --git a/plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh b/plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh index de578df03..c510c7adc 100755 --- a/plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh +++ b/plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh @@ -1,10 +1,7 @@ -#!/bin/sh +#!/bin/bash # Unraid API Installation Verification Script # Checks that critical files are installed correctly -# Exit on errors -set -e - echo "Performing comprehensive installation verification..." # Define critical files to check (POSIX-compliant, no arrays) @@ -171,7 +168,7 @@ if [ $TOTAL_ERRORS -eq 0 ]; then else printf 'Found %d total errors.\n' "$TOTAL_ERRORS" echo "Installation verification completed with issues." - echo "See log file for details: /var/log/unraid-api/dynamix-unraid-install.log" + echo "Please review the errors above and contact support if needed." # We don't exit with error as this is just a verification script exit 0 fi \ No newline at end of file