Update install_perccli.sh
This commit is contained in:
parent
48dea4676f
commit
992c020b0d
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
# Script to download, extract, and install the Dell PERCCLI utility on a Linux system.
|
||||
# Note: This script requires 'wget', 'tar', and typically 'sudo' for the final installation step.
|
||||
# Note: This script requires 'wget' and 'tar'. It assumes execution as 'root' (no 'sudo' needed).
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
|
||||
# --- Configuration ---
|
||||
|
|
@ -35,46 +35,47 @@ fi
|
|||
echo "Extraction complete to $TEMP_DIR."
|
||||
|
||||
# 3. Locate the installation package
|
||||
# Dell archives usually contain nested directories (e.g., Linux/RHEL/RPMS or Linux/DEB).
|
||||
# This finds the first .rpm or .deb file in the extracted contents.
|
||||
PACKAGE_FILE=$(find "$TEMP_DIR" -type f \( -name "*.rpm" -o -name "*.deb" \) | head -n 1)
|
||||
# IMPORTANT CHANGE: Prioritizing .deb files as Proxmox (Debian) is the target OS.
|
||||
PACKAGE_FILE=$(find "$TEMP_DIR" -type f \( -name "*.deb" -o -name "*.rpm" \) | head -n 1)
|
||||
|
||||
if [ -z "$PACKAGE_FILE" ]; then
|
||||
echo "ERROR: Could not find any .rpm or .deb installation package within the archive."
|
||||
echo "ERROR: Could not find any .deb or .rpm installation package within the archive."
|
||||
echo "Please navigate to '$TEMP_DIR' and install the appropriate package manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "3. Found package file: $PACKAGE_FILE"
|
||||
|
||||
# 4. Install the package using the appropriate command (requires sudo)
|
||||
echo "4. Attempting to install the package. This step requires 'sudo'."
|
||||
# 4. Install the package using the appropriate command (no 'sudo' needed as running as root)
|
||||
echo "4. Attempting to install the package."
|
||||
|
||||
INSTALL_SUCCESS=0
|
||||
|
||||
if [[ "$PACKAGE_FILE" == *.rpm ]]; then
|
||||
echo "Detected RPM package. Trying to install with 'rpm -ivh'..."
|
||||
if command -v rpm >/dev/null 2>&1; then
|
||||
sudo rpm -ivh "$PACKAGE_FILE"
|
||||
INSTALL_SUCCESS=$?
|
||||
else
|
||||
# FIX: Explicitly setting INSTALL_SUCCESS=1 if the command is not found
|
||||
echo "ERROR: 'rpm' command not found. This indicates you may be running a Debian-based system (like Ubuntu)."
|
||||
echo "Please install the 'rpm' package manually, or if you are on Debian/Ubuntu, consider installing 'alien' to convert the package."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
elif [[ "$PACKAGE_FILE" == *.deb ]]; then
|
||||
if [[ "$PACKAGE_FILE" == *.deb ]]; then
|
||||
echo "Detected DEB package. Trying to install with 'dpkg -i'..."
|
||||
if command -v dpkg >/dev/null 2>&1; then
|
||||
sudo dpkg -i "$PACKAGE_FILE"
|
||||
# Removed 'sudo'
|
||||
dpkg -i "$PACKAGE_FILE"
|
||||
INSTALL_SUCCESS=$?
|
||||
else
|
||||
# FIX: Explicitly setting INSTALL_SUCCESS=1 if the command is not found
|
||||
echo "ERROR: 'dpkg' command not found. Please install the package manager manually."
|
||||
# Explicitly setting INSTALL_SUCCESS=1 if the command is not found
|
||||
echo "ERROR: 'dpkg' command not found. Please ensure the package manager is available."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
elif [[ "$PACKAGE_FILE" == *.rpm ]]; then
|
||||
echo "Detected RPM package. Trying to install with 'rpm -ivh'..."
|
||||
if command -v rpm >/dev/null 2>&1; then
|
||||
# Removed 'sudo'
|
||||
rpm -ivh "$PACKAGE_FILE"
|
||||
INSTALL_SUCCESS=$?
|
||||
else
|
||||
# Explicitly setting INSTALL_SUCCESS=1 if the command is not found
|
||||
echo "ERROR: 'rpm' command not found. This confirms you are running a Debian-based system (like Proxmox/Ubuntu)."
|
||||
echo "Please install the 'rpm' package manually, or if running Proxmox, use 'apt install alien' to convert the package to .deb and install it."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Found file $PACKAGE_FILE is neither .rpm nor .deb. Manual installation is required."
|
||||
echo "ERROR: Found file $PACKAGE_FILE is neither .deb nor .rpm. Manual installation is required."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue