#!/bin/bash #================================================= # GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= source scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} with_sftp=${YNH_ACTION_WITH_SFTP} #================================================= # CHECK IF ARGUMENTS ARE CORRECT #================================================= #================================================= # CHECK IF AN ACTION HAS TO BE DONE #================================================= with_sftp_old=$(ynh_app_setting_get --app=$app --key=with_sftp) if [ $with_sftp -eq $with_sftp_old ] then ynh_die --message="with_sftp is already set as $with_sftp." --ret_code=0 fi #================================================= # SPECIFIC ACTION #================================================= # MOVE TO PUBLIC OR PRIVATE #================================================= if [ $with_sftp -eq 1 ] then ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3 ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" else ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3 # Remove regen-conf hook ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" fi yunohost tools regen-conf ssh # Update the config of the app ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Execution completed" --last