Navigation Menu

Skip to content

Commit

Permalink
Reenable sysusers once again on Tumbleweed
Browse files Browse the repository at this point in the history
Next try at enabling systemd-sysusers, this time with the _openqa-worker
and geekotest users having a login shell & home directory set.

Also, we only do this on Tumbleweed due to boo#1189518

This reverts commit c5ef15d.
  • Loading branch information
dcermak committed Aug 25, 2021
1 parent c5f70ef commit a06cf0e
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Expand Up @@ -113,6 +113,10 @@ install-generic:

cp -Ra dbicdh "$(DESTDIR)"/usr/share/openqa/dbicdh

install -d -m 755 "$(DESTDIR)"/usr/lib/sysusers.d/
install -m 644 usr/lib/sysusers.d/openQA-worker.conf "$(DESTDIR)"/usr/lib/sysusers.d/
install -m 644 usr/lib/sysusers.d/geekotest.conf "$(DESTDIR)"/usr/lib/sysusers.d/

# Additional services which have a strong dependency on SUSE/openSUSE and do not
# make sense for other distributions
.PHONY: install-opensuse
Expand Down
4 changes: 4 additions & 0 deletions dist/rpm/openQA-test.spec
Expand Up @@ -6,6 +6,9 @@ Summary: Test package for openQA
License: GPL-2.0-or-later
BuildRequires: %{short_name} == %{version}
BuildRequires: openQA-local-db
%if 0%{?suse_version} > 1500
BuildRequires: user(geekotest)
%endif
ExcludeArch: i586

%description
Expand All @@ -20,6 +23,7 @@ touch %{_sourcedir}/%{short_name}
# call one of the components but not openqa itself which would need a valid
# configuration
/usr/share/openqa/script/initdb --help
getent passwd geekotest

%install
# disable debug packages in package test to prevent error about missing files
Expand Down
4 changes: 4 additions & 0 deletions dist/rpm/openQA-worker-test.spec
Expand Up @@ -5,6 +5,9 @@ Release: 0
Summary: Test package for %{short_name}
License: GPL-2.0-or-later
BuildRequires: %{short_name} == %{version}
%if 0%{?suse_version} > 1500
BuildRequires: user(_openqa-worker)
%endif
ExcludeArch: i586

%description
Expand All @@ -17,6 +20,7 @@ touch %{_sourcedir}/%{short_name}

%build
/usr/share/openqa/script/worker --help
getent passwd _openqa-worker

%install
# disable debug packages in package test to prevent error about missing files
Expand Down
27 changes: 27 additions & 0 deletions dist/rpm/openQA.spec
Expand Up @@ -124,6 +124,10 @@ BuildRequires: %{test_requires}
%if 0%{?suse_version} >= 1330
Requires(pre): group(nogroup)
%endif
%if 0%{?suse_version} > 1500
BuildRequires: sysuser-tools
%sysusers_requires
%endif

%description
openQA is a testing framework that allows you to test GUI applications on one
Expand Down Expand Up @@ -266,6 +270,10 @@ sed -e 's,/bin/env python,/bin/python,' -i script/openqa-label-all

%build
%make_build
%if 0%{?suse_version} > 1500
%sysusers_generate_pre usr/lib/sysusers.d/%{name}-worker.conf %{name}-worker %{name}-worker.conf
%sysusers_generate_pre usr/lib/sysusers.d/geekotest.conf %{name} geekotest.conf
%endif

%check
#for double checking
Expand Down Expand Up @@ -314,6 +322,11 @@ export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
%make_install

%if 0%{?suse_version} <= 1500
# we only use sysusers on Tumbleweed
rm -rf %{buildroot}/%{_sysusersdir}
%endif

mkdir -p %{buildroot}%{_datadir}/openqa%{_sysconfdir}/openqa
ln -s %{_sysconfdir}/openqa/openqa.ini %{buildroot}%{_datadir}/openqa%{_sysconfdir}/openqa/openqa.ini
ln -s %{_sysconfdir}/openqa/database.ini %{buildroot}%{_datadir}/openqa%{_sysconfdir}/openqa/database.ini
Expand Down Expand Up @@ -349,11 +362,15 @@ mkdir %{buildroot}%{_localstatedir}/lib/openqa/webui/cache
#
%fdupes %{buildroot}/%{_prefix}

%if 0%{?suse_version} > 1500
%pre -f %{name}.pre
%else
%pre
if ! getent passwd geekotest > /dev/null; then
%{_sbindir}/useradd -r -g nogroup -c "openQA user" \
-d %{_localstatedir}/lib/openqa geekotest 2>/dev/null || :
fi
%endif

%service_add_pre %{openqa_services}

Expand All @@ -371,13 +388,17 @@ if [ "$1" = 1 ]; then
fi
fi

%if 0%{?suse_version} > 1500
%pre worker -f openQA-worker.pre
%else
%pre worker
if ! getent passwd _openqa-worker > /dev/null; then
%{_sbindir}/useradd -r -g nogroup -c "openQA worker" \
-d %{_localstatedir}/lib/empty _openqa-worker 2>/dev/null || :
# might fail for non-kvm workers (qemu package owns the group)
%{_sbindir}/usermod _openqa-worker -a -G kvm || :
fi
%endif

%service_add_pre %{openqa_worker_services}

Expand Down Expand Up @@ -547,6 +568,9 @@ fi
%dir %{_localstatedir}/lib/openqa/share/factory/repo
%dir %{_localstatedir}/lib/openqa/share/factory/other
%ghost %{_localstatedir}/log/openqa
%if 0%{?suse_version} > 1500
%{_sysusersdir}/geekotest.conf
%endif

%files devel

Expand Down Expand Up @@ -611,6 +635,9 @@ fi
%dir %{_localstatedir}/lib/openqa/cache
# own one pool - to create the others is task of the admin
%dir %{_localstatedir}/lib/openqa/pool/1
%if 0%{?suse_version} > 1500
%{_sysusersdir}/%{name}-worker.conf
%endif

%files client
%dir %{_datadir}/openqa
Expand Down
3 changes: 3 additions & 0 deletions usr/lib/sysusers.d/geekotest.conf
@@ -0,0 +1,3 @@
# Type Name ID GECOS [HOME] Shell
u geekotest - "openQA user" /var/lib/openqa /bin/bash
m geekotest nogroup
4 changes: 4 additions & 0 deletions usr/lib/sysusers.d/openQA-worker.conf
@@ -0,0 +1,4 @@
# Type Name ID GECOS [HOME] Shell
u _openqa-worker - "openQA worker" /var/lib/empty /bin/bash
m _openqa-worker nogroup
m _openqa-worker kvm

0 comments on commit a06cf0e

Please sign in to comment.