X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2Finstall-macosx;fp=altosui%2Finstall-macosx;h=8f0067e5a030190d3fbb25656a8338361a4b57bf;hb=583a749724700845d2d3552a0d3a759f16b25cfe;hp=aced4ab9280748189f137f223b4b72cdb33fc3db;hpb=ffbd99545ca0462161c24e0ed86978544f2c28f6;p=fw%2Faltos diff --git a/altosui/install-macosx b/altosui/install-macosx index aced4ab9..8f0067e5 100755 --- a/altosui/install-macosx +++ b/altosui/install-macosx @@ -1,37 +1,47 @@ #!/bin/bash +JVM=/Library/Java/JavaVirtualMachines +dir=`dirname "$0"` + case `id -u` in 0) ;; *) - # Check for java - if [ ! -d /Library/Java/JavaVirtualMachines/ -o `ls /Library/Java/JavaVirtualMachine` == '' ]; then - open https://adoptopenjdk.net/ - osascript -e 'display dialog "Install Java from https://adoptopenjdk.net then click OK" buttons {"Continue"}' - fi - sudo "$0" "$@" + SUDO_ASKPASS="${dir}/ask-pass" sudo -A "$0" "$@" + exit 0 ;; esac -dir=`dirname "$0"` +# Check for java +if ls "$JVM" | grep -q adopt; then + echo "Adopt OpenJDK already present" +else + open https://adoptopenjdk.net/ + osascript -e 'display dialog "Install Java from https://adoptopenjdk.net then click Continue" buttons {"Continue"} default button 1 with title "Install Java"' >/dev/null +fi + cd "$dir" -APP=`echo *.app` LIBRARY=/Library/AltusMetrum -APPLICATIONS=/Applications/ +APPLICATIONS=/Applications +INSTALLED= for file in *; do - case "$i" in + echo 'Installing' "$file" + case "$file" in *.app) - mkdir -p "$(APPLICATIONS)" - if [ -d "$(APPLICATIONS)/$(APP)/." ]; then - rm -rf "$(APPLICATIONS)/$(APP)" + mkdir -p "${APPLICATIONS}" + if [ -d "${APPLICATIONS}/${file}" ]; then + rm -rf "${APPLICATIONS}/${file}" fi - cp -a "$i" "$(APPLICATIONS)/$(APP)" - chmod +w "$(APPLICATIONS)/$(APP)"/* - xattr -c "$(APPLICATIONS)/$(APP)"/* + cp -a "$file" "${APPLICATIONS}/${file}" + chmod -R +w "${APPLICATIONS}/${file}" + xattr -rc "${APPLICATIONS}/${file}" + APP=`basename "$file" .app` + INSTALLED="${INSTALLED} ${APP}" ;; *) - mkdir -p "$(LIBRARY)" - cp -a "$i" "$(LIBRARY)" + mkdir -p "${LIBRARY}" + cp -a "$file" "${LIBRARY}" ;; esac done +osascript -e 'display dialog "Installation of'"${INSTALLED}"' complete" with title "Installation Complete" buttons {"OK"} default button 1' >/dev/null