1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00

Update _common.sh

This commit is contained in:
Sylvain 2024-03-08 13:24:48 +01:00
parent 8eca6a87f6
commit 9b5df6c8ca

View file

@ -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.* \(<HOST>\).* Requested URL: ./auth/.*"
failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] \
Login attempt or request with invalid authentication \
from.* \(<HOST>\).* Requested URL: ./auth/.*"
#=================================================
# PERSONAL HELPERS