#!/bin/bash -x # # Copyright 2018 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # printenv mkdir -p /opt/config echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt HOST_IP=$(hostname -I) echo $HOST_IP `hostname` >> /etc/hosts mkdir -p /etc/docker if [ ! -z "__docker_proxy__" ]; then cat > /etc/docker/daemon.json < /etc/apt/apt.conf.d/30proxy<> /etc/sysctl.conf sysctl -p sleep 100 while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do mount /dockerdata-nfs sleep 5 done cp /dockerdata-nfs/rancher_agent_cmd.sh . sed -i "s/docker run/docker run -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh source rancher_agent_cmd.sh