Run shellcheck to find bash common mistakes

Complete command: shellcheck -e SC2154,SC1091,SC2034,SC2148 scripts/*
This commit is contained in:
selfhoster1312 2024-08-24 19:27:37 +02:00
parent 7cf40d0e38
commit b26d1eb73e
4 changed files with 6 additions and 7 deletions

View file

@ -38,12 +38,12 @@ rp_validate_assets_path() {
try_files="try_files /dev/null @${app}--proxy;"
else
if [ ! -d "$assets_path" ]; then
ynh_die "Requested assets path "$assets_path" does not exist" 1
ynh_die "Requested assets path ${assets_path} does not exist" 1
fi
if [[ ! "$assets_path" =~ /$ ]]; then
# Append missing trailing /
assets_path=""${assets_path}"/"
assets_path="${assets_path}/"
fi
assets_alias="alias $assets_path;"
@ -58,7 +58,7 @@ rp_handle_webroot() {
path_slash="/"
redirect_block="# Not needed for webroot"
else
path_slash=""$path"/"
redirect_block="location = "$path" { return 302 "$path_slash"; }"
path_slash="$path"/
redirect_block="location = ${path} { return 302 ${path_slash}; }"
fi
}

View file

@ -36,7 +36,7 @@ ynh_add_nginx_config
if [[ "$old_domain" != "$new_domain" ]]; then
new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path $new_nginx_conf_path
mv "${nginx_conf_path}" "${new_nginx_conf_path}"
ynh_store_file_checksum --file="$new_nginx_conf_path"
fi

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
# Remove configuration files
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
ynh_secure_remove "/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# END OF SCRIPT

View file

@ -1,4 +1,3 @@
#!/bin/bash
#=================================================