Change tabs to spaces, move 'if, then' on a single line instead of splitted lines

This commit is contained in:
Félix Piédallu 2024-01-10 23:34:28 +01:00
parent 021125aa33
commit 2a9127168e
4 changed files with 45 additions and 49 deletions

View file

@ -33,8 +33,7 @@ get__amount() {
local amount=200 local amount=200
# It's possible to change some properties of the question by overriding it: # It's possible to change some properties of the question by overriding it:
if [ "$amount" -gt 100 ] if [ "$amount" -gt 100 ]; then
then
cat << EOF cat << EOF
style: success style: success
value: $amount value: $amount
@ -54,8 +53,7 @@ EOF
get__prices() { get__prices() {
local prices local prices
prices="$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" prices="$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
if [ "$prices" == "," ]; if [ "$prices" == "," ]; then
then
# Return YNH_NULL if you prefer to not return a value at all. # Return YNH_NULL if you prefer to not return a value at all.
echo YNH_NULL echo YNH_NULL
else else

View file

@ -58,12 +58,12 @@ ynh_script_progression --message="Adding system configurations related to $app..
### You can remove it if your app doesn't use PHP. ### You can remove it if your app doesn't use PHP.
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf ### `ynh_add_fpm_config` will use the files conf/php-fpm.conf
### If you're not using these lines: ### If you're not using these lines:
### - You can remove these files in conf/. ### - You can remove these files in conf/.
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script ### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script ### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script ### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
### with the reload at the end of the script. ### with the reload at the end of the script.
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script ### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
# Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf # Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf
ynh_add_fpm_config ynh_add_fpm_config
@ -76,11 +76,11 @@ ynh_add_nginx_config
### Have a look at the app to be sure this app needs a systemd script. ### Have a look at the app to be sure this app needs a systemd script.
### `ynh_systemd_config` will use the file conf/systemd.service ### `ynh_systemd_config` will use the file conf/systemd.service
### If you're not using these lines: ### If you're not using these lines:
### - You can remove those files in conf/. ### - You can remove those files in conf/.
### - Remove the section "BACKUP SYSTEMD" in the backup script ### - Remove the section "BACKUP SYSTEMD" in the backup script
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script ### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
### - As well as the section "RESTORE SYSTEMD" in the restore script ### - As well as the section "RESTORE SYSTEMD" in the restore script
### - And the section "SETUP SYSTEMD" in the upgrade script ### - And the section "SETUP SYSTEMD" in the upgrade script
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
@ -89,10 +89,10 @@ ynh_add_systemd_config
### displayed in the admin interface and through the others `yunohost service` commands. ### displayed in the admin interface and through the others `yunohost service` commands.
### (N.B.: this line only makes sense if the app adds a service to the system!) ### (N.B.: this line only makes sense if the app adds a service to the system!)
### If you're not using these lines: ### If you're not using these lines:
### - You can remove these files in conf/. ### - You can remove these files in conf/.
### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script ### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script ### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script ### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log" yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log"
@ -115,10 +115,10 @@ yunohost service add "$app" --description="A short description of the app" --log
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. ### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
### Use this helper only if there is effectively a log file for this app. ### Use this helper only if there is effectively a log file for this app.
### If you're not using this helper: ### If you're not using this helper:
### - Remove the section "BACKUP LOGROTATE" in the backup script ### - Remove the section "BACKUP LOGROTATE" in the backup script
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script ### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script ### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
### - And the section "SETUP LOGROTATE" in the upgrade script ### - And the section "SETUP LOGROTATE" in the upgrade script
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
@ -183,10 +183,10 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
### `ynh_systemd_action` is used to start a systemd service for an app. ### `ynh_systemd_action` is used to start a systemd service for an app.
### Only needed if you have configure a systemd service ### Only needed if you have configure a systemd service
### If you're not using these lines: ### If you're not using these lines:
### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script ### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
### - As well as the section "START SYSTEMD SERVICE" in the restore script ### - As well as the section "START SYSTEMD SERVICE" in the restore script
### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script ### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script ### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"

View file

@ -30,10 +30,9 @@ ynh_script_progression --message="Removing system configurations related to $app
# This should be a symetric version of what happens in the install script # This should be a symetric version of what happens in the install script
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "$app" >/dev/null if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
then ynh_script_progression --message="Removing $app service integration..." --weight=1
ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove "$app"
yunohost service remove "$app"
fi fi
ynh_remove_fail2ban_config ynh_remove_fail2ban_config

View file

@ -44,16 +44,16 @@ upgrade_type=$(ynh_check_app_version_changed)
# #
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then # if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app) # db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name # ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi # fi
# If install_dir doesn't exist, create it # If install_dir doesn't exist, create it
#if [ -z "$install_dir" ]; then # if [ -z "$install_dir" ]; then
# install_dir=/var/www/$app # install_dir=/var/www/$app
# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
#fi # fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
@ -68,12 +68,11 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$a
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]; then
then ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml # Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi fi
# $install_dir will automatically be initialized with some decent # $install_dir will automatically be initialized with some decent