From 9b5df6c8ca162f9c8da23ed85bc58d2a772fc22f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 8 Mar 2024 13:24:48 +0100 Subject: [PATCH] Update _common.sh --- scripts/_common.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7d9883d..e3f6d13 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,16 +5,26 @@ #================================================= # App version -## yq is not a dependencie of yunohost package so tomlq command is not available (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) -app_version=$(cat ../manifest.toml | grep 'version = '| cut -d '=' -f 2 | cut -d '~' -f 1 | tr -d ' "') #2024.2.5 +## yq is not a dependencie of yunohost package so tomlq command is not available +## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) +app_version=$(ynh_exec_quiet cat ../manifest.toml \ + | grep 'version = ' | cut -d '=' -f 2 \ + | cut -d '~' -f 1 | tr -d ' "') #2024.2.5 # Python required version -## jq is a dependencie of yunohost package (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) -py_required_major=$(curl -Ls https://pypi.org/pypi/$app/$app_version/json | jq -r '.info.requires_python' | cut -d '=' -f 2 | rev | cut -d '.' -f2- | rev) #3.11 -py_required_version=$(curl -Ls https://www.python.org/ftp/python/ | grep '>'$py_required_major | cut -d '/' -f 2 | cut -d '>' -f 2 | sort -rV | head -n 1) #3.11.8 +## jq is a dependencie of yunohost package +## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) +py_required_major=$(ynh_exec_quiet curl -Ls https://pypi.org/pypi/$app/$app_version/json \ + | jq -r '.info.requires_python' | cut -d '=' -f 2 \ + | rev | cut -d '.' -f2- | rev) #3.11 +py_required_version=$(ynh_exec_quiet curl -Ls https://www.python.org/ftp/python/ \ + | grep '>'$py_required_major | cut -d '/' -f 2 \ + | cut -d '>' -f 2 | sort -rV | head -n 1) #3.11.8 # Fail2ban -failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] Login attempt or request with invalid authentication from.* \(\).* Requested URL: ./auth/.*" +failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] \ + Login attempt or request with invalid authentication \ + from.* \(\).* Requested URL: ./auth/.*" #================================================= # PERSONAL HELPERS