Debian Codegraph @

altosui/install-macosx

raw
1 #!/bin/bash
2
3 JVM=/Library/Java/JavaVirtualMachines
4 dir=`dirname "$0"`
5
6 case `id -u` in
7 0)
8 ;;
9 *)
10 SUDO_ASKPASS="${dir}/ask-pass" sudo -A "$0" "$@"
11 case $? in
12 0)
13 ;;
14 *)
15 osascript -e 'display dialog "Installation failed. Incorrect password?" buttons {"OK"} default button 1 with title "Installation Status"' > /dev/null
16 ;;
17 esac
18 exit 0
19 ;;
20 esac
21
22 # Check for java
23 if ls "$JVM" | grep -q temurin; then
24 echo "Adoptium already present"
25 else
26 open https://adoptium.net/
27 osascript -e 'display dialog "Install Java from https://adoptium.net then click Continue" buttons {"Continue"} default button 1 with title "Install Java"' >/dev/null
28 fi
29
30 cd "$dir"
31 LIBRARY=/Library/AltusMetrum
32 APPLICATIONS=/Applications
33 INSTALLED=
34 for file in *; do
35 echo 'Installing' "$file"
36 case "$file" in
37 *.app)
38 mkdir -p "${APPLICATIONS}"
39 if [ -d "${APPLICATIONS}/${file}" ]; then
40 rm -rf "${APPLICATIONS}/${file}"
41 fi
42 cp -a "$file" "${APPLICATIONS}/${file}"
43 chmod -R +w "${APPLICATIONS}/${file}"
44 xattr -rc "${APPLICATIONS}/${file}"
45 APP=`basename "$file" .app`
46 INSTALLED="${INSTALLED} ${APP}"
47 ;;
48 *)
49 mkdir -p "${LIBRARY}"
50 cp -a "$file" "${LIBRARY}"
51 ;;
52 esac
53 done
54 open "${LIBRARY}"
55 osascript -e 'display dialog "Installation of'"${INSTALLED}"' complete" with title "Installation Complete" buttons {"OK"} default button 1' >/dev/null