Gary Wu | b718998 | 2018-11-14 10:01:37 -0800 | [diff] [blame^] | 1 | #!/bin/bash -x |
| 2 | # Copyright 2018 Huawei Technologies Co., Ltd. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | RANCHER_IMAGES=$(docker images | grep rancher | wc -l) |
| 11 | if [ $RANCHER_IMAGES -eq 0 ]; then |
| 12 | while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do |
| 13 | mount /dockerdata-nfs |
| 14 | sleep 10 |
| 15 | done |
| 16 | |
| 17 | cd ~ |
| 18 | cp /dockerdata-nfs/rancher_agent_cmd.sh . |
| 19 | sed -i "s/docker run/docker run -e CATTLE_HOST_LABELS='__host_label__=true' -e CATTLE_AGENT_IP=__host_private_ip_addr__/g" rancher_agent_cmd.sh |
| 20 | source rancher_agent_cmd.sh |
| 21 | fi |