Update install_perccli.sh

This commit is contained in:
jjorstad2 2025-11-02 21:55:10 +00:00
parent b535de3996
commit 33e58463d9
1 changed files with 15 additions and 1 deletions

View File

@ -9,6 +9,7 @@
PERCCLI_URL="https://dl.dell.com/FOLDER13074167M/1/PERCCLI_7.3208.0_Linux_A01.tar.gz" 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" ARCHIVE_NAME="PERCCLI_7.3208.0_Linux_A01.tar.gz"
TEMP_DIR="perccli_install_temp" TEMP_DIR="perccli_install_temp"
# Default path for the executable, will be updated dynamically if necessary
EXECUTABLE_PATH="/opt/MegaRAID/perccli/perccli" EXECUTABLE_PATH="/opt/MegaRAID/perccli/perccli"
SYMLINK_PATH="/usr/local/bin/perccli" SYMLINK_PATH="/usr/local/bin/perccli"
@ -115,14 +116,27 @@ if [ $INSTALL_SUCCESS -eq 0 ]; then
echo "" echo ""
echo "5. Installation successful. Performing final setup and cleanup." 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') # CRITICAL FIX: Ensure the executable has permissions (Fixes 'Permission denied')
if [ -f "$EXECUTABLE_PATH" ]; then if [ -f "$EXECUTABLE_PATH" ]; then
chmod +x "$EXECUTABLE_PATH" chmod +x "$EXECUTABLE_PATH"
echo "Applied execute permission to $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 fi
# Add symbolic link to the path (Fixes 'command not found') # 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" ln -s "$EXECUTABLE_PATH" "$SYMLINK_PATH"
echo "Created symbolic link at $SYMLINK_PATH." echo "Created symbolic link at $SYMLINK_PATH."
fi fi