diff --git a/21.Initialize_environment/0_setup.sh b/21.Initialize_environment/0_setup.sh index eef646618ea0d903534cf6c2fe0db9acfaa09c02..87e6bc00cd359e1684127dde5ea2c46403bbafc7 100755 --- a/21.Initialize_environment/0_setup.sh +++ b/21.Initialize_environment/0_setup.sh @@ -14,12 +14,16 @@ nameserver 192.168.40.6 EOF # set ubicast account pwd -echo -e "${SHELL_UBICAST_PWD}\n${SHELL_UBICAST_PWD}" | (passwd -q ubicast) +if ( ! test -z ${SHELL_UBICAST_PWD} ); then + echo -e "${SHELL_UBICAST_PWD}\n${SHELL_UBICAST_PWD}" | passwd -q ubicast +fi # create admin account useradd -m admin --shell /bin/bash -echo -e "${SHELL_ADMIN_PWD}\n${SHELL_ADMIN_PWD}" | (passwd -q admin) usermod -aG sudo admin +if ( ! test -z ${SHELL_ADMIN_PWD} ); then + echo -e "${SHELL_ADMIN_PWD}\n${SHELL_ADMIN_PWD}" | passwd -q admin +fi # migrate to Ubuntu 16.04 / apply sources.list if [ $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "=" '{print$2}') = "16.04" ] diff --git a/22.Initialize_configuration_file/0_setup.sh b/22.Initialize_configuration_file/0_setup.sh index 39758b2710c87cf1ab3489dd10239d04199733e7..bae864ea0c952105bc1dfb6b9c2766d6e37c0625 100755 --- a/22.Initialize_configuration_file/0_setup.sh +++ b/22.Initialize_configuration_file/0_setup.sh @@ -1,19 +1,7 @@ #!/bin/bash source /root/envsetup/conf.sh -# Conf setup -sed -i "s@^NTP_SERVER1 = .*@NTP_SERVER1 = '${NTP}'@" /root/envsetup/conf.py -sed -i "s@^EMAIL_SMTP_SERVER = .*@EMAIL_SMTP_SERVER = '${EMAIL_SMTP_SERVER}'@" /root/envsetup/conf.py -sed -i "s@^MYSQL_ROOT_PWD = .*@MYSQL_ROOT_PWD = '${MYSQL_ROOT_PWD}'@" /root/envsetup/conf.py -# Wowza -sed -i "s@^wowza_server_name = .*@wowza_server_name = '${WOWZA}'@" /root/envsetup/conf.py -sed -i "s@^WOWZA_MANAGER_PWD = .*@WOWZA_MANAGER_PWD = '${WOWZA_MANAGER_PWD}'@" /root/envsetup/conf.py -sed -i "s@^WOWZA_LICENSE = .*@WOWZA_LICENSE = '${WOWZA_LICENSE}'@" /root/envsetup/conf.py -sed -i "s@^WOWZA_LIVE_PWD = .*@WOWZA_LIVE_PWD = '${WOWZA_LIVE_PWD}'@" /root/envsetup/conf.py -# MS -sed -i "s@^MS_SERVER_NAME = .*@MS_SERVER_NAME = '${MS_SERVER_NAME}'@" /root/envsetup/conf.py -sed -i "s@^MS_SUPERUSER_PWD = .*@MS_SUPERUSER_PWD = '${SUPERUSER_PWD}'@" /root/envsetup/conf.py -sed -i "s@^MS_ADMIN_PWD = .*@MS_ADMIN_PWD = '${ADMIN_PWD}'@" /root/envsetup/conf.py +# Autogenerate missing values if [ "${MS_ID}" = "" ]; then MS_ID=$(echo "$(hostname)_msuser") fi @@ -22,22 +10,12 @@ if [ "${MS_API_KEY}" = "" ]; then # respect API pattern MS_API_KEY=$(echo $MS_API_KEY | sed "s@[iloILO]@$((${RANDOM} / 10000))@g") fi -if [ "${MS_SECRET}" = "" ]; then +if [ "${MS_SECRET}" = "secret" ]; then MS_SECRET=$(echo "$(pwgen 40)") fi -sed -i "s@^MS_ID = .*@MS_ID = '${MS_ID}'@" /root/envsetup/conf.py -sed -i "s@^MS_API_KEY = .*@MS_API_KEY = '${MS_API_KEY}'@" /root/envsetup/conf.py -sed -i "s@^MS_SECRET = .*@MS_SECRET = '${MS_SECRET}'@" /root/envsetup/conf.py -# SK -sed -i "s@^CM_SERVER_NAME = .*@CM_SERVER_NAME = '${CM}'@" /root/envsetup/conf.py -sed -i "s@^CM_SUPERUSER_PWD = .*@CM_SUPERUSER_PWD = '${CM_SUPERUSER_PWD}'@" /root/envsetup/conf.py -sed -i "s@^CM_ADMIN_PWD = .*@CM_ADMIN_PWD = '${CM_ADMIN_PWD}'@" /root/envsetup/conf.py -# Monitor -sed -i "s@^MONITOR_SERVER_NAME = .*@MONITOR_SERVER_NAME = '${MONITOR}'@" /root/envsetup/conf.py -sed -i "s@^MONITOR_SUPERUSER_PWD = .*@MONITOR_SUPERUSER_PWD = '${MONITOR_SUPERUSER_PWD}'@" /root/envsetup/conf.py -sed -i "s@^MONITOR_ADMIN_PWD = .*@MONITOR_ADMIN_PWD = '${MONITOR_ADMIN_PWD}'@" /root/envsetup/conf.py -# Worker -sed -i "s@^CELERITY_SIGNING_KEY = .*@CELERITY_SIGNING_KEY = '${CELERITY_SIGNING_KEY}'@" /root/envsetup/conf.py -# IP for whitelist +sed -i "s@^MS_ID=.*@MS_ID='${MS_ID}'@" /root/envsetup/conf.sh +sed -i "s@^MS_API_KEY=.*@MS_API_KEY='${MS_API_KEY}'@" /root/envsetup/conf.sh +sed -i "s@^MS_SECRET=.*@MS_SECRET='${MS_SECRET}'@" /root/envsetup/conf.sh +# Worker IP for whitelist CELERITY_WORKER_IP=$(ip addr show | grep inet | grep -v 127 | grep -v ":" | awk -F " " '{print$2}' | awk -F "/" '{print$1}') -sed -i "s@^CELERITY_CELERITY_WORKER_IP = .*@CELERITY_CELERITY_WORKER_IP = '${CELERITY_WORKER_IP}'@" /root/envsetup/conf.py +sed -i "s@^CELERITY_CELERITY_WORKER_IP=.*@CELERITY_CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'@" /root/envsetup/conf.sh diff --git a/conf.sh b/conf.sh index 0815015727f5da9819889d05cce8f567ae8cb520..c1308c9aa0c336b973ed17d1add1368f2a21a748 100644 --- a/conf.sh +++ b/conf.sh @@ -2,6 +2,6 @@ # Envsetup local configuration file # See default configuration in default-conf.sh -source default-conf.sh +source /root/envsetup/default-conf.sh # Put your configuration here