From 325f2c573b5a1a4b7372f741abd743ed823310b3 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 26 Nov 2022 18:26:31 +0100 Subject: [PATCH] Add user to dialout/i2c/gpio --- scripts/install | 10 ++++++++++ scripts/restore | 10 ++++++++++ scripts/upgrade | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/scripts/install b/scripts/install index 0f83ce6..42149da 100755 --- a/scripts/install +++ b/scripts/install @@ -85,6 +85,16 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" +if grep dialout -q < /etc/group; then + usermod -a -G dialout "$app" +fi +if grep i2c -q < /etc/group; then + usermod -a -G i2c "$app" +fi +if grep gpio -q < /etc/group; then + usermod -a -G gpio "$app" +fi + #================================================= # INSTALL EXTRA DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index 21e2d1e..aa0db7b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -50,6 +50,16 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" +if grep dialout -q < /etc/group; then + usermod -a -G dialout "$app" +fi +if grep i2c -q < /etc/group; then + usermod -a -G i2c "$app" +fi +if grep gpio -q < /etc/group; then + usermod -a -G gpio "$app" +fi + #================================================= # INSTALL EXTRA DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 67f6baf..14977b2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,6 +80,16 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" +if grep dialout -q < /etc/group; then + usermod -a -G dialout "$app" +fi +if grep i2c -q < /etc/group; then + usermod -a -G i2c "$app" +fi +if grep gpio -q < /etc/group; then + usermod -a -G gpio "$app" +fi + #================================================= # UPGRADE DEPENDENCIES #=================================================