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:58:07 +01:00
parent 50f7c89163
commit c9587ba729

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
@ -13,24 +7,22 @@ source /usr/share/yunohost/helpers
# App version # App version
## yq is not a dependencie of yunohost package so tomlq command is not available ## yq is not a dependencie of yunohost package so tomlq command is not available
## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) ## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control)
app_version=$(ynh_exec_quiet cat ../manifest.toml \ app_version=$(cat ../manifest.toml 2>/dev/null \
| grep 'version = ' | cut -d '=' -f 2 \ | grep 'version = ' | cut -d '=' -f 2 \
| cut -d '~' -f 1 | tr -d ' "') #2024.2.5 | cut -d '~' -f 1 | tr -d ' "') #2024.2.5
# Python required version # Python required version
## jq is a dependencie of yunohost package ## jq is a dependencie of yunohost package
## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control) ## (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 \ py_required_major=$(curl -Ls https://pypi.org/pypi/$app/$app_version/json \
| jq -r '.info.requires_python' | cut -d '=' -f 2 \ | jq -r '.info.requires_python' | cut -d '=' -f 2 \
| rev | cut -d '.' -f2- | rev) #3.11 | rev | cut -d '.' -f2- | rev) #3.11
py_required_version=$(ynh_exec_quiet curl -Ls https://www.python.org/ftp/python/ \ py_required_version=$(curl -Ls https://www.python.org/ftp/python/ \
| grep '>'$py_required_major | cut -d '/' -f 2 \ | grep '>'$py_required_major | cut -d '/' -f 2 \
| cut -d '>' -f 2 | sort -rV | head -n 1) #3.11.8 | cut -d '>' -f 2 | sort -rV | head -n 1) #3.11.8
# Fail2ban # Fail2ban
failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] \ failregex="^%(__prefix_line)s.*\[homeassistant.components.http.ban\] Login attempt or request with invalid authentication from.* \(<HOST>\).* Requested URL: ./auth/.*"
Login attempt or request with invalid authentication \
from.* \(<HOST>\).* Requested URL: ./auth/.*"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS