Index: scripts/start.sh =================================================================== diff -u -r4717608b04a56847fcc274150078fccafa5a86d3 -r63c6fe7fab869eebdad66b970b3b3ab8e4c5e046 --- scripts/start.sh (.../start.sh) (revision 4717608b04a56847fcc274150078fccafa5a86d3) +++ scripts/start.sh (.../start.sh) (revision 63c6fe7fab869eebdad66b970b3b3ab8e4c5e046) @@ -41,6 +41,7 @@ SERVER_DRT_WS_PRODUCT="production" SERVER_DRT_WS_STAGING="staging" SERVER_DRT_WS_QUALITY="quality" +SERVER_DRT_WS_QUALITY2="quality2" GLOBALS_CONFIG_MDFY="CloudSync_DRT_SERVER_IP=" GLOBALS_CONFIG_LINE="CloudSync_DRT_SERVER_IP=.*" @@ -69,45 +70,46 @@ function setupPreparation() { getDeviceIP + echo "Device IP Address : $DST_IP" + if (( $DEMO_SETUP )); then echo "Device operation Mode : Demo Mode" else echo "Device operation Mode : Normal Operation" fi - echo "Device IP Address : $DST_IP" # if it is the update only we don't need the configuration if (( $MANUFACTURING_SETUP )); then echo "Device setup Mode : Manufacturing Setup" + + getServerIP + echo "DRT Server IP Address : $SERVER_IP" + + getServerWS + echo "DRT Server Environment: $SERVER_WS" else echo "Device setup Mode : Update Only" - return + SERVER_WS=$SERVER_DRT_WS_PRODUCT fi - - getServerIP - echo "DRT Server IP Address : $SERVER_IP" - - getServerWS - echo "DRT Server Environment: $SERVER_WS" - - # create the conf file - local config_env_json="$SERVER_CONFIG_FILE" - local config_json="$SERVER_CONFIG_FILE" - - - # creat the config.json file - cp "$SERVER_CONFIG_JSON_WS""_""$SERVER_WS"".""$SERVER_CONFIG_EXT" $SERVER_CONFIG_JSON - if [[ ! -e $SERVER_CONFIG_JSON ]]; then - echo "The file $SERVER_CONFIG_JSON cannot be created" + + # create the config.json file + local config_env_json="$SERVER_CONFIG_JSON_WS""_""$SERVER_WS"".""$SERVER_CONFIG_EXT" + local config_json="$SERVER_CONFIG_JSON" + echo "CloudSync config base : "$config_env_json + cp $config_env_json $config_json # copy the config for the selected environment to config.json + if [[ ! -e $config_json ]]; then + echo "The file $config_json cannot be created" exit 0 fi - - # setting up the DRT Server IP address - #If the server IP is not given or is invalid will be asked to enter and the defualt Diality prefered will be suggested. - #If the server IP is valid and accepted then change the CloudSync conf file - sed -i "s/$SERVER_CONFIG_LINE/$SERVER_CONFIG_BGN$SERVER_IP$SERVER_CONFIG_END/" $SERVER_CONFIG_JSON - #and modify the globals.sh - sed -i "s/$GLOBALS_CONFIG_LINE/$GLOBALS_CONFIG_MDFY$SERVER_IP/" $GLOBALS_FILE + + if (( $MANUFACTURING_SETUP )); then + # setting up the DRT Server IP address + #If the server IP is not given or is invalid will be asked to enter and the defualt Diality prefered will be suggested. + #If the server IP is valid and accepted then change the CloudSync conf file + sed -i "s/$SERVER_CONFIG_LINE/$SERVER_CONFIG_BGN$SERVER_IP$SERVER_CONFIG_END/" $config_json + #and modify the globals.sh + sed -i "s/$GLOBALS_CONFIG_LINE/$GLOBALS_CONFIG_MDFY$SERVER_IP/" $GLOBALS_FILE + fi } function displayHelp() { @@ -133,6 +135,7 @@ echo " - production" echo " - staging" echo " - quality" + echo " - quality2" echo " For example : -Wproduction" exit 0 fi @@ -169,14 +172,14 @@ ssh-keygen -N "" -f $SRC_FILE_SSHKEY 1>>$LOG_OUT_FILE 2>>$LOG_ERR_FILE return $? else - echo "Found ssh key " $SRC_FILE_SSHKEY_PUB + echo "Found ssh key :" $SRC_FILE_SSHKEY_PUB fi return 0 } function sshKeyCopy() { - echo "Registering the ssh key on the device $DST_IP" echo "Please wait ..." + echo "Registering the ssh key on the device $DST_IP" ssh-copy-id $SSH_PARAM -f -i $SRC_FILE_SSHKEY_PUB $DST_USER@$DST_IP 1>>$LOG_OUT_FILE 2>>$LOG_ERR_FILE if [ ! $? -eq 0 ]; then echo "Connection to host $DST_IP failed." | tee -a $LOG_OUT_FILE @@ -237,7 +240,7 @@ } function manufacturingModePrompt() { - if (( $MANUFACTURING_SETUP )); then : else return; fi + if (( $MANUFACTURING_SETUP )); then :; else return; fi echo_star_comment echo_star_message "Do you want to run in the Manufacturing Mode?" @@ -248,8 +251,8 @@ sshRun "echo $SETUP_ENABLE_MANUFACTURING_MODE > $SETUP_CONF_FILE" echo_star_message "Set the setup in manufacturing mode" else - sshRun "echo '' > $SETUP_CONF_FILE" - echo_star_message "Continuing the setup in normal mode" + echo_star_message "Abort the Manufacturing setup by user" + exit 0 fi } @@ -277,7 +280,7 @@ if [ $? -eq 0 ]; then break else - read -p "Please enter the server Ip address: " -e -i "" -r SERVER_IP + read -p "Please enter the server Ip address : " -e -i "" -r SERVER_IP validIP "$SERVER_IP" if [ $? -eq 0 ]; then break @@ -291,16 +294,15 @@ function validWS() { if [[ -z $SERVER_WS ]]; then return 1; fi - case $SERVER_WS in "$SERVER_DRT_WS_PRODUCT");; "$SERVER_DRT_WS_STAGING");; "$SERVER_DRT_WS_QUALITY");; + "$SERVER_DRT_WS_QUALITY2");; *) echo "The entered server environment is not valid [$SERVER_WS]" return 1 esac - return 0 } @@ -310,7 +312,7 @@ if [ $? -eq 0 ]; then break else - read -p "Please enter the server Ip address: " -e -i "" -r SERVER_WS + read -p "Please enter the server environment: " -e -i "" -r SERVER_WS validWS "$SERVER_WS" if [ $? -eq 0 ]; then break @@ -413,13 +415,13 @@ manufacturingModePrompt wipe_device + setupDemoMode setupBootupScripts setupSettingsScripts setupConfigurations setupCloudSync setupFonts setupApplication - setupDemoMode } # running the main function