diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-09-26 11:35:50 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-09-26 11:37:15 +0200 |
| commit | 3f0713e89ad5792c2b026acc5621e0dc0386103d (patch) | |
| tree | 83274bae953191118183fffaa880016b6f4c603a | |
| parent | 10a559433814a8fd9a0493ffb1e91759ef815b5a (diff) | |
| download | mullvadvpn-3f0713e89ad5792c2b026acc5621e0dc0386103d.tar.xz mullvadvpn-3f0713e89ad5792c2b026acc5621e0dc0386103d.zip | |
Fix fish completions path on Applie Silicon Macs
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rwxr-xr-x | dist-assets/pkg-scripts/postinstall | 19 | ||||
| -rwxr-xr-x | dist-assets/uninstall_macos.sh | 10 |
3 files changed, 25 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d1f518b2..3f1a74f8ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ Line wrap the file at 100 chars. Th ## [Unreleased] +### Fixed + +#### macOS +- Fix fish shell completions when installed via Homebrew on Apple Silicon Macs. ## [2022.5-beta1] - 2022-09-26 diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall index 8286713e05..dfbbfe377c 100755 --- a/dist-assets/pkg-scripts/postinstall +++ b/dist-assets/pkg-scripts/postinstall @@ -49,7 +49,16 @@ EOM ) ZSH_COMPLETIONS_DIR="/usr/local/share/zsh/site-functions/" -FISH_COMPLETIONS_DIR="/usr/local/share/fish/vendor_completions.d/" + +BREW_PREFIX=$(brew --prefix) +if [[ "$?" -eq 0 ]]; then + FISH_COMPLETIONS_DIR="${BREW_PREFIX}/share/fish/vendor_completions.d/" + if [[ ! -d "$FISH_COMPLETIONS_DIR" ]]; then + FISH_COMPLETIONS_DIR="/usr/local/share/fish/vendor_completions.d/" + fi +else + FISH_COMPLETIONS_DIR="/usr/local/share/fish/vendor_completions.d/" +fi launchctl unload -w $DAEMON_PLIST_PATH cp "$LOG_DIR/daemon.log" "$LOG_DIR/old-install-daemon.log" \ @@ -66,9 +75,9 @@ mkdir -p /usr/local/bin ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad" /usr/local/bin/mullvad ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad-problem-report" /usr/local/bin/mullvad-problem-report -if [ -d "$FISH_COMPLETIONS_DIR" ]; then - ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad.fish" $FISH_COMPLETIONS_DIR -fi - mkdir -p "$ZSH_COMPLETIONS_DIR" ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/_mullvad" "$ZSH_COMPLETIONS_DIR/_mullvad" + +if [[ -d "$FISH_COMPLETIONS_DIR" ]]; then + ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad.fish" "$FISH_COMPLETIONS_DIR/mullvad.fish" +fi diff --git a/dist-assets/uninstall_macos.sh b/dist-assets/uninstall_macos.sh index 5be4bdc1fe..316c1d0f12 100755 --- a/dist-assets/uninstall_macos.sh +++ b/dist-assets/uninstall_macos.sh @@ -28,11 +28,15 @@ sudo /Applications/Mullvad\ VPN.app/Contents/Resources/mullvad-setup remove-devi echo "Removing zsh shell completion symlink ..." sudo rm -f /usr/local/share/zsh/site-functions/_mullvad -FISH_COMPLETIONS_PATH="/usr/local/share/fish/vendor_completions.d/mullvad.fish" -if [ -h "$FISH_COMPLETIONS_PATH" ]; then - echo "Removing fish shell completion symlink ..." +echo "Removing fish shell completion symlink ..." + +BREW_PREFIX=$(brew --prefix) +if [[ "$?" -eq 0 ]]; then + FISH_COMPLETIONS_PATH="${BREW_PREFIX}/share/fish/vendor_completions.d/mullvad.fish" sudo rm -f "$FISH_COMPLETIONS_PATH" fi +FISH_COMPLETIONS_PATH="/usr/local/share/fish/vendor_completions.d/mullvad.fish" +sudo rm -f "$FISH_COMPLETIONS_PATH" echo "Removing CLI symlinks from /usr/local/bin/ ..." sudo rm -f /usr/local/bin/mullvad /usr/local/bin/mullvad-problem-report |
