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 committed by selfhoster1312
parent 7cf40d0e38
commit 3e1850d789
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;" try_files="try_files /dev/null @${app}--proxy;"
else else
if [ ! -d "$assets_path" ]; then 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 fi
if [[ ! "$assets_path" =~ /$ ]]; then if [[ ! "$assets_path" =~ /$ ]]; then
# Append missing trailing / # Append missing trailing /
assets_path=""${assets_path}"/" assets_path="${assets_path}/"
fi fi
assets_alias="alias $assets_path;" assets_alias="alias $assets_path;"
@ -58,7 +58,7 @@ rp_handle_webroot() {
path_slash="/" path_slash="/"
redirect_block="# Not needed for webroot" redirect_block="# Not needed for webroot"
else else
path_slash=""$path"/" path_slash="$path"/
redirect_block="location = "$path" { return 302 "$path_slash"; }" redirect_block="location = ${path} { return 302 ${path_slash}; }"
fi fi
} }

View file

@ -36,7 +36,7 @@ ynh_add_nginx_config
if [[ "$old_domain" != "$new_domain" ]]; then if [[ "$old_domain" != "$new_domain" ]]; then
new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
ynh_delete_file_checksum --file="$nginx_conf_path" 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" ynh_store_file_checksum --file="$new_nginx_conf_path"
fi fi

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Remove configuration files # 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 # END OF SCRIPT

View file

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