diff --git a/.gitignore b/.gitignore index 41d28b4..03cf798 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -Contents/Resources/IPMIView -SM_download/ \ No newline at end of file +*~ +.*.sw* +/SM_download/ +/IPMIView.app/ diff --git a/Contents/MacOS/IPMIView b/Contents/MacOS/IPMIView index f12d6e3..b008072 100755 --- a/Contents/MacOS/IPMIView +++ b/Contents/MacOS/IPMIView @@ -1,4 +1,6 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "${DIR}/../Resources/IPMIView" -"${DIR}/../Resources/IPMIView/Contents/Home/bin/java" -jar IPMIView20.jar +# Explicitly export JAVA_HOME so the KVM Console launches using the same Java +export JAVA_HOME="${DIR}/../Resources/IPMIView/Contents/Home" +"${JAVA_HOME}/bin/java" -jar IPMIView20.jar diff --git a/README.md b/README.md index 9322849..4088ce8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ cd IPMIView.app bash script.sh ``` -You should now have an application icon in your home directory's Applications (aka `~/Applications`) folder. +You should now have an application icon in the current directory. You can copy it into `/Applications/` or into `~/Applications/` ror run it from the current location if you'd like. For some versions of macOS, you may also need to add a security exception for `java`; see [Using the KVM Console](#using-the-kvm-console) for details. @@ -28,6 +28,17 @@ Running the commands in the [Quick Start](#quick-start) section above will autom The script in this repo downloads files from SuperMicro's website located at: https://www.supermicro.com/wdl/utility/IPMIView/Linux/ +### Intel x86-64 versus Apple Silicon + +While the IPMIView application from SuperMicro is mostly written in Java, there are some native binaries required for the KVM console and possibly other parts of it. Oddly enough, the Linux bundle contains binaries for MacOS, but they are x86-64 *only*. + +If you are using MacOS on Apple Silicon (aka arm64 aka aarch64), it's still possible to run these x86-64-only binaries as long as you have: + +1. Rosetta 2 +2. Java Development Kit for MacOS x86-64 + +When building on MacOS aarch64, `script.sh` will prompt you to install Rosetta 2 and a usable JDK. You can simply set `$JAVA_HOME` to point to that JDK before running `script.sh`. + ### Using the KVM Console You need to add an `Input Monitoring` exception for `java` in the `Security & Privacy -> Privacy` Tab in `System Preferences`: @@ -40,6 +51,7 @@ You need to add an `Input Monitoring` exception for `java` in the `Security & Pr - In the top of the new window, select `Macintosh HD` in the pulldown `Library -> Java -> JavaVirtualMachines -> jdk.jdk -> bin -> Contents -> Home -> bin` - Double click on `java` - Make sure the box next to `java` is now checked and close the window + - (You may also have to do this for the Java embedded in the IPMIView.app bundle) When you attempt to launch the console, you may be presented with a message that says the developer is not verified. DO NOT click "Move to Trash" - this will delete the files necessary to run the graphical console. Once you get this message: @@ -58,3 +70,5 @@ java -jar IPMIView20.jar ``` If you have issues with IMPIView loading correctly with this method, please contact SuperMicro support. The problem is related to the app and your computer setup, not the wrapper. + +Remember, if you are using MacOS aarch64, you will need to use an x86-64 version of the JDK/JRE in order to run the KVM Console. diff --git a/script.sh b/script.sh old mode 100644 new mode 100755 index b2339af..b9e1d6d --- a/script.sh +++ b/script.sh @@ -9,6 +9,7 @@ INFO_URL="${BASE_URL}/downloadcenter/smsdownload\?category\=IPMI" API_URL="https://www.supermicro.com/support/resources/getfile.php?SoftwareItemID=DLID&type=serversoftwarefile" if which curl >/dev/null; then + echo "Detecting current SuperMicro software versions..." # this area is subject to problems if SuperMicro changes their page format DL_ID=$(curl -s ${INFO_URL} | grep "data-sms-name=\"Linux\".*sms_radio_buttons_IPMIView" | cut -d"'" -f4) DL_URL=$(echo $API_URL | sed "s/DLID/${DL_ID}/") @@ -19,7 +20,7 @@ if which curl >/dev/null; then echo "[WARNING!] Problem parsing latest version..." echo "Falling back to last known version." echo "Please file an issue at https://github.com/TheCase/IPMIView.app/issues regarding latest version discovery." - DOWNLOAD_FILENAME="IPMIView_2.21.1_build.230720_bundleJRE_Linux_x64.tar.gz" + DOWNLOAD_FILENAME="IPMIView_2.24.0_build.251224_bundleJRE_Linux_x64.tar.gz" fi LOCAL_DOWNLOAD_LOCATION="./SM_download" @@ -78,26 +79,74 @@ else echo "Press [Enter] to continue" && read answer fi -echo "Extracting contents of downloaded IPMIView archive..." -if [[ -d Contents/Resources/IPMIView ]]; then - rm -rf Contents/Resources/IPMIView +echo "Using Java from $JAVA_HOME" +arch=$( arch ) +if [ "$arch" = "x86_64" ] ; then + echo "Using ${arch} platform." +elif [ "$arch" = "arm64" -o "$arch" = "aarch64" ] ; then + echo "Using ${arch} platform. Checking Java version..." + + jarch=$( "${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1 | grep 'os.arch' | sed -e 's/.*=[ ]*//' ) + + if [ "x86_64" != "$jarch" ] ; then + echo "*" + echo "* This application bundle requires on x86-64 Java Runtime Environment (JRE/JDK)" + echo "* to run properly." + echo "*" + echo "* The Java platform is $jarch for JAVA_HOME=$JAVA_HOME" + echo "*" + echo "* Set your JAVA_HOME environment variable to an x86-64 JRE/JDK" + echo "* and run this script again." + echo "*" + echo "* In order to run an x86-64 JRE/JDK on your ${arch} computer, you will" + echo "* need to install Apple's Rosetta 2 software." + echo "*" + + if arch -x86_64 /usr/bin/true 2> /dev/null; then + echo "* Rosetta 2 appears to be installed, so you will already be able to run" + echo "* the x86-64 JRE/JDK once you install it (if necessary) and set JAVA_HOME" + echo "* to point to it." + else + echo "* Rosetta 2 can't be detected on this system, so it is probably not installed." + echo "* You can install it using this command:" + echo + echo "* softwareupdate --install-rosetta" + echo "*" + fi + + echo + echo "IPMIView.app was not built. Please read the messages above." + + exit 1 + else + echo "Java platform is $jarch for JAVA_HOME=$JAVA_HOME" + fi +else + echo "Unsupported platform: $arch" + exit 1 fi -mkdir -p Contents/Resources/IPMIView/Contents/Home/bin -tar -zxf "${LOCAL_DOWNLOAD_LOCATION}"/IPMIView*.tar* --strip=1 -C ./Contents/Resources/IPMIView/. || - { echo "Something went wrong, check download of IPMIView archive" && exit 1; } -echo "Linking 'java' and 'jre'..." -ln -s "${JAVA_HOME}/bin/java" Contents/Resources/IPMIView/Contents/Home/bin/java -rm -rf Contents/Resources/IPMIView/jre/* -pushd Contents/Resources/IPMIView/jre/ >/dev/null && - ln -s ../Contents . && - popd >/dev/null || exit +echo "Building IPMIView.app..." +if [ -f IPMIView.app/Contents/Resources/IPMIView/IPMIView.properties ] ; then + echo "Saving configuration properties IPMIView.app/Contents/Resources/IPMIView/IPMIView.properties" + cp -a IPMIView.app/Contents/Resources/IPMIView/IPMIView.properties ./IPMIView.properties.tmp || + { echo "Failed to save IPMIView.properties. Exiting."; exit 1; } +fi +rm -rf IPMIView.app +mkdir IPMIView.app +cp -a README.md Contents IPMIView.app/ +mkdir -p IPMIView.app/Contents/Resources/IPMIView/Contents/Home/bin +tar -zxf "${LOCAL_DOWNLOAD_LOCATION}"/IPMIView*.tar* --strip=1 --exclude='*/jre/*' -C IPMIView.app/Contents/Resources/IPMIView/. || + { echo "Something went wrong, check download of IPMIView archive" && exit 1; } +ln -s "${JAVA_HOME}/bin/java" IPMIView.app/Contents/Resources/IPMIView/Contents/Home/bin/java +if [ -f IPMIView.properties.tmp ] ; then + echo "Restoring IPMIView.app/Contents/Resources/IPMIView/IPMIView.properties" + cp -a IPMIView.properties.tmp IPMIView.app/Contents/Resources/IPMIView/IPMIView.properties || + { echo "Failed to restore IPMIView.properties. Exiting."; exit 1; } -echo "Copying IPMIView.app over to ~/Applications directory..." -pushd .. >/dev/null && - rsync -ar --exclude=.git --exclude=Contents/Resources/IPMIView/jre IPMIView.app ~/Applications && - popd >/dev/null || exit + rm IPMIView.properties.tmp +fi echo "Completed." echo -echo "You can now open ~/Applications/IPMIView.app" +echo "You can now open ./IPMIView.app or copy it into ~/Applications"