diff --git a/.gitignore b/.gitignore index 7f2d61b..41d28b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ Contents/Resources/IPMIView +SM_download/ \ No newline at end of file diff --git a/README.md b/README.md index beb9bd6..9322849 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,54 @@ -### IPMIView (java) App wrapper for MacOS** +# IPMIView (java) App wrapper for MacOS -Download the latest IPMIView software from SuperMicro (to your home directories "Downloads" folder, aka `~/Downloads`: +## Quick Start -[https://ftp.supermicro.com/wftp/utility/IPMIView/Linux/](https://ftp.supermicro.com/wftp/utility/IPMIView/Linux/) - -Download the code and execute the script to unarchive the linux package and create the Application Bundle: ```bash cd ~ git clone https://github.com/TheCase/IPMIView.app cd IPMIView.app -sh script.sh +bash script.sh ``` You should now have an application icon in your home directory's Applications (aka `~/Applications`) folder. -#### Using the KVM Console +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. -You need to add an `Input Monitoring` exception for `java` in the `Security & Privacy` -\> `Privacy` Tab in `System Preferences`: +## Details + +Running the commands in the [Quick Start](#quick-start) section above will automatically: + +1) Clone this repository +2) Run the containing `script.sh` + 1) Download the needed files from SuperMicro's website + 2) Verify the downloaded files + 3) Extract and make the needed modifications to run on macOS + 4) Install the application to `~/Applications/IPMIView.app` + +### Download Information + +The script in this repo downloads files from SuperMicro's website located at: https://www.supermicro.com/wdl/utility/IPMIView/Linux/ + +### Using the KVM Console + +You need to add an `Input Monitoring` exception for `java` in the `Security & Privacy -> Privacy` Tab in `System Preferences`: - Open `System Preferences` - Click on `Security & Privacy` -- Click the `Privacy` button/tab -- Scroll down to `Input Monitoring` -(you may need to click the lock in the lower left and enter your password to add a new item) +- Click the `Privacy` tab +- Scroll down to `Input Monitoring` (you may need to click the lock in the lower left and enter your password to add a new item) - Click the plus `+` symbol -- In the top of the new window, select MacintoshHD in the pulldown -Library -> Java -> JavaVirtualMachines -> jdk\.jdk -> bin -> Contents -> Home -> bin +- 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 -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: +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: - Open `System Preferences` -> `Security & Privacy` -> `General` Tab and click `Allow Anyway` next to the message about the jnlilib that was blocked. - At this point you can try the `Launch KVM Console` button. You should be presented with another dialog about developer verification. Click the `Open` button. - This will trigger another denial window for the sharedLibs jnlilib. Repeat the approval process for this next jnlilib in the `Security Preference` Pane. - After performing these two approvals, the console should open. - -### Troubleshooting +## Troubleshooting If you have Java issues loading the app, please verify that you can run the app from the command line (and outside the jursdiction of this supplied wrapper). diff --git a/script.sh b/script.sh index 9d72787..70df870 100644 --- a/script.sh +++ b/script.sh @@ -1,9 +1,75 @@ -#!/bin/sh +#!/bin/bash set - + +DOWNLOAD_URL="https://www.supermicro.com/wdl/utility/IPMIView/Linux/" +LOCAL_DOWNLOAD_LOCATION="./SM_download" + +if which wget >/dev/null; then + echo "Downloading latest version of IPMIView from [${DOWNLOAD_URL}]..." + wget \ + --timestamping \ + --recursive \ + --level=1 \ + -q \ + --show-progress \ + --directory-prefix="${LOCAL_DOWNLOAD_LOCATION}/" \ + --no-parent \ + --no-directories \ + --reject index.html,index.html.tmp,robots.txt,robots.txt.tmp \ + "${DOWNLOAD_URL}" + rm "${LOCAL_DOWNLOAD_LOCATION}/"robots.txt* + + # Check MD5 + EXPECTED_MD5=$(\grep MD5 "${LOCAL_DOWNLOAD_LOCATION}/CheckSum.txt" | cut -d':' -f2 | tr -d "[:space:]" | tr '[:upper:]' '[:lower:]') + ACTUAL_MD5=$(md5sum "${LOCAL_DOWNLOAD_LOCATION}"/IPMIView*.tar* | cut -d' ' -f1 | tr -d "[:space:]" | tr '[:upper:]' '[:lower:]') + if ! diff <(echo "${EXPECTED_MD5}") <(echo "${ACTUAL_MD5}"); then + echo "MD5 is not as expected; download corrupted." + echo "Expected: [${EXPECTED_MD5}]" + echo "Actual: [${ACTUAL_MD5}]" + echo "Exiting." + exit 1 + fi + + # Check SHA-256 + EXPECTED_SHA256=$(\grep MD5 "${LOCAL_DOWNLOAD_LOCATION}/CheckSum.txt" | cut -d':' -f2 | tr -d "[:space:]" | tr '[:upper:]' '[:lower:]') + ACTUAL_SHA256=$(md5sum "${LOCAL_DOWNLOAD_LOCATION}"/IPMIView*.tar* | cut -d' ' -f1 | tr -d "[:space:]" | tr '[:upper:]' '[:lower:]') + if ! diff <(echo "${EXPECTED_SHA256}") <(echo "${ACTUAL_SHA256}"); then + echo "SHA-256 is not as expected; download corrupted." + echo "Expected: [${EXPECTED_SHA256}]" + echo "Actual: [${ACTUAL_SHA256}]" + echo "Exiting." + exit 1 + fi + +else + echo "WARNING: 'wget' CLI not found." + echo + echo "Please visit ${DOWNLOAD_URL} to download the latest version of IPMIView and copy the archive into $(pwd)/${LOCAL_DOWNLOAD_LOCATION}/" + echo + # shellcheck disable=SC2034,SC2162 + 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 +fi mkdir -p Contents/Resources/IPMIView/Contents/Home/bin -tar -zxvf ~/Downloads/IPMIView*.tar.gz --strip=1 -C ./Contents/Resources/IPMIView/. || - tar -xvf ~/Downloads/IPMIView*.tar --strip=1 -C ./Contents/Resources/IPMIView/. || +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 /usr/bin/java Contents/Resources/IPMIView/Contents/Home/bin/java -cd .. -rsync -arv --exclude=.git --exclude=Contents/Resources/IPMIView/jre IPMIView.app ~/Applications +rm -rf Contents/Resources/IPMIView/jre/* +pushd Contents/Resources/IPMIView/jre/ >/dev/null && + ln -s ../Contents . && + popd >/dev/null || exit + +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 + +echo "Completed." +echo +echo "You can now open ~/Applications/IPMIView.app"