summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-04-02 12:47:10 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-04-17 10:28:11 +0200
commite0779398b7c857a139fa376b8a500011a95910e8 (patch)
tree3641aad40244ddb62641cf34602a6ec65e59eab0
parent07f3c3664312a66c974e2c417722bfd42e5fc051 (diff)
downloadmullvadvpn-e0779398b7c857a139fa376b8a500011a95910e8.tar.xz
mullvadvpn-e0779398b7c857a139fa376b8a500011a95910e8.zip
Install shell completions on macOS
-rwxr-xr-xdist-assets/pkg-scripts/postinstall5
-rwxr-xr-xdist-assets/uninstall_macos.sh3
-rw-r--r--gui/tasks/distribution.js1
3 files changed, 9 insertions, 0 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index 51283fea35..803e9cf276 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -48,6 +48,8 @@ DAEMON_PLIST=$(cat <<-EOM
EOM
)
+ZSH_COMPLETIONS_DIR="/usr/local/share/zsh/site-functions/"
+
"$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad-setup" prepare-restart || true
pkill -x "Mullvad VPN" || echo "Unable to kill GUI, not running?"
@@ -60,3 +62,6 @@ launchctl load -w $DAEMON_PLIST_PATH
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
+
+mkdir -p "$ZSH_COMPLETIONS_DIR"
+ln -sf "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/_mullvad" "$ZSH_COMPLETIONS_DIR/_mullvad"
diff --git a/dist-assets/uninstall_macos.sh b/dist-assets/uninstall_macos.sh
index aec74760b4..48114045b2 100755
--- a/dist-assets/uninstall_macos.sh
+++ b/dist-assets/uninstall_macos.sh
@@ -22,6 +22,9 @@ echo "Removing app from /Applications ..."
sudo rm -rf /Applications/Mullvad\ VPN.app
sudo pkgutil --forget net.mullvad.vpn || true
+echo "Removing shell completion symlink ..."
+sudo rm -f /usr/local/share/zsh/site-functions/_mullvad
+
echo "Removing CLI symlinks from /usr/local/bin/ ..."
sudo rm -f /usr/local/bin/mullvad /usr/local/bin/mullvad-problem-report
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js
index 0499c810d5..0a9a6ad465 100644
--- a/gui/tasks/distribution.js
+++ b/gui/tasks/distribution.js
@@ -53,6 +53,7 @@ const config = {
{ from: distAssets('binaries/x86_64-apple-darwin/openvpn'), to: '.' },
{ from: distAssets('binaries/x86_64-apple-darwin/sslocal'), to: '.' },
{ from: distAssets('uninstall_macos.sh'), to: './uninstall.sh' },
+ { from: distAssets('shell-completions/_mullvad'), to: '.' },
],
},