diff --git a/src/main/resources/scripts/install.sh b/src/main/resources/scripts/install.sh index 7bf20d5e..70037484 100755 --- a/src/main/resources/scripts/install.sh +++ b/src/main/resources/scripts/install.sh @@ -176,6 +176,7 @@ mkdir -p "${GVM_DIR}/vertx" echo "Prime the config file..." touch "${gvm_config_file}" +echo "gvm_auto_answer=false" >> "${gvm_config_file}" echo "Download script archive..." curl -s "${GVM_SERVICE}/res?platform=${gvm_platform}&purpose=install" > "${gvm_zip_file}" diff --git a/src/main/resources/scripts/selfupdate.sh b/src/main/resources/scripts/selfupdate.sh index b3c7be68..7fed231f 100755 --- a/src/main/resources/scripts/selfupdate.sh +++ b/src/main/resources/scripts/selfupdate.sh @@ -72,8 +72,10 @@ fi echo "Prime the config file..." gvm_config_file="${GVM_DIR}/etc/config" -rm "${gvm_config_file}" touch "${gvm_config_file}" +if [[ -z $(cat ${gvm_config_file} | grep 'gvm_auto_answer') ]]; then + echo "gvm_auto_answer=false" >> "${gvm_config_file}" +fi echo "Download new scripts to: ${gvm_tmp_zip}" curl -s "${GVM_SERVICE}/res?platform=${gvm_platform}&purpose=selfupdate" > "${gvm_tmp_zip}" diff --git a/src/test/cucumber/gvm/self_update.feature b/src/test/cucumber/gvm/self_update.feature index 426707ca..89d576f5 100644 --- a/src/test/cucumber/gvm/self_update.feature +++ b/src/test/cucumber/gvm/self_update.feature @@ -19,6 +19,17 @@ Feature: Self Update And the configuration is not present in the extensions folder And the configuration file is present in the etc folder + Scenario: Update an installation without an Auto Answer config + Given an empty configuration file + When I enter "gvm selfupdate" + Then the configuration file contains "gvm_auto_answer=false" + + Scenario: Update an installation already containing an Auto Answer config + Given the configuration file has been primed with "gvm_auto_answer=true" + When I enter "gvm selfupdate" + Then the configuration file contains "gvm_auto_answer=true" + And the configuration file does not contain "gvm_auto_answer=false" + Scenario: Rename the vertx Candidate on Upgrade Given the candidate "vert.x" version "1.3.0.final" is already installed and default When I enter "gvm selfupdate" diff --git a/src/test/resources/gvm/upgrade_steps.groovy b/src/test/resources/gvm/upgrade_steps.groovy index f2f5e9b5..6b74785e 100644 --- a/src/test/resources/gvm/upgrade_steps.groovy +++ b/src/test/resources/gvm/upgrade_steps.groovy @@ -24,6 +24,11 @@ And(~'^the configuration file contains "([^"]*)"$') { String content -> assert configFile.text.contains(content) } +And(~'^the configuration file does not contain "([^"]*)"$') { String content -> + def configFile = "$gvmDir/etc/config" as File + assert ! configFile.text.contains(content) +} + Given(~'^a configuration file in the extensions folder$') {-> def configFile = "$gvmDir/ext/config" as File configFile.text = "" @@ -60,4 +65,8 @@ And(~'^the gvm module scripts are placed in the src folder$') {-> And(~'^the staging folder is cleaned up$') {-> assert ! new File("$gvmDir/tmp/stage").exists() +} +Given(~'^an empty configuration file$') {-> + def configFile = "$gvmDir/ext/config" as File + configFile.text = "" } \ No newline at end of file