From 02c54036416810c8e15285aa5573fa9231dc7284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu> Date: Thu, 29 Sep 2016 17:28:32 +0200 Subject: [PATCH] Do not generate random values for already defined MS values. --- 22.Initialize_configuration_file/0_setup.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/22.Initialize_configuration_file/0_setup.sh b/22.Initialize_configuration_file/0_setup.sh index 5fa1281c..c1ea490e 100755 --- a/22.Initialize_configuration_file/0_setup.sh +++ b/22.Initialize_configuration_file/0_setup.sh @@ -14,13 +14,19 @@ sed -i "s@^wowza_live_pwd = .*@wowza_live_pwd = '${WOWZA_LIVE_PASSWD}'@" /root/e sed -i "s@^ms_server_name = .*@ms_server_name = '${MS}'@" /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 -MS_ID=$(echo "$(hostname)_msuser") -MS_API=$(echo "s$(pwgen 4)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)") -# respect API pattern -MS_API=$(echo $MS_API | sed "s@[iloILO]@$((${RANDOM} / 10000))@g") +if [ "${MS_ID}" = "" ]; then + MS_ID=$(echo "$(hostname)_msuser") +fi +if [ "${MS_API}" = "" ]; then + MS_API=$(echo "s$(pwgen 4)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)") + # respect API pattern + MS_API=$(echo $MS_API | sed "s@[iloILO]@$((${RANDOM} / 10000))@g") +fi +if [ "${MS_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}'@" /root/envsetup/conf.py -MS_SECRET=$(echo "$(pwgen 40)") sed -i "s@^ms_secret = .*@ms_secret = '${MS_SECRET}'@" /root/envsetup/conf.py # SK sed -i "s@^skyreach_server_name = .*@skyreach_server_name = '${CM}'@" /root/envsetup/conf.py -- GitLab