Skip to content

Commit

Permalink
fix: Update kubectl-kui location on macOS to Kui.app/Contents/Resources
Browse files Browse the repository at this point in the history
This change is suggested because I'm submitting a Cask to Homebrew and would like to include the kubectl-kui binary in /usr/local/bin directly while installing the application to /Applications. Additionally, I ran by habit "kubectl kui get pods" from inside Kui and it appeared to hang indefinitely. This script prevents that, though it doesn't produce pretty output like Kui normally would.

Signed-off-by: Louis St-Amour <louisstamour@gmail.com>
  • Loading branch information
LouisStAmour authored and starpit committed Jun 15, 2020
1 parent 7a84d25 commit 1df1473
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions packages/builder/dist/electron/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@ function mac {
mv "$BUILDDIR/${PRODUCT_NAME}-darwin-x64/" "$BUILDDIR/${CLIENT_NAME}-darwin-x64/"
fi

echo "Add kubectl-kui to electron build darwin"
(cd "$BUILDDIR/${CLIENT_NAME}-darwin-x64" && touch kubectl-kui && chmod +x kubectl-kui \
&& echo '#!/usr/bin/env sh
export KUI_POPUP_WINDOW_RESIZE=true
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
"$SCRIPTDIR"/Kui.app/Contents/MacOS/Kui kubectl $@ &' >> kubectl-kui)

# create the installers
#if [ -n "$ZIP_INSTALLER" ]; then
#node ./builders/zip.js
Expand All @@ -243,6 +236,36 @@ SCRIPTDIR=$(cd $(dirname "$0") && pwd)
MAC_DMG_PID=$!
fi

echo "Add kubectl-kui to electron build darwin"
(cd "$BUILDDIR/${CLIENT_NAME}-darwin-x64/${PRODUCT_NAME}.app/Contents/Resources/" \
&& touch kubectl-kui && chmod +x kubectl-kui \
&& echo '#!/usr/bin/env bash
export KUI_POPUP_WINDOW_RESIZE=true
# credit: https://unix.stackexchange.com/a/521984
bash_realpath() {
# print the resolved path
# @params
# 1: the path to resolve
# @return
# &1: the resolved link path
local path="${1}"
while [[ -L ${path} && "$(ls -l "${path}")" =~ -\>\ (.*) ]]
do
path="${BASH_REMATCH[1]}"
done
echo "${path}"
}
APP_RESOURCES_DIR="$(dirname "$(bash_realpath "$0")")"
if [ "$KUI" != "true" ]; then
"$APP_RESOURCES_DIR/../MacOS/Kui" kubectl $@ &
else
"$APP_RESOURCES_DIR/../MacOS/Kui" kubectl $@
fi
' >> kubectl-kui)

echo "TGZ build for darwin"
tar -C "$BUILDDIR" -jcf "$BUILDDIR/${CLIENT_NAME}-darwin-x64.tar.bz2" "${CLIENT_NAME}-darwin-x64" &
MAC_TAR_PID=$!
Expand Down

0 comments on commit 1df1473

Please sign in to comment.