From ead0e9dc6d90dc59c74d3a91255d570191208044 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 25 Aug 2020 11:59:30 +0800 Subject: [PATCH] fix(k8s): init-kubectl shell file can be compatible with centos --- cmd/locale/zh_CN/LC_MESSAGES/koko.po | 2 +- utils/init-kubectl.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/locale/zh_CN/LC_MESSAGES/koko.po b/cmd/locale/zh_CN/LC_MESSAGES/koko.po index 58d276c39..3de4b95e0 100644 --- a/cmd/locale/zh_CN/LC_MESSAGES/koko.po +++ b/cmd/locale/zh_CN/LC_MESSAGES/koko.po @@ -302,7 +302,7 @@ msgstr "系统用户<%s>和kubernetes<%s>协议不一致" #: pkg/proxy/k8sproxy.go:98 #, fuzzy msgid "%s protocol client not installed." -msgstr "%s 协议的数据库客户端未安装" +msgstr "%s 协议的客户端未安装" #. i18n.T #: pkg/proxy/k8sproxy.go:106 diff --git a/utils/init-kubectl.sh b/utils/init-kubectl.sh index 9f27746a1..02ef8a0dc 100644 --- a/utils/init-kubectl.sh +++ b/utils/init-kubectl.sh @@ -1,5 +1,11 @@ #!/bin/bash set -e +function init_nobody_user(){ + echo `getent passwd | grep 'nobody' | grep '/nonexistent' || usermod -d /nonexistent nobody` > /dev/null 2>&1 + echo `getent group | grep 'nogroup' || groupadd nogroup` > /dev/null 2>&1 +} +export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +init_nobody_user if [ "${WELCOME_BANNER}" ]; then echo ${WELCOME_BANNER} @@ -41,6 +47,7 @@ if [ ${KUBECTL_INSECURE_SKIP_TLS_VERIFY} == "true" ];then fi chown -R nobody:nogroup .kube +chown -R nobody:nogroup .bashrc export TMPDIR=/nonexistent