Update install_perccli.sh
This commit is contained in:
parent
992c020b0d
commit
cd1b9d8ec4
|
|
@ -35,7 +35,7 @@ fi
|
|||
echo "Extraction complete to $TEMP_DIR."
|
||||
|
||||
# 3. Locate the installation package
|
||||
# IMPORTANT CHANGE: Prioritizing .deb files as Proxmox (Debian) is the target OS.
|
||||
# Prioritizing .deb files, but since the previous run found an .rpm, the script is prepared to convert it.
|
||||
PACKAGE_FILE=$(find "$TEMP_DIR" -type f \( -name "*.deb" -o -name "*.rpm" \) | head -n 1)
|
||||
|
||||
if [ -z "$PACKAGE_FILE" ]; then
|
||||
|
|
@ -52,26 +52,49 @@ echo "4. Attempting to install the package."
|
|||
INSTALL_SUCCESS=0
|
||||
|
||||
if [[ "$PACKAGE_FILE" == *.deb ]]; then
|
||||
echo "Detected DEB package. Trying to install with 'dpkg -i'..."
|
||||
echo "Detected native DEB package. Trying to install with 'dpkg -i'..."
|
||||
if command -v dpkg >/dev/null 2>&1; then
|
||||
# Removed 'sudo'
|
||||
dpkg -i "$PACKAGE_FILE"
|
||||
INSTALL_SUCCESS=$?
|
||||
else
|
||||
# Explicitly setting INSTALL_SUCCESS=1 if the command is not found
|
||||
echo "ERROR: 'dpkg' command not found. Please ensure the package manager is available."
|
||||
echo "ERROR: 'dpkg' command not found. Please ensure the Debian 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=$?
|
||||
echo "Detected RPM package. This system appears to be Debian-based (Proxmox), so we will attempt to use 'alien' to convert it to a DEB package for installation."
|
||||
|
||||
if command -v dpkg >/dev/null 2>&1; then
|
||||
if command -v alien >/dev/null 2>&1; 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"
|
||||
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)
|
||||
|
||||
if [ -f "$NEW_DEB_FILE" ]; then
|
||||
echo "Conversion successful. Installing $NEW_DEB_FILE..."
|
||||
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."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: 'alien' conversion failed."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: 'alien' command not found. This tool is required to convert the RPM package for your system."
|
||||
echo "Please run: apt update && apt install alien -y"
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
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."
|
||||
echo "FATAL ERROR: 'dpkg' (Debian Package Manager) is not found. Cannot proceed with installation."
|
||||
INSTALL_SUCCESS=1
|
||||
fi
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue