From 987cd0e568fad126a61210cd2e463c376540a8fe Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 29 Jan 2019 23:25:09 +0100 Subject: [PATCH] Generate ldap setting during upgrade --- conf/init_calibre_db_ldap_settings | 3 +++ conf/init_calibre_db_settings | 3 --- scripts/upgrade | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 conf/init_calibre_db_ldap_settings diff --git a/conf/init_calibre_db_ldap_settings b/conf/init_calibre_db_ldap_settings new file mode 100644 index 0000000..3e45426 --- /dev/null +++ b/conf/init_calibre_db_ldap_settings @@ -0,0 +1,3 @@ +config_use_ldap=1, +config_ldap_provider_url=\'localhost:389\', +config_ldap_dn=\'uid=%s,ou=users,dc=yunohost,dc=org\', \ No newline at end of file diff --git a/conf/init_calibre_db_settings b/conf/init_calibre_db_settings index f600faa..b50120f 100644 --- a/conf/init_calibre_db_settings +++ b/conf/init_calibre_db_settings @@ -8,7 +8,4 @@ config_use_goodreads=0, config_logfile=\'\', config_converterpath=\'\', config_calibre=\'\', -config_use_ldap=1, -config_ldap_provider_url=\'localhost:389\', -config_ldap_dn=\'uid=%s,ou=users,dc=yunohost,dc=org\', config_uploading=\'$upload\' diff --git a/scripts/upgrade b/scripts/upgrade index be3884f..ddaeb37 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,22 +89,23 @@ ynh_system_user_create $app # ... #================================================= -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/app.db" - -#set database settings as per conf file -conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))) WHERE ID=1\"" -eval sqlite3 $final_path/app.db "$conf" - -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/app.db" - #build multimedia directory #Create multimedia directory but we do not change the calibre_dir : It's the user to make this choice. ynh_multimedia_build_main_dir ynh_multimedia_addaccess $app +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different "$final_path/app.db" + +#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap settings +ynh_systemd_action -a restart -l "INFO in server: Starting Gevent server" +conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" +eval sqlite3 $final_path/app.db "$conf" + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/app.db" + #================================================= # SETUP LOGROTATE #=================================================