Update install_perccli.sh
This commit is contained in:
parent
33e58463d9
commit
9a4641b638
|
|
@ -116,27 +116,35 @@ 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
|
||||
# NEW DYNAMIC PATH DISCOVERY: Try dpkg, then fall back to filesystem search
|
||||
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 [ -z "$ACTUAL_EXECUTABLE_PATH" ] || [ ! -f "$ACTUAL_EXECUTABLE_PATH" ]; then
|
||||
echo "WARNING: dpkg path discovery failed. Performing filesystem search for 'perccli'..."
|
||||
# Search common paths: /opt, /usr/local/sbin, /usr/sbin, /usr/bin
|
||||
ACTUAL_EXECUTABLE_PATH=$(find /opt /usr/local/sbin /usr/sbin /usr/bin -name perccli -type f 2>/dev/null | head -n 1)
|
||||
fi
|
||||
|
||||
# Finalize path or fail
|
||||
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"
|
||||
echo "FATAL ERROR: Could not locate 'perccli' binary after successful package setup."
|
||||
echo "Please manually run: find / -name perccli -type f"
|
||||
INSTALL_SUCCESS=1 # Set installation to fail state to skip chmod/symlink
|
||||
fi
|
||||
|
||||
|
||||
# Proceed with cleanup and symlinking only if the executable was found
|
||||
if [ $INSTALL_SUCCESS -eq 0 ]; then
|
||||
# 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" ] && [ -f "$EXECUTABLE_PATH" ]; then
|
||||
if [ ! -L "$SYMLINK_PATH" ]; then
|
||||
ln -s "$EXECUTABLE_PATH" "$SYMLINK_PATH"
|
||||
echo "Created symbolic link at $SYMLINK_PATH."
|
||||
fi
|
||||
|
|
@ -149,6 +157,10 @@ if [ $INSTALL_SUCCESS -eq 0 ]; then
|
|||
echo "Verification Command:"
|
||||
echo "perccli /c0 show"
|
||||
echo "---"
|
||||
else
|
||||
# If dynamic discovery failed, we skip cleanup and leave temporary files for debugging.
|
||||
echo "Installation failed due to missing files. Temporary files retained."
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "5. Installation failed. The archive '$ARCHIVE_NAME' and temporary directory '$TEMP_DIR' are retained for manual debugging."
|
||||
|
|
|
|||
Loading…
Reference in New Issue