#!/bin/bash #================================================= # 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) #================================================= # SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= get__password() { echo "" } get__enable_proposed_api() { echo "$(awk '/enable-proposed-api:/ {print $2}' $final_path/config.yaml)" } # TODO: Write some getters and setters for __EXTENSIONS_GALLERY__ to go back to json directly #================================================= # SPECIFIC VALIDATORS FOR TOML SHORT KEYS #================================================= #================================================= # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= set__password() { if [ $password ] then hashed_password="$(printf "$password" | sha256sum | cut -d' ' -f1)" sed -i "/hashed-password:.*/d" "$final_path/config.yaml" echo "hashed-password: $hashed_password" >> "$final_path/config.yaml" ynh_store_file_checksum --file="$final_path/config.yaml" ynh_app_setting_set $app hashed_password "$hashed_password" fi } set__enable_proposed_api() { sed -i "/enable-proposed-api:.*/d" "$final_path/config.yaml" echo "enable-proposed-api: $enable_proposed_api" >> "$final_path/config.yaml" ynh_store_file_checksum --file="$final_path/config.yaml" ynh_app_setting_set $app enable_proposed_api "$enable_proposed_api" } #================================================= # GENERIC FINALIZATION #================================================= ynh_app_config_run $1