How are changes to the OS applied during openhab installation?

During installation of openhab package (apt install openhab) a lot of configuration changes are applied to the system such as:

  • add group openhab
  • add user openhab
  • set home directory of user openhab to /var/lib/openhab
  • add user openhab to groups audio, dialout, tty, bluetooth
  • set shell to /bin/false
  • etc

Can anybody guide me to the source, how and where these changes are performed?
I’d like to understand a bit more of the mechanics.
This is not about openhabian. When executing apt install openhab all the above changes are applied.

GitHub - openhab/openhab-linuxpkg: Repo for Linux packages is the repo.

I think the script that creates the users in specific is https://github.com/openhab/openhab-linuxpkg/blob/10061acd36524afb12a033fea6dcf142b399bf56/resources/control-runtime/preinst

1 Like

Great! Thanks a lot. I was searching in the wrong repository.

A deb package file contains more than just the stuff that is being installed when apt install is being executed.
You can

  • get a deb package file’s location:
apt-get -y install --print-uris openhab
  • download a deb file from it’s location:
wget https://openhab.jfrog.io/artifactory/openhab-linuxpkg/pool/main/4.1.1/openhab_4.1.1-1_all.deb
  • extract the content of the deb file:
ar x openhab_4.1.1-1_all.deb
  • files that are contained in the deb file:
-rw-r--r-- 1 schlue schlue 110346752 Feb 14 22:09 data.tar.gz
-rw-r--r-- 1 schlue schlue       821 Feb 14 22:09 _gpgorigin
-rw-r--r-- 1 schlue schlue     22038 Feb 14 22:09 control.tar.gz
-rw-r--r-- 1 schlue schlue         4 Feb 14 22:09 debian-binary
  • get the control files:
zcat control.tar.gz | tar xfv -
./preinst
./conffiles
./postrm
./prerm
./postinst
./control
./md5sums
  • check content of preinst ( using an editor )
    if ! getent passwd "$OH_USER" > /dev/null 2>&1 ; then
      adduser --quiet --system --ingroup "$OH_GROUP" --no-create-home \
      --disabled-password --shell /bin/false \
      --gecos "openhab runtime user" --home /var/lib/openhab "$OH_USER"
1 Like

excellent. Thanks a lot to both of you!
I unzipped deb with 7-zip and obviously that was wrong as 7-zip did not show the control.tar.gz