Skip to content

Commit

Permalink
Add openhab user to recommended system groups (#143)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Clark <ben@benjyc.uk>
  • Loading branch information
BClark09 authored Jan 29, 2019
1 parent 93dfeed commit 806d9c1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions resources/control-runtime/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ scanVersioningList() {

case "$1" in
configure|1|2)
OH_USER=openhab
OH_GROUP=openhab
for pGroup in bluetooth tty dialout audio
do
if ! id -nG "$OH_USER" | grep -qw "$pGroup"; then
if getent group $pGroup > /dev/null 2>&1 ; then
usermod -a -G $pGroup $OH_USER
fi
fi
done
if [ -z "$2" ] && [ "$1" != 2 ] ; then
# this is a fresh installation
if [ -x /bin/systemctl ] ; then
Expand All @@ -192,8 +202,6 @@ case "$1" in
checkJava
else
# this is an upgrade
OH_USER=openhab
OH_GROUP=openhab
if [ x"${USER_AND_GROUP}" != x ]; then
OH_USER=$(echo "${USER_AND_GROUP}" | cut -d ":" -f 1)
OH_GROUP=$(echo "${USER_AND_GROUP}" | cut -d ":" -f 2)
Expand Down

0 comments on commit 806d9c1

Please sign in to comment.