From f266234ee6847490ce058b98e47c34e74442c9e8 Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 29 Nov 2018 17:32:21 +0100 Subject: [PATCH] [mod] tabulations inside f() --- scripts/functions.sh | 70 +++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index fc37f7d..f634f89 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -1,22 +1,21 @@ #/bin/bash INSTALL_DUNITER_DEBIAN_PACKAGE () { + version="v1.6.25" + git_repo="https://git.duniter.org/nodes/typescript/duniter/" + if [ $arch == "x64" ]; then + middle_url="-/jobs/7062/artifacts/raw/work/bin/" + else + middle_url="uploads/722c2b2901e0c2a13ca3595eae4e696f/" + fi + deb="duniter-server-$version-linux-$arch.deb" + url="${git_repo}${middle_url}${deb}" -version="v1.6.25" -git_repo="https://git.duniter.org/nodes/typescript/duniter/" -if [ $arch == "x64" ]; then - middle_url="-/jobs/7062/artifacts/raw/work/bin/" -else - middle_url="uploads/722c2b2901e0c2a13ca3595eae4e696f/" -fi -deb="duniter-server-$version-linux-$arch.deb" -url="${git_repo}${middle_url}${deb}" - -# Retrieve debian package and install it -wget -nc --quiet $url -P /tmp -deb_path="/tmp/$deb" -dpkg -i $deb_path > /dev/null -rm -f $deb_path + # Retrieve debian package and install it + wget -nc --quiet $url -P /tmp + deb_path="/tmp/$deb" + dpkg -i $deb_path > /dev/null + rm -f $deb_path } CONFIGURE_DUNITER () { @@ -26,35 +25,34 @@ CONFIGURE_DUNITER () { } CONFIG_SSOWAT () { -# Add admin to the allowed users -yunohost app addaccess $app -u $admin + # Add admin to the allowed users + yunohost app addaccess $app -u $admin -# Protect senstive sub-routes -ynh_app_setting_set "$app" protected_uris "/webui","/webmin" + # Protect senstive sub-routes + ynh_app_setting_set "$app" protected_uris "/webui","/webmin" -# Duniter is public app, with only some parts restricted in nginx.conf -ynh_app_setting_set "$app" unprotected_uris "/","/modules" + # Duniter is public app, with only some parts restricted in nginx.conf + ynh_app_setting_set "$app" unprotected_uris "/","/modules" -# Set URL redirection from root to webadmin -ynh_app_setting_set "$app" redirected_urls "{'$domain/':'$domain/webui'}" + # Set URL redirection from root to webadmin + ynh_app_setting_set "$app" redirected_urls "{'$domain/':'$domain/webui'}" } CONFIG_NGINX () { -# Configure Nginx -nginx_conf="../conf/nginx.conf" -sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf -sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf -cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf -service nginx reload + nginx_conf="../conf/nginx.conf" + sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf + sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf + cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf + service nginx reload } REMOVE_DUNITER () { -# Stop duniter daemon if running -duniter status -if [ `echo "$?"` == 0 ]; then - duniter stop -fi + # Stop duniter daemon if running + duniter status + if [ `echo "$?"` == 0 ]; then + duniter stop + fi -# Remove Duniter package -dpkg -r duniter + # Remove Duniter package + dpkg -r duniter }