Hong Guan | 62f78a6 | 2017-11-21 11:00:42 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Hong Guan | 9000c85 | 2018-05-02 13:25:14 -0400 | [diff] [blame^] | 3 | # ============LICENSE_START========================================== |
| 4 | # =================================================================== |
| 5 | # Copyright (c) 2017 AT&T |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | #============LICENSE_END============================================ |
| 19 | |
Hong Guan | 62f78a6 | 2017-11-21 11:00:42 -0500 | [diff] [blame] | 20 | # |
| 21 | PUBIP="$1" |
| 22 | PVTIP="$2" |
| 23 | NEXUS_REPO="$3" |
| 24 | DOCKER_REPO="$4" |
| 25 | NEXUS_USERNAME="$5" |
| 26 | NEXUS_PASSWORD="$6" |
| 27 | ARTIFACTS_VERSION="$7" |
| 28 | DNS_IP="$8" |
| 29 | GERRIT_BRANCH="$9" |
| 30 | CLOUD_ENV="$10" |
| 31 | EXETERNAL_DNS="$11" |
| 32 | DMAAP_TOPIC="$12" |
| 33 | OPENSTACK_USERNAME="$13" |
| 34 | TENANT_ID="$14" |
| 35 | OPENSTACK_API_KEY="$15" |
| 36 | OPENSTACK_REGION="$16" |
| 37 | KEYSTONE="$17" |
| 38 | SO_REPO="$18" |
| 39 | DOCKER_VERSION="$19" |
| 40 | |
| 41 | export HOSTNAME=`hostname` |
| 42 | echo 127.0.1.1 $HOSTNAME >>/etc/hosts |
| 43 | echo $PVTIP $HOSTNAME >>/etc/hosts |
| 44 | echo $PUBIP $HOSTNAME >>/etc/hosts |
| 45 | |
| 46 | |
| 47 | mkdir /opt/config |
| 48 | chmod 777 /opt/config |
| 49 | echo $PUBIP > /opt/config/public_ip.txt |
| 50 | echo $NEXUS_REPO > /opt/config/nexus_repo.txt |
| 51 | echo $DOCKER_REPO > /opt/config/nexus_docker_repo.txt |
| 52 | echo $NEXUS_USERNAME > /opt/config/nexus_username.txt |
| 53 | echo $NEXUS_PASSWORD > /opt/config/nexus_password.txt |
| 54 | echo $ARTIFACTS_VERSION > /opt/config/artifacts_version.txt |
| 55 | echo $DNS_IP > /opt/config/dns_ip_addr.txt |
| 56 | echo $DOCKER_VERSION > /opt/config/docker_version.txt |
| 57 | echo $GERRIT_BRANCH > /opt/config/gerrit_branch.txt |
| 58 | echo $CLOUD_ENV > /opt/config/cloud_env.txt |
| 59 | echo $EXETERNAL_DNS > /opt/config/external_dns.txt |
| 60 | echo $DMAAP_TOPIC > /opt/config/dmaap_topic.txt |
| 61 | echo $OPENSTACK_USERNAME > /opt/config/openstack_username.txt |
| 62 | echo $TENANT_ID > /opt/config/tenant_id.txt |
| 63 | echo $OPENSTACK_API_KEY > /opt/config/openstack_api_key.txt |
| 64 | echo $OPENSTACK_REGION > /opt/config/openstack_region.txt |
| 65 | echo $KEYSTONE > /opt/config/keystone.txt |
| 66 | echo $SO_REPO > /opt/config/remote_repo.txt |
| 67 | |
| 68 | if [ ! -f /opt/rebooted ]; then |
| 69 | touch /opt/so_install.sh |
| 70 | chmod 777 /opt/so_install.sh |
| 71 | curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/so_install.sh -o /opt/so_install.sh |
| 72 | cd /opt |
| 73 | chmod +x so_install.sh |
| 74 | |
| 75 | echo " if [ ! -f /opt/rebooted ]; then" >/opt/install_tmp |
| 76 | echo " touch /opt/rebooted">>/opt/install_tmp |
| 77 | echo " reboot" >>/opt/install_tmp |
| 78 | echo " fi">>/opt/install_tmp |
| 79 | sed -i -e "/\treboot/r install_tmp" -e "//d" so_install.sh |
| 80 | fi |
| 81 | /opt/so_install.sh > so_install.log 2>&1 |