YunoHost / package_linter

Linter for YunoHost applications packages
https://yunohost.org/#/packaging_apps
GNU Affero General Public License v3.0
17 stars 13 forks source link

Show the "system modification" causing error #15

Closed scith closed 7 years ago

scith commented 7 years ago

Hello, I receive the following error on package_linter:

✘ At line 31 'ynh_die' or 'exit' command is executed with system modification before.
 This system modification is an issue if a verification exit the script.
 You should move this verification before any system modification.

The code does not seem to do any system modification however:

#!/bin/bash
    app=$YNH_APP_INSTANCE_NAME

# Source app helpers
. /usr/share/yunohost/helpers

# Common variable declaration
    app_install_dir="/opt/yunohost/$app"
    app_data_dir="/home/yunohost.app/$app"
    app_python_bin="/usr/bin/python"

# Retrieve arguments
    domain=$(ynh_app_setting_get "$app" domain)
    path=$(ynh_app_setting_get "$app" path)

# Check destination directories
    [[ -d $app_install_dir ]] && ynh_die \
    "The destination directory '$app_install_dir' already exists.\
     You should safely delete it before restoring this app."

    [[ -d $app_data_dir ]] && ynh_die \
    "The destination directory '$app_data_dir' already exists.\
     You should safely delete it before restoring this app."

    nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
    [[ -f $nginx_conf ]] && ynh_die \
    "The NGINX configuration already exists at '${nginx_conf}'.
     You should safely delete it before restoring this app."

    systemd_conf="/etc/systemd/system/${app}.service"
    [[ -f $systemd_conf ]] && ynh_die \
    "The Systemd configuration already exists at '${systemd_conf}'.
     You should safely delete it before restoring this app."

The line causing the error is [[ -f $systemd_conf ]] && ynh_die Is there a way to retrieve in package_linter the exact "system modification" that is causing the error?

Thanks

M5oul commented 7 years ago

The error will still be displayed but the return status won't be error.