diff --git a/manifest.json b/manifest.json index 83b21d8..26ff41b 100644 --- a/manifest.json +++ b/manifest.json @@ -59,7 +59,7 @@ "default": true }, { - "name": "mysql_db", + "name": "with_mysql", "type": "boolean", "ask": { "en": "Do you need a MySQL database?", diff --git a/scripts/backup b/scripts/backup index 5ab1532..63f13fb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -12,7 +12,7 @@ app=$YNH_APP_INSTANCE_NAME # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) -mysql_db=$(ynh_app_setting_get "$app" mysql_db) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) # Copy the app files DESTDIR="/var/www/${app}" @@ -23,7 +23,7 @@ ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf" ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf" # Dump the database -if [[ $mysql_db -eq 1 ]]; then +if [[ $with_mysql -eq 1 ]]; then dbname=$app dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) diff --git a/scripts/install b/scripts/install index 7528d52..30eeb75 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ domain=$1 path=${2%/} password=$3 is_public=$4 -mysql_db=$5 +with_mysql=$5 # Source app helpers . /usr/share/yunohost/helpers @@ -50,7 +50,7 @@ sed -i "s@{DOMAIN}@${domain}@g" ../sources/www/index.html sed -i "s@{USER}@${user}@g" ../sources/www/index.html # Initialize database as needed -if [[ $mysql_db -eq 1 ]]; then +if [[ $with_mysql -eq 1 ]]; then dbname=$app dbuser=$app dbpass=$(ynh_string_random) @@ -72,7 +72,7 @@ sudo chown root: "$DESTDIR" # Save app settings ynh_app_setting_set "$app" is_public "$is_public" -ynh_app_setting_set "$app" mysql_db "$mysql_db" +ynh_app_setting_set "$app" with_mysql "$with_mysql" ynh_app_setting_set "$app" password "$password" ynh_app_setting_set "$app" user "$user" diff --git a/scripts/remove b/scripts/remove index 9a37e7c..eac45a3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,10 +9,10 @@ app_nb=$YNH_APP_INSTANCE_NUMBER # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) -mysql_db=$(ynh_app_setting_get "$app" mysql_db) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) # Drop MySQL database and user as needed -if [[ $mysql_db -eq 1 ]]; then +if [[ $with_mysql -eq 1 ]]; then dbname=$app dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) diff --git a/scripts/restore b/scripts/restore index 5ed9a6a..eb5a6d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,7 +11,7 @@ app=$YNH_APP_INSTANCE_NAME # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) -mysql_db=$(ynh_app_setting_get "$app" mysql_db) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) password=$(ynh_app_setting_get "$app" password) user=$(ynh_app_setting_get "$app" user) @@ -61,7 +61,7 @@ sudo chown -hR "${user}:" "$DESTDIR" sudo chown root: "$DESTDIR" # Create and restore the database as needed -if [[ $mysql_db -eq 1 ]]; then +if [[ $with_mysql -eq 1 ]]; then dbname=$app dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) diff --git a/scripts/upgrade b/scripts/upgrade index 44af871..55d02ec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,11 +13,11 @@ domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) path=${path%/} is_public=$(ynh_app_setting_get "$app" is_public) -mysql_db=$(ynh_app_setting_get "$app" mysql_db) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) password=$(ynh_app_setting_get "$app" password) user=$(ynh_app_setting_get "$app" user) -([[ -n "$mysql_db" ]] && [[ -n "$password" ]] && [[ -n "$user" ]]) \ +([[ -n "$with_mysql" ]] && [[ -n "$password" ]] && [[ -n "$user" ]]) \ || ynh_die "The app changed and can not be automatically upgraded. \ You will have to manually upgrade it following those instructions: \ https://github.com/YunoHost-Apps/my_webapp_ynh#upgrade"