Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit aa03199

Browse files
authored
Minor fixes
1 parent 898c459 commit aa03199

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

script-library/kubectl-helm-debian.sh

+15-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
4646
USERNAME=root
4747
fi
4848

49+
USERHOME="/home/$USERNAME"
50+
if [ "$USERNAME" = "root" ]; then
51+
USERHOME="/root"
52+
fi
53+
54+
4955
# Get central common setting
5056
get_common_setting() {
5157
if [ "${common_settings_file_loaded}" != "true" ]; then
@@ -158,9 +164,11 @@ fi
158164
kubectl completion bash > /etc/bash_completion.d/kubectl
159165

160166
# kubectl zsh completion
161-
mkdir -p "/home/${USERNAME}/.oh-my-zsh/completions"
162-
kubectl completion zsh > "/home/${USERNAME}/.oh-my-zsh/completions/_kubectl"
163-
chown -R "${USERNAME}" "/home/${USERNAME}/.oh-my-zsh"
167+
if [ -e "${USERHOME}}/.oh-my-zsh" ]; then
168+
mkdir -p "${USERHOME}/.oh-my-zsh/completions"
169+
kubectl completion zsh > "${USERHOME}/.oh-my-zsh/completions/_kubectl"
170+
chown -R "${USERNAME}" "${USERHOME}/.oh-my-zsh"
171+
fi
164172

165173
# Install Helm, verify signature and checksum
166174
echo "Downloading Helm..."
@@ -228,6 +236,10 @@ if [ "${MINIKUBE_VERSION}" != "none" ]; then
228236
echo '(!) minikube installation failed!'
229237
exit 1
230238
fi
239+
# Create minkube folder with correct privs in case a volume is mounted here
240+
mkdir -p "${USERHOME}/.minikube"
241+
chown -R $USERNAME "${USERHOME}/.minikube"
242+
chmod -R u+wrx "${USERHOME}/.minikube"
231243
fi
232244

233245
if ! type docker > /dev/null 2>&1; then

0 commit comments

Comments
 (0)