Update install_perccli.sh

This commit is contained in:
jjorstad2 2025-11-02 22:00:46 +00:00
parent 9a4641b638
commit d9afe14bb4
1 changed files with 11 additions and 10 deletions

View File

@ -116,14 +116,14 @@ 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: Try dpkg, then fall back to filesystem search # NEW DYNAMIC PATH DISCOVERY: Try dpkg, then fall back to filesystem search for common binaries
ACTUAL_EXECUTABLE_PATH=$(dpkg -L perccli 2>/dev/null | grep "/perccli$" | head -n 1) ACTUAL_EXECUTABLE_PATH=$(dpkg -L perccli 2>/dev/null | grep "/perccli$" | head -n 1)
# If dpkg failed or found path is not a file, search common installation directories # If dpkg failed or found path is not a file, perform aggressive search for common names
if [ -z "$ACTUAL_EXECUTABLE_PATH" ] || [ ! -f "$ACTUAL_EXECUTABLE_PATH" ]; then if [ -z "$ACTUAL_EXECUTABLE_PATH" ] || [ ! -f "$ACTUAL_EXECUTABLE_PATH" ]; then
echo "WARNING: dpkg path discovery failed. Performing filesystem search for 'perccli'..." echo "WARNING: Expected binary 'perccli' not found. Performing aggressive search for 'storcli' or 'MegaCli'..."
# Search common paths: /opt, /usr/local/sbin, /usr/sbin, /usr/bin # CRITICAL FIX: Search for the actual vendor executable names in common directories
ACTUAL_EXECUTABLE_PATH=$(find /opt /usr/local/sbin /usr/sbin /usr/bin -name perccli -type f 2>/dev/null | head -n 1) ACTUAL_EXECUTABLE_PATH=$(find /opt /usr/local/sbin /usr/sbin /usr/bin -name perccli -type f -o -name storcli -type f -o -name MegaCli -type f 2>/dev/null | head -n 1)
fi fi
# Finalize path or fail # Finalize path or fail
@ -131,8 +131,8 @@ if [ $INSTALL_SUCCESS -eq 0 ]; then
EXECUTABLE_PATH="$ACTUAL_EXECUTABLE_PATH" EXECUTABLE_PATH="$ACTUAL_EXECUTABLE_PATH"
echo "Dynamically found executable at: $EXECUTABLE_PATH" echo "Dynamically found executable at: $EXECUTABLE_PATH"
else else
echo "FATAL ERROR: Could not locate 'perccli' binary after successful package setup." echo "FATAL ERROR: Could not locate *any* related binary (perccli, storcli, or MegaCli) after successful package setup."
echo "Please manually run: find / -name perccli -type f" echo "Please manually run: find / -name '*cli' -type f"
INSTALL_SUCCESS=1 # Set installation to fail state to skip chmod/symlink INSTALL_SUCCESS=1 # Set installation to fail state to skip chmod/symlink
fi fi
@ -144,9 +144,10 @@ if [ $INSTALL_SUCCESS -eq 0 ]; then
echo "Applied execute permission to $EXECUTABLE_PATH." echo "Applied execute permission to $EXECUTABLE_PATH."
# 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 # Symlink is always named 'perccli' but points to the actual binary (perccli, storcli, or MegaCli)
ln -s "$EXECUTABLE_PATH" "$SYMLINK_PATH" if [ ! -L "$SYMLINK_PATH" ] || [ -L "$SYMLINK_PATH" ] && [ "$(readlink -f "$SYMLINK_PATH")" != "$EXECUTABLE_PATH" ]; then
echo "Created symbolic link at $SYMLINK_PATH." ln -sf "$EXECUTABLE_PATH" "$SYMLINK_PATH"
echo "Created symbolic link at $SYMLINK_PATH pointing to $EXECUTABLE_PATH."
fi fi
rm -f "$ARCHIVE_NAME" rm -f "$ARCHIVE_NAME"