Compare commits

...

1 Commits

Author SHA1 Message Date
Maniack Crudelis 00e313cb46 Fixes for actions and config-panel 6 years ago
  1. 14
      check_process
  2. 11
      scripts/actions/create_database
  3. 7
      scripts/actions/public_private
  4. 11
      scripts/actions/remove_database
  5. 7
      scripts/actions/sftp
  6. 16
      scripts/config

14
check_process

@ -6,6 +6,18 @@
password="myreallystrengthpassword"
is_public=1 (PUBLIC|public=1|private=0)
with_mysql=1
; Actions
with_sftp=1|0
is_public=1|0
; Config_panel
main.sftp.sftp=1|0
main.sftp.password=password1
main.is_public.is_public=1|0
main.overwrite_files.overwrite_nginx=1|0
main.overwrite_files.overwrite_phpfpm=1|0
main.php_fpm_config.footprint=low|medium|high
main.php_fpm_config.free_footprint=20
main.php_fpm_config.usage=low|medium|high
; Checks
pkg_linter=1
setup_sub_dir=1
@ -19,6 +31,8 @@
multi_instance=1
port_already_use=0
change_url=1
actions=1
config_panel=1
;; Test without sftp
; Manifest
domain="domain.tld" (DOMAIN)

11
scripts/actions/create_database

@ -9,15 +9,22 @@
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================

7
scripts/actions/public_private

@ -9,6 +9,13 @@
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================

11
scripts/actions/remove_database

@ -10,13 +10,20 @@ source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
# MANAGE SCRIPT FAILURE
#=================================================
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================

7
scripts/actions/sftp

@ -9,6 +9,13 @@
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================

16
scripts/config

@ -8,6 +8,7 @@
source _common.sh
source /usr/share/yunohost/helpers
source _ynh_add_fpm_config
#=================================================
# RETRIEVE ARGUMENTS
@ -33,15 +34,18 @@ with_sftp="${YNH_CONFIG_MAIN_SFTP_SFTP:-$old_with_sftp}"
# sftp password
is_password_exist=0
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password)
if [ -n "$password" ]
if [ -n "$YNH_CONFIG_MAIN_SFTP_PASSWORD" ]
then
if [ -n "$password" ]
then
ynh_print_warn --message="A password already exist, it will not be replaced."
# If a password already exist, unset the variable password and to not change it.
unset password
is_password_exist=1
else
else
# Otherwise, get the new password
password="$YNH_CONFIG_MAIN_SFTP_PASSWORD"
fi
fi
ynh_print_ON
@ -144,6 +148,14 @@ apply_config() {
if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ]
then
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
user=$(ynh_app_setting_get --app=$app --key=user)
# use $user instead of $app as user that run the fpm processes
finalphpconf="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_replace_string --match_string="^user = .*" --replace_string="user = $user" --target_file="$finalphpconf"
ynh_replace_string --match_string="^group = .*" --replace_string="group = $user" --target_file="$finalphpconf"
ynh_systemd_action --service_name=php7.0-fpm --action=reload
fi
}

Loading…
Cancel
Save