Newer
Older
openhab / install.sh
@Pascal Gollor Pascal Gollor on 30 May 2017 461 bytes add install script
#!/bin/bash


userStr=$(getent passwd openhab)

# check user
if [ -z $userStr ]; then
	echo "create openhab user and group"

	useradd -r -s /sbin/nologin openhab
fi

# gut user id
uid=$(id openhab -u)
gid=$(id openhab -g)

# create directories
mkdir -p data/conf
mkdir -p data/userdata
mkdir -p data/addons

chown -R ${uid}:${gid} data
chmod -R 770 data

# replace uid and gid in config file
sed -i "/^OPENHAB_USER/c\\\OPENHAB_USER=${uid}:${gid}" openhab.conf