From fda701dc84f11d9c09cde0de49c1b314aff4ff62 Mon Sep 17 00:00:00 2001 From: anmol26s Date: Wed, 19 Sep 2018 11:00:28 +0530 Subject: [PATCH] test spawn to input commands --- conf/.env | 1 - scripts/install | 57 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/conf/.env b/conf/.env index 98bedf9..40770df 100644 --- a/conf/.env +++ b/conf/.env @@ -1,7 +1,6 @@ DB_URL=postgres://__DB_USER__:__PSQLPWD__@localhost:5432/__DBNAME__ BASE_URL=__DOMAIN__ -ROCKET_SECRET_KEY=__RANDOM_KEY__ ROCKET_PORT=__PORT__ ROCKET_ADDRESS=127.0.0.1 diff --git a/scripts/install b/scripts/install index 861d769..96a631d 100755 --- a/scripts/install +++ b/scripts/install @@ -95,10 +95,6 @@ ynh_app_setting_set $app port $port ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config -# Random key genration and store it -random_key=$(openssl rand -base64 32) -ynh_app_setting_set $app random_key $random_key - #================================================= # DATABASE SETUP #================================================= @@ -158,13 +154,64 @@ sudo cp ../conf/.env $final_path/.env ynh_replace_string "__DBNAME__" "$db_name" "$final_path/.env" ynh_replace_string "__PSQLPWD__" "$db_pwd" "$final_path/.env" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env" -ynh_replace_string "__RANDOM_KEY__" "$random_key" "$final_path/.env" ynh_replace_string "__PORT__" "$port" "$final_path/.env" ynh_replace_string "__DB_USER__" "$app" "$final_path/.env" # Set right permissions chown -R $app: $final_path +pass="test" +name="test" +email="test@domain.tld" +admin_pass="test123" + +( spawn cd $final_path && cargo run + +expect "First let's check that you have all the required dependencies. Press Enter to start." + +send "\r" + +expect "Password:" + +send "$pass\r" + +expect "Do you prefer a simple setup, or to customize everything? + + 1 - Simple setup + 2 - Complete setup" + +send "2\r" + +expect "What is your instance domain?" + +send "$domain\r" + +expect "What is your instance name?" + +send "$name\r" + +expect "What is your username? (default: admin)" + +send "$username\r" + +expect "What is your email?" + +send "$email\r" + +expect "What is your password?" + +send "$admin_pass\r" + +expect "On which port should Plume listen? (default: 7878)" + +send "$port\r" + +expect "On which address should Plume listen? (default: 0.0.0.0)" + +send "127.0.0.1\r" + +expect eof ) + #================================================= # SETUP SYSTEMD #=================================================