Add preinstall script for build_hsa.sh

This is to fix the situation where libhsa-runtime exists in
/usr/lib. The preinstall script will check for this and ask
the user if they want to delete the old version, or else
abandon install.

Change-Id: I0976b6ec95b9752c95031f1a73fc49a150b02b23
Signed-off-by: Chris Freehill <cfreehil@amd.com>
This commit is contained in:
Chris Freehill
2024-05-13 14:05:54 -05:00
rodzic cb8705627f
commit 4474dcff2c
3 zmienionych plików z 51 dodań i 2 usunięć
+23
Wyświetl plik
@@ -0,0 +1,23 @@
#!/bin/bash
echo "Pre-install check for ROCr."
# Check for old installations...
if ls /usr/lib/libhsa-runtime* 1> /dev/null 2>&1; then
echo "An old version of libhsa-runtime was found in /usr/lib."
echo "This must be uninstalled before proceeding with the installation"
echo "to avoid potential incompatibilities."
read -r -p "Do you want to uninstall the old version? [y/N] " response
if [ "$response" = "y" ]; then
if ! rm -rf /usr/lib/libhsa-runtime*; then
echo "Failed to remove /usr/lib/libhsa-runtime* files."
echo "Try to uninstall these files manually."
exit 1
fi
echo "Old version uninstalled."
else
echo "The old and new versions of ROCm are incompatible. Installation aborted."
exit 1
fi
fi