install.fairie/home/dot_local/bin/post-installx/executable_post-mise.sh

22 lines
1.1 KiB
Bash
Raw Normal View History

2024-05-04 21:05:33 -07:00
#!/usr/bin/env bash
# @file Mise Install / Tweaks
# @brief Performs initial install of mise targets and applies tweaks such as symlinking mise's Java version with the system Java target on macOS
2024-05-27 20:45:14 -07:00
set -Eeuo pipefail
2024-05-27 20:50:11 -07:00
trap "gum log -sl error 'Script encountered an error!'" ERR
2024-05-27 04:15:03 -07:00
2024-05-04 21:05:33 -07:00
if command -v mise > /dev/null; then
2024-05-27 20:50:11 -07:00
gum log -sl info 'Running mise install' && mise install
2024-05-04 21:05:33 -07:00
### Symlink Java on macOS
if [ -d /Applications ] && [ -d /System ]; then
2024-05-05 22:44:55 -07:00
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/mise/installs/java/openjdk-20/Contents" ] && [ ! -d "/Library/Java/JavaVirtualMachines/openjdk-20.jdk/Contents" ]; then
2024-05-27 23:55:42 -07:00
gum log -sl info "Symlinking system Java to mise-installed Java" target "${XDG_DATA_HOME:-$HOME/.local/share}/mise/installs/java/openjdk-20/Contents" symlink "/Library/Java/JavaVirtualMachines/openjdk-20.jdk/Contents"
2024-05-04 21:05:33 -07:00
sudo mkdir -p /Library/Java/JavaVirtualMachines/openjdk-20.jdk
sudo ln -s "${XDG_DATA_HOME:-$HOME/.local/share}/mise/installs/java/openjdk-20/Contents" /Library/Java/JavaVirtualMachines/openjdk-20.jdk/Contents
fi
fi
else
2024-05-27 20:50:11 -07:00
gum log -sl info 'mise is not available on the PATH'
2024-05-04 21:05:33 -07:00
fi