diff --git a/scripts/install b/scripts/install index 136f4b1..3bfddfc 100755 --- a/scripts/install +++ b/scripts/install @@ -85,29 +85,6 @@ ynh_print_info "Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -# Adding the details of the database to the config file -ynh_replace_string "__dbuser__" "$db_name" "../conf/config.ini.php" -ynh_replace_string "__dbpass__" "$db_pwd" "../conf/config.ini.php" -ynh_replace_string "__dbname__" "$db_name" "../conf/config.ini.php" - -# Copy the config file to the final path -sudo cp ../conf/config.ini.php $final_path/data/. - -# Load initial SQL into the new database -ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/webtrees.sql" - -# Replace variables in sql scripts -ynh_replace_string "__USER_NAME__" "$admin_username" "../conf/sql/admin.sql" -ynh_replace_string "__NAME__" "$admin_name" "../conf/sql/admin.sql" -ynh_replace_string "__USER_EMAIL__" "$admin_email" "../conf/sql/admin.sql" -ynh_replace_string "__PASSWORD__" "$admin_password" "../conf/sql/admin.sql" - -ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/admin.sql" - #================================================= # CREATE DEDICATED USER #================================================= @@ -131,6 +108,29 @@ ynh_add_fpm_config chown -R $app: $final_path sudo chmod -R 700 $final_path/data +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +# Adding the details of the database to the config file +ynh_replace_string "__dbuser__" "$db_name" "../conf/config.ini.php" +ynh_replace_string "__dbpass__" "$db_pwd" "../conf/config.ini.php" +ynh_replace_string "__dbname__" "$db_name" "../conf/config.ini.php" + +# Copy the config file to the final path +sudo cp ../conf/config.ini.php $final_path/data/. + +# Load initial SQL into the new database +ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/webtrees.sql" + +# Replace variables in sql scripts +ynh_replace_string "__USER_NAME__" "$admin_username" "../conf/sql/admin.sql" +ynh_replace_string "__NAME__" "$admin_name" "../conf/sql/admin.sql" +ynh_replace_string "__USER_EMAIL__" "$admin_email" "../conf/sql/admin.sql" +ynh_replace_string "__PASSWORD__" "$admin_password" "../conf/sql/admin.sql" + +ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/admin.sql" + #================================================= # STORE THE CONFIG FILE CHECKSUM #=================================================