Commit 81e9fcd2 authored by Pat's avatar Pat
Browse files

remove references to unneeded variable

parent 96ee8096
Showing with 12 additions and 37 deletions
+12 -37
......@@ -4,10 +4,8 @@
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
with_sftp=1
password="myreallystrengthpassword"
is_public=1 (PUBLIC|public=1|private=0)
with_mysql=1
; Checks
pkg_linter=1
setup_sub_dir=1
......@@ -28,7 +26,6 @@
with_sftp=0
password=""
is_public=1 (PUBLIC|public=1|private=0)
with_mysql=1
; Checks
setup_sub_dir=1
upgrade=1
......@@ -40,7 +37,6 @@
with_sftp=1
password="myreallystrengthpassword"
is_public=1 (PUBLIC|public=1|private=0)
with_mysql=0
; Checks
setup_sub_dir=1
upgrade=1
......
......@@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS
#=================================================
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
......@@ -33,10 +32,8 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
#=================================================
ynh_script_progression --message="Removing the previous database..." --weight=6
if [ $with_mysql -eq 1 ]
then
yunohost app action run $app remove_database
fi
yunohost app action run $app remove_database
#=================================================
# CREATE A NEW DATABASE
......@@ -54,7 +51,6 @@ echo -e "# MySQL Database
name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > "$final_path/db_access.txt"
# Update the config of the app
ynh_app_setting_set --app=$app --key=with_mysql --value=1
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#=================================================
......
......@@ -13,8 +13,6 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS
#=================================================
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
#=================================================
......@@ -25,10 +23,7 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
if [ $with_mysql -eq 0 ]
then
ynh_die --message="There's no database to remove." --ret_code=0
fi
ynh_die --message="There's no database to remove." --ret_code=0
#=================================================
# SPECIFIC ACTION
......@@ -40,9 +35,6 @@ ynh_script_progression --message="Removing the database..." --weight=9
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
# Update the config of the app
ynh_app_setting_set --app=$app --key=with_mysql --value=0
#=================================================
# END OF SCRIPT
#=================================================
......
......@@ -99,14 +99,12 @@ fi
mkdir -p "$final_path/www"
if [ $with_mysql -eq 1 ]; then
# Store the database access
echo -e "# MySQL Database
# Store the database access
echo -e "# MySQL Database
name: ${db_name}\nuser: ${db_user}\npass: ${db_pwd}" > ../sources/db_access.txt
# Copy files to the right place
cp -r "../sources/db_access.txt" "$final_path/db_access.txt"
fi
# Copy files to the right place
cp -r "../sources/db_access.txt" "$final_path/db_access.txt"
# Copy files to the right place
cp "../sources/www/index.js" "$final_path/www/$entry_point"
......@@ -174,15 +172,10 @@ ynh_systemd_action --service_name=nginx --action=reload
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
if [ $with_mysql -eq 1 ]
then
sql_infos="
sql_infos="
You've asked for a database, please find here the information about this SQL database.
$(cat "$final_path/db_access.txt")
"
else
sql_infos=""
fi
if [ $with_sftp -eq 1 ]
then
......
......@@ -61,13 +61,11 @@ ynh_restore_file --origin_path="$final_path"
# RESTORE THE MYSQL DATABASE
#=================================================
if [ $with_mysql -eq 1 ]; then
ynh_script_progression --message="Restoring the MySQL database..."
ynh_script_progression --message="Restoring the MySQL database..."
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
fi
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RECREATE THE DEDICATED USER
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment