#!/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. # ------------------------------------------------------------------------------------------------ # --- Configuration --- 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" echo "Starting PERCCLI installation script..." echo "Target URL: $PERCCLI_URL" # 1. Download the archive echo "1. Downloading $ARCHIVE_NAME..." # Using wget to download the file wget --no-check-certificate "$PERCCLI_URL" -O "$ARCHIVE_NAME" if [ $? -ne 0 ]; then echo "ERROR: Failed to download the file. Check your network connection and ensure 'wget' is installed." exit 1 fi echo "Download complete." # 2. Extract the archive echo "2. Extracting the archive..." mkdir -p "$TEMP_DIR" # Extracting the tar.gz file into the temporary directory tar -xzf "$ARCHIVE_NAME" -C "$TEMP_DIR" if [ $? -ne 0 ]; then echo "ERROR: Failed to extract the archive. The file may be incomplete or corrupted." rm -rf "$TEMP_DIR" exit 1 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) if [ -z "$PACKAGE_FILE" ]; then echo "ERROR: Could not find any .rpm or .deb 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'." 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 echo "ERROR: 'rpm' command not found. Please install the package manually." fi elif [[ "$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" INSTALL_SUCCESS=$? else echo "ERROR: 'dpkg' command not found. Please install the package manually." fi else echo "ERROR: Found file $PACKAGE_FILE is neither .rpm nor .deb. Manual installation is required." fi # 5. Cleanup and Verification if [ $INSTALL_SUCCESS -eq 0 ]; then echo "" echo "5. Installation successful. Cleaning up temporary files." rm -f "$ARCHIVE_NAME" rm -rf "$TEMP_DIR" echo "PERCCLI tool should now be available." echo "Verify installation by running: perccli /c0 show" else echo "" echo "5. Installation failed. The archive '$ARCHIVE_NAME' and temporary directory '$TEMP_DIR' are retained for manual debugging." fi # ------------------------------------------------------------------------------------------------