|
|
@@ -44,14 +44,17 @@ get_config_value() {
|
|
|
# Encryption
|
|
|
old_encrypt="$(get_config_value encrypt)"
|
|
|
encrypt="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT:-$old_encrypt}"
|
|
|
+
|
|
|
# Encryption password
|
|
|
ynh_print_OFF
|
|
|
old_encrypt_password="$(cat $passkey)"
|
|
|
encrypt_password="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD:-$old_encrypt_password}"
|
|
|
ynh_print_ON
|
|
|
+
|
|
|
# ynh_core_backup
|
|
|
old_ynh_core_backup="$(get_config_value ynh_core_backup)"
|
|
|
ynh_core_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP:-$old_ynh_core_backup}"
|
|
|
+
|
|
|
# ynh_app_backup
|
|
|
if [ -n "$(get_config_value ynh_app_backup)" ]
|
|
|
then
|
|
|
@@ -60,9 +63,11 @@ else
|
|
|
old_ynh_app_backup="false"
|
|
|
fi
|
|
|
ynh_app_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_APPS_BACKUP:-$old_ynh_app_backup}"
|
|
|
+
|
|
|
# Frequency
|
|
|
old_frequency="$(grep "^frequency: " "/etc/yunohost/apps/$app/settings.yml" | cut -d' ' -f2)"
|
|
|
frequency="${YNH_CONFIG_MAIN_BACKUP_OPTIONS_FREQUENCY:-$old_frequency}"
|
|
|
+
|
|
|
# Max size
|
|
|
old_max_size="$(get_config_value max_size)"
|
|
|
max_size="${YNH_CONFIG_MAIN_BACKUP_OPTIONS_MAX_SIZE:-$old_max_size}"
|
|
|
@@ -84,6 +89,7 @@ admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_htm
|
|
|
show_config() {
|
|
|
# here you are supposed to read some config file/database/other then print the values
|
|
|
# echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
|
|
|
+
|
|
|
echo "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT=$encrypt"
|
|
|
echo "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD="
|
|
|
|
|
|
@@ -103,8 +109,14 @@ show_config() {
|
|
|
#=================================================
|
|
|
|
|
|
apply_config() {
|
|
|
+
|
|
|
+ #=================================================
|
|
|
+ # MODIFY THE PASSWORD
|
|
|
+ #=================================================
|
|
|
+
|
|
|
# Change the password if needed
|
|
|
- if [ "$encrypt" = "true" ]; then
|
|
|
+ if [ "$encrypt" = "true" ]
|
|
|
+ then
|
|
|
ynh_print_OFF
|
|
|
test -n "$encrypt_password" || ynh_die --message="The password for encryption can't be empty if you choose to enable encryption."
|
|
|
ynh_print_ON
|
|
|
@@ -115,9 +127,17 @@ apply_config() {
|
|
|
ynh_replace_string --match_string="^cryptpass=.*" --replace_string="cryptpass=$passkey" --target_file="$config_file"
|
|
|
fi
|
|
|
|
|
|
+ #=================================================
|
|
|
+ # MODIFY ENCRYPT SETTING
|
|
|
+ #=================================================
|
|
|
+
|
|
|
# Change encrypt in the config file
|
|
|
ynh_replace_string --match_string="^encrypt=.*" --replace_string="encrypt=$encrypt" --target_file="$config_file"
|
|
|
|
|
|
+ #=================================================
|
|
|
+ # MODIFY SETTINGS
|
|
|
+ #=================================================
|
|
|
+
|
|
|
# Change ynh_core_backup in the config file
|
|
|
ynh_replace_string --match_string="^ynh_core_backup=.*" --replace_string="ynh_core_backup=$ynh_core_backup" --target_file="$config_file"
|
|
|
|
|
|
@@ -161,10 +181,18 @@ apply_config() {
|
|
|
# Change max_size in the config file
|
|
|
ynh_replace_string --match_string="^max_size=.*" --replace_string="max_size=$max_size" --target_file="$config_file"
|
|
|
|
|
|
+ #=================================================
|
|
|
+ # MODIFY OVERWRITTING SETTINGS
|
|
|
+ #=================================================
|
|
|
+
|
|
|
# Set overwrite_cron
|
|
|
overwrite_cron=$(bool_to_01 $overwrite_cron)
|
|
|
ynh_app_setting_set --app=$app --key=overwrite_cron --value="$overwrite_cron"
|
|
|
|
|
|
+ #=================================================
|
|
|
+ # MODIFY EMAIL SETTING
|
|
|
+ #=================================================
|
|
|
+
|
|
|
# Set admin_mail_html
|
|
|
admin_mail_html=$(bool_to_01 $admin_mail_html)
|
|
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
|