From f99cb96e81cb93dc7293ebee5c3452b0c8ff708d Mon Sep 17 00:00:00 2001 From: Chris Wedgwood Date: Mon, 2 Oct 2017 23:28:08 +0000 Subject: [PATCH] gate: move 'root check' to setup Change-Id: I4d365390d673c45eb2bb1ff885ee1c74e632d5d8 --- tools/gate/setup_gate.sh | 7 +++++++ tools/kubeadm-aio/kubeadm-aio-launcher.sh | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/gate/setup_gate.sh b/tools/gate/setup_gate.sh index 399f67ca52..06b2560f1b 100755 --- a/tools/gate/setup_gate.sh +++ b/tools/gate/setup_gate.sh @@ -12,6 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. set -ex + +# Exit if run as root +if [[ $EUID -eq 0 ]]; then + echo "This script cannot be run as root" 1>&2 + exit 1 +fi + export WORK_DIR=$(pwd) source ${WORK_DIR}/tools/gate/vars.sh source ${WORK_DIR}/tools/gate/funcs/common.sh diff --git a/tools/kubeadm-aio/kubeadm-aio-launcher.sh b/tools/kubeadm-aio/kubeadm-aio-launcher.sh index 77c80025ff..88bb90fba5 100755 --- a/tools/kubeadm-aio/kubeadm-aio-launcher.sh +++ b/tools/kubeadm-aio/kubeadm-aio-launcher.sh @@ -15,12 +15,6 @@ # under the License. set -xe -# Exit if run as root -if [[ $EUID -eq 0 ]]; then - echo "This script cannot be run as root" 1>&2 - exit 1 -fi - # Setup shared mounts for kubelet sudo mkdir -p /var/lib/kubelet sudo mount --bind /var/lib/kubelet /var/lib/kubelet