1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garradin_ynh.git synced 2024-09-03 18:36:17 +02:00

Update install

This commit is contained in:
frju365 2017-02-11 21:20:59 +01:00 committed by GitHub
parent aefece1d13
commit 0ff839cae1

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
source ./_common source ./_common
source ./.fonctions
set -eu set -eu
# Retrieve arguments # Retrieve arguments
@ -17,29 +18,6 @@ source /usr/share/yunohost/helpers
sudo yunohost app checkurl "${domain}${path}" -a "$app" \ sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}" || ynh_die "Path not available: ${domain}${path}"
# Normalize the url path syntax
# Handle the slash at the beginning of path and its absence at ending
# Return a normalized url path
#
# example: url_path=$(ynh_normalize_url_path $url_path)
# ynh_normalize_url_path example -> /example
# ynh_normalize_url_path /example -> /example
# ynh_normalize_url_path /example/ -> /example
#
# usage: ynh_normalize_url_path path_to_normalize
# | arg: url_path_to_normalize - URL path to normalize before using it
ynh_normalize_url_path () {
path=$1
test -n "$path" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing."
if [ "${path:0:1}" != "/" ]; then # If the first character is not a /
path="/$path" # Add / at begin of path variable
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # If the last character is a / and that not the only character.
path="${path:0:${#path}-1}" # Delete the last character
fi
echo $path
}
ynh_normalize_url_path $path ynh_normalize_url_path $path
# Install dependency to convert tracks to a readable format for the browser # Install dependency to convert tracks to a readable format for the browser