#!/usr/bin/env bash cd /tmp mkdir EquitiesLabAppifyAlpha cd EquitiesLabAppifyAlpha if /usr/libexec/java_home -v 1.8 ; then true ; else open "http://www.google.com/search?btnI=I'm+Feeling+Lucky&q=jdk%208%20download" ; echo "after installing JDK 1.8, rerun this script"; exit 0; fi VERSION=4.0.1-EquitiesLab SCRIPT=`basename "$0"` APPNAME="EquitiesLabAlpha" cat < runjavawsEquitiesLabAlpha.sh #!/bin/bash javaws https://www.equitieslab.com/wiki/EquitiesLabAlpha.jnlp EOF chmod a+x /tmp/EquitiesLabAppifyAlpha/runjavawsEquitiesLabAlpha.sh APPSCRIPT=runjavawsEquitiesLabAlpha.sh curl https://www.equitieslab.com/wiki/EquitiesLabSquareLogo.icns > /tmp/EquitiesLabAppifyAlpha/EquitiesLabSquareLogo.icns APPICONS="EquitiesLabSquareLogo.icns" OSX_VERSION=`sw_vers -productVersion` PWD=`pwd` function usage { cat < Modified by Mathias Bynens Modified by Andrew Dvorak Rewritten by Duncan McGreggor Specialized for EquitiesLabAlpha by Henry Crutcher EOF exit 1 } function version { echo "v${VERSION}" exit 1 } function error { echo echo "ERROR: $1" echo usage } while :; do case $1 in -h | --help ) usage;; -s | --script ) APPSCRIPT="$2"; shift ;; -n | --name ) APPNAME="$2"; shift ;; -i | --icons ) APPICONS="$2"; shift ;; -v | --version ) version;; -- ) shift; break ;; * ) break ;; esac shift done if [ -z ${APPSCRIPT+nil} ]; then error "the script to appify must be provided!" fi if [ ! -f "$APPSCRIPT" ]; then error "the can't find the script '$APPSCRIPT'" fi if [ -a "$APPNAME.app" ]; then error "the bundle '$PWD/$APPNAME.app' already exists" fi APPDIR="$APPNAME.app/Contents" mkdir -vp "$APPDIR"/{MacOS,Resources} cp -v "$APPICONS" "$APPDIR/Resources/$APPNAME.icns" cp -v "$APPSCRIPT" "$APPDIR/MacOS/$APPNAME" chmod +x "$APPDIR/MacOS/$APPNAME" cat < "$APPDIR/Info.plist" CFBundleExecutable $APPNAME CFBundleGetInfoString $APPNAME CFBundleIconFile $APPNAME CFBundleName $APPNAME CFBundlePackageType APPL CFBundleSignature 4242 EOF echo "Application bundle created at '$PWD/$APPNAME.app'" echo cp -a $APPNAME.app ~/Applications