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

Fix user group

This commit is contained in:
ewilly 2022-01-04 11:55:24 +01:00
parent f4dc3a18e1
commit af1c5cfa5a
4 changed files with 12 additions and 4 deletions

View file

@ -13,8 +13,15 @@ PKG_DEPENDENCIES="python3 python3-dev python3-venv python3-pip libffi-dev libssl
# Pyhton 3.9.2 will be shiped with bullseye
PY_REQUIRED_VERSION=3.9.2
# System groups allowed to homeassistant user
USER_GROUPS="dialout gpio i2c"
# Create homeassistant user
mynh_user_create () {
USER_GROUPS=""
[ ynh_system_group_exists --group=dialout ] && USER_GROUPS="${USER_GROUPS} dialout"
[ ynh_system_group_exists --group=gpio ] && USER_GROUPS="${USER_GROUPS} gpio"
[ ynh_system_group_exists --group=i2c ] && USER_GROUPS="${USER_GROUPS} i2c"
ynh_system_user_create --username="$app" --groups="$USER_GROUPS"
}
# Check if directory/file already exists (path in argument)
myynh_check_path () {

View file

@ -41,7 +41,7 @@ ynh_app_setting_set --app="$app" --key=path_url --value="$path_url"
# create a dedicated system user
ynh_script_progression --message="Creating dedicated user, rights and folders..."
ynh_system_user_create --username="$app" --groups="$USER_GROUPS"
mynh_user_create
# create a directory for the installation of Home Assistant
myynh_create_dir "$final_path"

View file

@ -36,7 +36,7 @@ ynh_exec_warn_less yunohost firewall allow TCP $port
# restore dedicated system user
ynh_script_progression --message="Restoring dedicated user and rights folders..."
ynh_system_user_create --username="$app" --groups="$USER_GROUPS"
mynh_user_create
ynh_restore_file --origin_path="/etc/sudoers.d/$app"
# restore nginx

View file

@ -106,6 +106,7 @@ ynh_add_systemd_config
# grant sudo permissions to the user to manage his own systemd service
ynh_script_progression --message="Creating dedicated user, rights and folders..."
mynh_user_create
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
# add service in admin panel