diff --git a/install_perccli.sh b/install_perccli.sh index 951da5d..8899b5f 100644 --- a/install_perccli.sh +++ b/install_perccli.sh @@ -68,24 +68,29 @@ elif [[ "$PACKAGE_FILE" == *.rpm ]]; then echo "Attempting to convert $PACKAGE_FILE to .deb using 'alien'..." # Convert the RPM to DEB. The resulting .deb file will be created in the current directory. alien -d "$PACKAGE_FILE" + + # Check the return code of the alien conversion if [ $? -eq 0 ]; then - # Find the name of the newly created .deb file (e.g., from perccli-007.3208.0000.0000-1.noarch.rpm to perccli_0.7.3208.0000.0000-2_all.deb) - # Alien renames packages, so we search for a .deb file with the original name prefix. - DEB_NAME_PREFIX=$(basename "$PACKAGE_FILE" .rpm) - NEW_DEB_FILE=$(find . -maxdepth 1 -name "${DEB_NAME_PREFIX}*.deb" | head -n 1) + echo "Conversion successful. Searching for generated .deb file..." + # FIX: Alien renames files, typically changing hyphens to underscores. + # Isolate the base package name (e.g., 'perccli' from the full name). + PACKAGE_NAME_ROOT=$(basename "$PACKAGE_FILE" | cut -d'-' -f1) + + # Search for any .deb file in the current directory starting with the package name root and an underscore. + NEW_DEB_FILE=$(find . -maxdepth 1 -name "${PACKAGE_NAME_ROOT}_*.deb" | head -n 1) if [ -f "$NEW_DEB_FILE" ]; then - echo "Conversion successful. Installing $NEW_DEB_FILE..." + echo "Found converted file: $NEW_DEB_FILE. Installing..." dpkg -i "$NEW_DEB_FILE" INSTALL_SUCCESS=$? # Clean up the converted .deb file regardless of final install success rm -f "$NEW_DEB_FILE" else - echo "ERROR: Conversion succeeded, but could not locate the newly created .deb file for installation." + echo "ERROR: Conversion succeeded, but could not locate the newly created .deb file for installation (Searched for: ${PACKAGE_NAME_ROOT}_*.deb)." INSTALL_SUCCESS=1 fi else - echo "ERROR: 'alien' conversion failed." + echo "ERROR: 'alien' conversion failed. Please check the 'alien' output above for details." INSTALL_SUCCESS=1 fi else