Build local app bundle#37
Conversation
Also auto-detect the architecture of the machine and the JVM. Stop and require the use of x86-64 and Rosetta on aarch64.
|
I may have put too many things together in one PR so let me know if you want me to re-work it. It's including a .class file which is super yucky, but I included the source there, too. The script with re-generate the .class file from the .java file if it's not there, but only if JAVA_HOME points to a JDK... |
| 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 the x86-64 JRE/JDK." | ||
| else | ||
| echo "You may also need to install Rosetta 2 to run an x86-64 Java Runtime Environment." | ||
| fi |
There was a problem hiding this comment.
the above echo seems to guide the user that they need to re-run the script, yet these two messages seem to guide them to different steps. is there perhaps a more clear way to surface the information to the user so it's clear what action(s) they need to take?
There was a problem hiding this comment.
Maybe.
In order to run IPMIView and use the KVM (which is pretty important), the prerequisites include an x86-64 JVM. You can do that on aarch64 as long as you (a) have the JVM (!!) and (b) have Rosetta 2 installed.
I'm not 100% sure if the "Rosetta 2 detection scheme" I have above will always work. I know it works for me, but it's entirely possible it won't work for others, or maybe it won't work in the future, so I hedged the language with "You may need to install..." rather than stating that it is absolutely a TODO.
There was a problem hiding this comment.
I'm happy to be more descriptive. In the first case, Rosetta 2 is definitely installed and all you need is the JVM.
In the second case, you probably need to download and install both.
There was a problem hiding this comment.
I'm not 100% sure if the "Rosetta 2 detection scheme" I have above will always work. I know it works for me, but it's entirely possible it won't work for others,
Yeah, that's fair - I'd honestly just lean on the community to help test this detection scheme to confirm one way or the other. I'm not suggesting this NEEDS to happen before this PR gets merged, but if folks are willing/able to ahead of the merge, that'd be great.
How about something like this as a straw man proposal:
if [ "x86_64" != "$jarch" ] ; then
rosetta_install_required=0
if ! arch -x86_64 /usr/bin/true 2> /dev/null; then
echo "[ERROR] On ${arch}, Rosetta 2 is needed to run an x86-64 Java Runtime Environment."
rosetta_install_required=1
fi
echo "[ERROR] The Java architecture for JAVA_HOME=$JAVA_HOME is $jarch. This application bundle requires an x86-64 JRE."
echo
echo "[FAILED] IPMIView.app was not built. Take the below step(s) and re-run the script."
echo " - Set JAVA_HOME to an x86-64 JRE."
if [ $rosetta_install_required -eq 1 ]; then
echo " - Install Rosetta 2."
fi
exit 1There was a problem hiding this comment.
Have a look at my most recent changes. I'm happy to change over to a bulleted-list of instructions if you think it's "too much to read".
| echo "Completed." | ||
| echo | ||
| echo "You can now open ~/Applications/IPMIView.app" | ||
| echo "You can now open ./IPMIView.app or copy it into ~/Applications" |
There was a problem hiding this comment.
can we keep this contract (that the script yields ~/Applications/IPMIView.app) the same? any particular reason to change it?
There was a problem hiding this comment.
I'm not married to local-only build, but this is the only product I know of that really wants to put itself into ~/Applications.
There's no reason to require it to go there other than it gets into Launchpad (eventually). You could also install it into /Applications if you chose to.
There was a problem hiding this comment.
Understand - ultimately, it's up to the person running this script to decide where they ultimately want the app to live (in /Applications, or elsewhere). My point is that the change here is moving where it is currently stored, which might be unexpected by users who have known the script to generate the app into ~/Applications directory. If that's something that we really really want to change, then I'd recommend we also update all other references to this, and put a clear notification to folks in the README stating that the location the app is generated to has moved.
There was a problem hiding this comment.
I'll fix this and maybe make it a completely separate PR.
Use java -XshowSettings:properties instead of custom code
|
@ChrisCarini and @ChristopherSchultz, you have both be added as invited collaborators on this project. Feel free to take it under your collective wings. I'll remain a bystander but will probably not be able to contribute in the near term. If you have any issues with access for making changes, reviewing or merging - please do let me know. |
Thanks @TheCase - you had actually already added me as a collaborator a while back :P But appreciate the sentiment again! ❤️ |
|
Also, if either of you would prefer to host a new active fork under either of your accounts, I can adjust the project notes to direct folks to the project repo that is under active development. |
If that's desired/preferred, I'd be happy to volunteer to take it. I think for the time being, it should be ok - should we run into other problems where we need to consider a transfer/fork, I'd vote we have that conversation then. WDYT @TheCase ? |
|
Works for me :) |
|
@TheCase @ChrisCarini I think this is ready. The last part was ensuring that Can I get a review -- even if only to confirm that the build works in your environments and the app bundle ends up being usable? I had another emergency this morning, and so |
ChrisCarini
left a comment
There was a problem hiding this comment.
Generally looks good.
However when I tried testing this (using the quick start instructions, modifying the clone to use your fork + this PR branch before invoking the script), I just got an application that would appear to take a while to open, but not actually open anything. Did you happen to notice anything like this at all when you were developing?
|
|
||
| if [ "x86_64" != "$jarch" ] ; then | ||
| echo "*" | ||
| echo "* This application bundle requires on x86-64 Java Runtime Environment (JRE/JDK)" |
There was a problem hiding this comment.
| echo "* This application bundle requires on x86-64 Java Runtime Environment (JRE/JDK)" | |
| echo "* This application bundle requires a x86-64 Java Runtime Environment (JRE/JDK)" |
| 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." |
There was a problem hiding this comment.
| 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 "* In order to run an x86-64 JRE/JDK on your ${arch} computer," | |
| echo "* Apple's Rosetta 2 software is required." |
| echo "* the x86-64 JRE/JDK once you install it (if necessary) and set JAVA_HOME" | ||
| echo "* to point to it." |
There was a problem hiding this comment.
| echo "* the x86-64 JRE/JDK once you install it (if necessary) and set JAVA_HOME" | |
| echo "* to point to it." | |
| echo "* the x86-64 JRE/JDK once installed and JAVA_HOME is set 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 |
There was a problem hiding this comment.
| echo | |
| echo "*" |
(for consistency 😄)
| ``` | ||
|
|
||
| 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. |
There was a problem hiding this comment.
| 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. | |
| You should now have an application icon in the current directory. You can copy it into `/Applications/`, `~/Applications/`, or run it from the git repo root, if you'd like. |
| echo "Extracting contents of downloaded IPMIView archive..." | ||
| if [[ -d Contents/Resources/IPMIView ]]; then | ||
| rm -rf Contents/Resources/IPMIView | ||
| echo "Using Java from $JAVA_HOME" |
There was a problem hiding this comment.
Let's move this entire block/check to the top so the script can fail fast - right now the script will download files (which can take a bit, depending on the user's internet connection), and then show this message to the user; its be better UX to fail fast.
| 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" |
There was a problem hiding this comment.
| echo "* The Java platform is $jarch for JAVA_HOME=$JAVA_HOME" | |
| echo "* The Java platform is ${jarch} for JAVA_HOME=${JAVA_HOME}" |
(personal pref, but suggesting this for consistency sake)
| if [ "$arch" = "x86_64" ] ; then | ||
| echo "Using ${arch} platform." | ||
| elif [ "$arch" = "arm64" -o "$arch" = "aarch64" ] ; then | ||
| echo "Using ${arch} platform. Checking Java version..." |
There was a problem hiding this comment.
| if [ "$arch" = "x86_64" ] ; then | |
| echo "Using ${arch} platform." | |
| elif [ "$arch" = "arm64" -o "$arch" = "aarch64" ] ; then | |
| echo "Using ${arch} platform. Checking Java version..." | |
| echo "Using ${arch} platform." | |
| if [ "$arch" = "arm64" -o "$arch" = "aarch64" ] ; then | |
| echo "Checking Java version..." |
| @@ -9,7 +9,7 @@ cd IPMIView.app | |||
| bash script.sh | |||
| ``` | |||
There was a problem hiding this comment.
At the very least, let's get a short **Note:** ... here guiding users how to invoke this on arm64 Macs; we're close enough to EOL that it's worth doing, IMO.
| 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" |
There was a problem hiding this comment.
Thanks for updating the version! 💪
|
Hi, I know this is pretty old but any chance this makes it to a new version? As I was troubleshooting this same issue, I manually added the Thanks to all that have contributed to this. It saved me from a lot of walking! |
Builds IPMIview.app locally instead of into ~/Applications.
Detects architecture and requires x86-64 on aarm64.
Saves the connection properties from the old application bundle.