diff --git a/10.VM/1.Export_VM/0_setup.sh b/10.VM/1.Export_VM/0_setup.sh index 66e77a00fae53a09b8075c5c56fd17ac1843eea1..4f92fdb189e8e590606803affdf3fc76c48200c1 100755 --- a/10.VM/1.Export_VM/0_setup.sh +++ b/10.VM/1.Export_VM/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh KEY=~/.ssh/ubicast_support VM_HYPER=$(grep VM_HYPER ${CONF} | awk -F "=" '{print$2}') diff --git a/10.VM/2.Export_VM_local/0_setup.sh b/10.VM/2.Export_VM_local/0_setup.sh index 5ce30466f68c94be888733af856ad7d15c410bf6..2c4a320cae63ae7d24fc4e3d6d96352f30085a3e 100755 --- a/10.VM/2.Export_VM_local/0_setup.sh +++ b/10.VM/2.Export_VM_local/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh VM_STORE=/home/jallary/ubicast/TMP/ENVOI VM_STORE_LOCAL=/home/jallary/ubicast/TMP/ENVOI diff --git a/2.Common_services/6.Munin/0_setup.sh b/2.Common_services/6.Munin/0_setup.sh index f779b19d64c4ca715c8750a29dc6ce096d996d9d..9bad0efce6863a9a9f6b2b29acbf22702136996f 100755 --- a/2.Common_services/6.Munin/0_setup.sh +++ b/2.Common_services/6.Munin/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # This script should be run after Nginx, MySQL and Wowza setup (if they should be installed) diff --git a/20.Client configuration & testing/1.Apply_client_configuration/0_setup.sh b/20.Client_configuration/1.Apply_client_configuration/0_setup.sh similarity index 99% rename from 20.Client configuration & testing/1.Apply_client_configuration/0_setup.sh rename to 20.Client_configuration/1.Apply_client_configuration/0_setup.sh index 7b8c2eb13ba7578f73b7971685509776f8099271..c57465cf89aa68270aeb31a894608849d67a631c 100755 --- a/20.Client configuration & testing/1.Apply_client_configuration/0_setup.sh +++ b/20.Client_configuration/1.Apply_client_configuration/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh echo -e " ${RED}Customer parameters will be applied after rebooting. Note that you won't be able to login to the machine after this operation !${NC}" diff --git a/20.Client configuration & testing/2.Dump_config/0_setup.sh b/20.Client_configuration/2.Dump_config/0_setup.sh similarity index 98% rename from 20.Client configuration & testing/2.Dump_config/0_setup.sh rename to 20.Client_configuration/2.Dump_config/0_setup.sh index 36381460445955af54918fdf9ba702a14a706189..f6c17e964302cf57e2e69ca3d7ca6663afdd4367 100755 --- a/20.Client configuration & testing/2.Dump_config/0_setup.sh +++ b/20.Client_configuration/2.Dump_config/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # generate post-deployment conf file echo "SOURCES.LIST" > /root/deployment.results diff --git a/20.Client configuration & testing/3.Configure_client_smtp/0_setup.sh b/20.Client_configuration/3.Configure_client_smtp/0_setup.sh similarity index 80% rename from 20.Client configuration & testing/3.Configure_client_smtp/0_setup.sh rename to 20.Client_configuration/3.Configure_client_smtp/0_setup.sh index 412473307f3623e526d1a871fbf39390546d7245..2b220b13b14bdf4495c8091b9763f9fe38e5ae00 100755 --- a/20.Client configuration & testing/3.Configure_client_smtp/0_setup.sh +++ b/20.Client_configuration/3.Configure_client_smtp/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # set SMTP if ( ! test -z ${EMAIL_SMTP_SERVER} ) diff --git a/20.Client configuration & testing/4.Apply_default_configuration/0_setup.sh b/20.Client_configuration/4.Apply_default_configuration/0_setup.sh similarity index 95% rename from 20.Client configuration & testing/4.Apply_default_configuration/0_setup.sh rename to 20.Client_configuration/4.Apply_default_configuration/0_setup.sh index e3527b7a2f58ab5aa711af3e8ddb9adf5091d544..0d386929e8fa8ebd224a672e7b7bd7a159d37927 100755 --- a/20.Client configuration & testing/4.Apply_default_configuration/0_setup.sh +++ b/20.Client_configuration/4.Apply_default_configuration/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # apply MS default network parameters sudo sed -i "s@address .*@address 192.168.1.10@" /etc/network/interfaces diff --git a/20.Client configuration & testing/5.Insert_wowza_license/0_setup.sh b/20.Client_configuration/5.Insert_wowza_license/0_setup.sh similarity index 85% rename from 20.Client configuration & testing/5.Insert_wowza_license/0_setup.sh rename to 20.Client_configuration/5.Insert_wowza_license/0_setup.sh index 8487c869242a33f754face583df367103c69aa5e..28bc4fb7f5a7af358668a6972abbfc35ca63ef7a 100755 --- a/20.Client configuration & testing/5.Insert_wowza_license/0_setup.sh +++ b/20.Client_configuration/5.Insert_wowza_license/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh echo "Insert wowza license key :" read WOWZA_LICENSE2 diff --git a/3.New_server_deployment/1.Download_envsetup_config/0_setup.sh b/3.New_server_deployment/1.Download_envsetup_config/0_setup.sh index dc20e09b4833143df6c38f920429a4dd33d58b19..c19ee5c13ba30f2df5e7bab31c69d56a5c6a2b70 100755 --- a/3.New_server_deployment/1.Download_envsetup_config/0_setup.sh +++ b/3.New_server_deployment/1.Download_envsetup_config/0_setup.sh @@ -1,14 +1,17 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # Download config file from skyreach if ( ! test -z ${SKYREACH_API_KEY} ); then conf_url="https://$SKYREACH_HOST/erp/credentials/$SKYREACH_API_KEY/conf.sh" if ( curl -I "$conf_url" >/dev/null ); then - wget -q "$conf_url" -O /root/envsetup/conf.sh - source /root/envsetup/conf.sh + wget -q "$conf_url" -O /root/envsetup/auto-generated-conf.sh + echo "Config file updated." + source /root/envsetup/global-conf.sh else echo "Failed to download configuration using url:" echo " $conf_url" fi +else + echo "No API key for $SKYREACH_HOST. The config will not be downloaded." fi diff --git a/3.New_server_deployment/2.Fill_empty_conf/0_setup.sh b/3.New_server_deployment/2.Fill_empty_conf/0_setup.sh index a5a93531f228d20b876b22aba3ba96bdecec2cf1..197aaeb9e7f5c48a91f58f7f6f00ad12ae648db5 100755 --- a/3.New_server_deployment/2.Fill_empty_conf/0_setup.sh +++ b/3.New_server_deployment/2.Fill_empty_conf/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # Autogenerate missing values if [ "${MS_ID}" = "" ]; then @@ -9,6 +9,7 @@ if [ "${MS_ID}" = "" ]; then else echo "MS_ID='${MS_ID}'" >> /root/envsetup/conf.sh fi + echo "The config MS_ID has been set." fi if [ "${MS_API_KEY}" = "" ]; then MS_API_KEY=$(echo "s$(pwgen 4)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)") @@ -19,6 +20,7 @@ if [ "${MS_API_KEY}" = "" ]; then else echo "MS_API_KEY='${MS_API_KEY}'" >> /root/envsetup/conf.sh fi + echo "The config MS_API_KEY has been set." fi if [ "${MS_SECRET}" = "secret" ]; then MS_SECRET=$(echo "$(pwgen 40)") @@ -27,13 +29,15 @@ if [ "${MS_SECRET}" = "secret" ]; then else echo "MS_SECRET='${MS_SECRET}'" >> /root/envsetup/conf.sh fi + echo "The config MS_SECRET has been set." fi # Worker IP for whitelist -if [ "${CELERITY_WORKER_IP}" = "" ]; then +if [ "${CELERITY_WORKER_IP}" = "" ] || [ "${CELERITY_WORKER_IP}" = "127.0.1.1" ]; then CELERITY_WORKER_IP=$(ip addr show | grep inet | grep -v 127 | grep -v ":" | awk -F " " '{print$2}' | awk -F "/" '{print$1}') if ( cat "/root/envsetup/conf.sh" | grep "CELERITY_WORKER_IP" >/dev/null ); then sed -i "s@^CELERITY_WORKER_IP=.*@CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'@" /root/envsetup/conf.sh else echo "CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'" >> /root/envsetup/conf.sh fi + echo "The config CELERITY_WORKER_IP has been set." fi diff --git a/3.New_server_deployment/3.Initialize_APT/0_setup.sh b/3.New_server_deployment/3.Initialize_APT/0_setup.sh index f3b8e2867a9d749e960fb79ed8a86ba9667a5553..0c0d3a2a4b710850b0ed90afdefe5807d2a17298 100755 --- a/3.New_server_deployment/3.Initialize_APT/0_setup.sh +++ b/3.New_server_deployment/3.Initialize_APT/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # migrate to Ubuntu 16.04 / apply sources.list if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then diff --git a/3.New_server_deployment/4.Dell_openmanage/0_setup.sh b/3.New_server_deployment/4.Dell_openmanage/0_setup.sh index 19b079014e4626c39837f56b4446add3a34cde04..b57d5883c48c713c45ef598ec36d78fac2f953f1 100755 --- a/3.New_server_deployment/4.Dell_openmanage/0_setup.sh +++ b/3.New_server_deployment/4.Dell_openmanage/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # DELL server - install dell openmanage if ( ! dpkg -l | grep dmidecode ); then diff --git a/5.MediaServer/1.Install_MediaServer/0_setup.sh b/5.MediaServer/1.Install_MediaServer/0_setup.sh index 169cf8b0f66dd61050038a0a4833c8760c6a6eb8..1f6515e6b1a9f253391391241719231300c3cbff 100755 --- a/5.MediaServer/1.Install_MediaServer/0_setup.sh +++ b/5.MediaServer/1.Install_MediaServer/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # Ms package install DEBIAN_FRONTEND=noninteractive apt-get install -y python3-mediaserver diff --git a/5.MediaServer/3.Install_MS_deploy/0_setup.sh b/5.MediaServer/3.Install_MS_deploy/0_setup.sh index b41af8a450eef6f54cceddaf3300f130eacf1be0..e87d3f91afa25bc319ebf92714acf3b8601b7bdf 100755 --- a/5.MediaServer/3.Install_MS_deploy/0_setup.sh +++ b/5.MediaServer/3.Install_MS_deploy/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh echo "Copying MS_deploy.sh" cp -v MS_deploy.sh /var/tmp/MS_deploy.sh diff --git a/6.CampusManager/1.Install_CampusManager/0_setup.sh b/6.CampusManager/1.Install_CampusManager/0_setup.sh index 548c5e7688c9035d5c32e681b31451fadeb044a9..0823e5d61251692e4cd634cc233de30fdecf0346 100755 --- a/6.CampusManager/1.Install_CampusManager/0_setup.sh +++ b/6.CampusManager/1.Install_CampusManager/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # install cm apt-get install -y campus-manager diff --git a/8.Cache/1.Install_cache/0_setup.sh b/8.Cache/1.Install_cache/0_setup.sh index ac90ec7e0552d1f278bd74cb490381f14ac79455..a723e05388e95c741dacdc63a6ae9f0edde95d86 100755 --- a/8.Cache/1.Install_cache/0_setup.sh +++ b/8.Cache/1.Install_cache/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh sed -i "s@\[CLIENT\]@$(hostname)@" default sed -i "s@\[CACHE_DIR\]@${CACHE_DIR}@" default diff --git a/8.Cache/2.Deploy_munin_configuration/0_setup.sh b/8.Cache/2.Deploy_munin_configuration/0_setup.sh index 285fc051fb592f98917775b4faa9a5a34f332d8d..462bf12fbeb9fcba1447a776ec36eb6c219ecc01 100755 --- a/8.Cache/2.Deploy_munin_configuration/0_setup.sh +++ b/8.Cache/2.Deploy_munin_configuration/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh # for munin DEBIAN_FRONTEND=noninteractive apt-get install -y ubicast-config diff --git a/8.Cache/3.Install_ferm/0_setup.sh b/8.Cache/3.Install_ferm/0_setup.sh index 1de2ce984183d96de8c204402ad8fa27505b3e1e..2e701f462701c9215d327ce7a3f542d36a25adb7 100755 --- a/8.Cache/3.Install_ferm/0_setup.sh +++ b/8.Cache/3.Install_ferm/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh DEBIAN_FRONTEND=noninteractive apt-get install -y ferm cp ferm.conf /etc/ferm/ferm.conf diff --git a/9.MediaVault/1.Install_MediaVault/0_setup.sh b/9.MediaVault/1.Install_MediaVault/0_setup.sh index 89f429f7f3429a9934766ac91f82cdc79a2c5e6f..d1724d57a61f320fc12ad2fc8adccf0470614e55 100755 --- a/9.MediaVault/1.Install_MediaVault/0_setup.sh +++ b/9.MediaVault/1.Install_MediaVault/0_setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /root/envsetup/conf.sh +source /root/envsetup/global-conf.sh apt-get install -y dialog cd /root diff --git a/conf.sh b/conf.sh index c1308c9aa0c336b973ed17d1add1368f2a21a748..8c1790d5e53cc7b51ca678385e702b7126ffe8f5 100644 --- a/conf.sh +++ b/conf.sh @@ -1,7 +1,5 @@ #!/bin/bash # Envsetup local configuration file -# See default configuration in default-conf.sh - -source /root/envsetup/default-conf.sh +# See default configuration in global-conf.sh # Put your configuration here diff --git a/envsetup.py b/envsetup.py index 2bba8053ec53d67833f2c32233283b815dd3921e..fa19dad18e79679c728c939a6576f5384ad34a4c 100755 --- a/envsetup.py +++ b/envsetup.py @@ -156,7 +156,6 @@ class EnvSetup(): if target == str(action['index']) and action['fct']: found = True log('Starting action %s: %s setup.' % (action['index'], action['label'])) - log('Please wait, the setup is in progress... ') try: os.chdir(action['path']) if isinstance(action['fct'], str): diff --git a/default-conf.sh b/global-conf.sh similarity index 86% rename from default-conf.sh rename to global-conf.sh index 73e425f8387c3a08bc9620fb656171a1a7ef79bd..e5474847da60f2a95f937c11161a29aecea74c54 100644 --- a/default-conf.sh +++ b/global-conf.sh @@ -1,8 +1,11 @@ #!/bin/bash -# Envsetup default configuration file # DO NOT EDIT THIS FILE! # Put your local configuration in conf.sh + +# Default configuration values +# ---------------------------- + # -- Constants -- CYAN='\033[0;36m' GREEN='\033[0;32m' @@ -119,3 +122,17 @@ HA_LB1='ha-lb3' HA_LB1_IP='192.168.41.177' HA_LB2= HA_LB2_IP= + + +# Upstream configuration override +# ------------------------------- +# (file generated by Panel / Skyreach) +if [ -f "/root/envsetup/auto-generated-conf.sh" ]; then + source "/root/envsetup/auto-generated-conf.sh" +fi + +# Local configuration override +# ---------------------------- +if [ -f "/root/envsetup/conf.sh" ]; then + source "/root/envsetup/conf.sh" +fi diff --git a/utils.py b/utils.py index 72ea1e22a308687f98e3ecc93d3a3267361b36fc..95c64d92c3c4affa13329c346a66f84cb41dae65 100644 --- a/utils.py +++ b/utils.py @@ -6,7 +6,8 @@ import subprocess import sys -DEFAULT_CONF_PATH = 'default-conf.sh' +DEFAULT_CONF_PATH = 'global-conf.sh' +AUTO_CONF_PATH = 'auto-generated-conf.sh' CONF_PATH = 'conf.sh' CONF = dict() @@ -51,15 +52,17 @@ def load_conf(): base_dir = get_dir(__file__) files = ( (os.path.join(base_dir, DEFAULT_CONF_PATH), True), + (os.path.join(base_dir, AUTO_CONF_PATH), False), (os.path.join(base_dir, CONF_PATH), False), ) only_default = True override = OrderedDict() for path, is_default in files: if not os.path.exists(path): - log('The configuration file for EnvSetup script does not exist.\nPath of configuration file: %s' % path, error=True) if is_default: + log('The configuration file for EnvSetup script does not exist.\nPath of configuration file: %s' % path, error=True) return dict() + continue # Load conf with open(path, 'r') as fo: content = fo.read()