diff --git a/install_perccli.sh b/install_perccli.sh index 30d5195..09ce577 100644 --- a/install_perccli.sh +++ b/install_perccli.sh @@ -9,6 +9,7 @@ PERCCLI_URL="https://dl.dell.com/FOLDER13074167M/1/PERCCLI_7.3208.0_Linux_A01.tar.gz" ARCHIVE_NAME="PERCCLI_7.3208.0_Linux_A01.tar.gz" TEMP_DIR="perccli_install_temp" +# Default path for the executable, will be updated dynamically if necessary EXECUTABLE_PATH="/opt/MegaRAID/perccli/perccli" SYMLINK_PATH="/usr/local/bin/perccli" @@ -114,15 +115,28 @@ fi if [ $INSTALL_SUCCESS -eq 0 ]; then echo "" echo "5. Installation successful. Performing final setup and cleanup." + + # NEW DYNAMIC PATH DISCOVERY: Find where dpkg actually put the executable + ACTUAL_EXECUTABLE_PATH=$(dpkg -L perccli 2>/dev/null | grep "/perccli$" | head -n 1) + + if [ -n "$ACTUAL_EXECUTABLE_PATH" ] && [ -f "$ACTUAL_EXECUTABLE_PATH" ]; then + EXECUTABLE_PATH="$ACTUAL_EXECUTABLE_PATH" + echo "Dynamically found executable at: $EXECUTABLE_PATH" + else + echo "WARNING: Could not reliably determine the installed executable path using dpkg. Assuming default: $EXECUTABLE_PATH" + fi # CRITICAL FIX: Ensure the executable has permissions (Fixes 'Permission denied') if [ -f "$EXECUTABLE_PATH" ]; then chmod +x "$EXECUTABLE_PATH" echo "Applied execute permission to $EXECUTABLE_PATH." + else + echo "FATAL ERROR: Executable not found at $EXECUTABLE_PATH. Cannot apply permissions or create symlink." + # Keep INSTALL_SUCCESS=0 if files are missing, just report the error and attempt cleanup fi # Add symbolic link to the path (Fixes 'command not found') - if [ ! -L "$SYMLINK_PATH" ]; then + if [ ! -L "$SYMLINK_PATH" ] && [ -f "$EXECUTABLE_PATH" ]; then ln -s "$EXECUTABLE_PATH" "$SYMLINK_PATH" echo "Created symbolic link at $SYMLINK_PATH." fi