Hong Guan | 62f78a6 | 2017-11-21 11:00:42 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # |
| 4 | PUBIP="$1" |
| 5 | PVTIP="$2" |
| 6 | NEXUS_REPO="$3" |
| 7 | DOCKER_REPO="$4" |
| 8 | NEXUS_USERNAME="$5" |
| 9 | NEXUS_PASSWORD="$6" |
| 10 | ARTIFACTS_VERSION="$7" |
| 11 | DNS_IP="$8" |
| 12 | GERRIT_BRANCH="$9" |
| 13 | CLOUD_ENV="$10" |
| 14 | EXETERNAL_DNS="$11" |
| 15 | DMAAP_TOPIC="$12" |
| 16 | OPENSTACK_USERNAME="$13" |
| 17 | TENANT_ID="$14" |
| 18 | OPENSTACK_API_KEY="$15" |
| 19 | OPENSTACK_REGION="$16" |
| 20 | KEYSTONE="$17" |
| 21 | SO_REPO="$18" |
| 22 | DOCKER_VERSION="$19" |
| 23 | |
| 24 | export HOSTNAME=`hostname` |
| 25 | echo 127.0.1.1 $HOSTNAME >>/etc/hosts |
| 26 | echo $PVTIP $HOSTNAME >>/etc/hosts |
| 27 | echo $PUBIP $HOSTNAME >>/etc/hosts |
| 28 | |
| 29 | |
| 30 | mkdir /opt/config |
| 31 | chmod 777 /opt/config |
| 32 | echo $PUBIP > /opt/config/public_ip.txt |
| 33 | echo $NEXUS_REPO > /opt/config/nexus_repo.txt |
| 34 | echo $DOCKER_REPO > /opt/config/nexus_docker_repo.txt |
| 35 | echo $NEXUS_USERNAME > /opt/config/nexus_username.txt |
| 36 | echo $NEXUS_PASSWORD > /opt/config/nexus_password.txt |
| 37 | echo $ARTIFACTS_VERSION > /opt/config/artifacts_version.txt |
| 38 | echo $DNS_IP > /opt/config/dns_ip_addr.txt |
| 39 | echo $DOCKER_VERSION > /opt/config/docker_version.txt |
| 40 | echo $GERRIT_BRANCH > /opt/config/gerrit_branch.txt |
| 41 | echo $CLOUD_ENV > /opt/config/cloud_env.txt |
| 42 | echo $EXETERNAL_DNS > /opt/config/external_dns.txt |
| 43 | echo $DMAAP_TOPIC > /opt/config/dmaap_topic.txt |
| 44 | echo $OPENSTACK_USERNAME > /opt/config/openstack_username.txt |
| 45 | echo $TENANT_ID > /opt/config/tenant_id.txt |
| 46 | echo $OPENSTACK_API_KEY > /opt/config/openstack_api_key.txt |
| 47 | echo $OPENSTACK_REGION > /opt/config/openstack_region.txt |
| 48 | echo $KEYSTONE > /opt/config/keystone.txt |
| 49 | echo $SO_REPO > /opt/config/remote_repo.txt |
| 50 | |
| 51 | if [ ! -f /opt/rebooted ]; then |
| 52 | touch /opt/so_install.sh |
| 53 | chmod 777 /opt/so_install.sh |
| 54 | curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/so_install.sh -o /opt/so_install.sh |
| 55 | cd /opt |
| 56 | chmod +x so_install.sh |
| 57 | |
| 58 | echo " if [ ! -f /opt/rebooted ]; then" >/opt/install_tmp |
| 59 | echo " touch /opt/rebooted">>/opt/install_tmp |
| 60 | echo " reboot" >>/opt/install_tmp |
| 61 | echo " fi">>/opt/install_tmp |
| 62 | sed -i -e "/\treboot/r install_tmp" -e "//d" so_install.sh |
| 63 | fi |
| 64 | /opt/so_install.sh > so_install.log 2>&1 |