infinoted: Use systemd-sysusers for creating a system user account

- Drop dependency on 'adduser' package.

Tests:

- Functional tests for infinoted work.

- Installing infinoted app works. The system user and group are created with
proper UID/GID, shell, gecos, and home directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2026-05-13 13:44:32 -07:00
parent f4be9039d2
commit e48ff1afbc
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 8 additions and 17 deletions

View File

@ -0,0 +1,6 @@
# Create system user and group to run infinoted as system daemon (as opposed to
# running in particular user's account). The user is created at boot or when
# 'systemd-sysusers freedombox-infinoted.conf' is run. To override this file as
# system administrator, create a file /etc/sysusers.d/freedombox-infinoted.conf
# or link it to /dev/null.
u! infinoted - "Infinoted collaborative editing server" /var/lib/infinoted

View File

@ -1,10 +1,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Configure infinoted."""
import grp
import os
import pathlib
import pwd
import shutil
import subprocess
import time
@ -126,21 +124,8 @@ def setup():
action_utils.service_daemon_reload()
# Create infinoted group if needed.
try:
grp.getgrnam('infinoted')
except KeyError:
action_utils.run(['addgroup', '--system', 'infinoted'], check=True)
# Create infinoted user if needed.
try:
pwd.getpwnam('infinoted')
except KeyError:
action_utils.run([
'adduser', '--system', '--ingroup', 'infinoted', '--home',
DATA_DIR, '--gecos', 'Infinoted collaborative editing server',
'infinoted'
], check=True)
# Create an 'infinoted' system user and group, if needed.
action_utils.run(['systemd-sysusers', 'freedombox-infinoted.conf'])
for directory in (DATA_DIR, KEY_DIR, SYNC_DIR):
if not os.path.exists(directory):