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