mirror of
https://github.com/YunoHost-Apps/moncycle_ynh.git
synced 2024-09-03 19:46:16 +02:00
55 lines
1.7 KiB
Bash
55 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# In simple cases, you don't need a config script.
|
|
|
|
# With a simple config_panel.toml, you can write in the app settings, in the
|
|
# upstream config file or replace complete files (logo ...) and restart services.
|
|
|
|
# The config scripts allows you to go further, to handle specific cases
|
|
# (validation of several interdependent fields, specific getter/setter for a value,
|
|
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS
|
|
#=================================================
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
|
|
get__csv_sep(){
|
|
grep -oPi 'define\("CSV_SEP",[\s"]*\K[^\")]+' "$install_dir/config.php"
|
|
}
|
|
|
|
set__csv_sep(){
|
|
sed -i "s/define(\"CSV_SEP\",.*);/define(\"CSV_SEP\", \"$csv_sep\");/" "$install_dir/config.php"
|
|
}
|
|
|
|
get__creation_compte(){
|
|
grep -oPi 'define\("CREATION_COMPTE",[\s"]*\K[^\")]+' "$install_dir/config.php"
|
|
}
|
|
|
|
set__creation_compte(){
|
|
sed -i "s/define(\"CREATION_COMPTE\",.*);/define(\"CSV_SEP\", \"$creation_compte\");/" "$install_dir/config.php"
|
|
}
|
|
|
|
get__connexion_compte(){
|
|
grep -oPi 'define\("CONNEXION_COMPTE",[\s"]*\K[^\")]+' "$install_dir/config.php"
|
|
}
|
|
|
|
set__connexion_compte(){
|
|
sed -i "s/define(\"CONNEXION_COMPTE\",.*);/define(\"CSV_SEP\", \"$connexion_compte\");/" "$install_dir/config.php"
|
|
}
|
|
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
ynh_app_config_run $1
|