diff --git a/Makefile b/Makefile index d1ee1c06838..b74287dfdf1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/dist/rpm/openQA-test.spec b/dist/rpm/openQA-test.spec index c57e1fd2c99..d0667ddb0aa 100644 --- a/dist/rpm/openQA-test.spec +++ b/dist/rpm/openQA-test.spec @@ -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 @@ -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 diff --git a/dist/rpm/openQA-worker-test.spec b/dist/rpm/openQA-worker-test.spec index 52115835a77..a0be844c908 100644 --- a/dist/rpm/openQA-worker-test.spec +++ b/dist/rpm/openQA-worker-test.spec @@ -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 @@ -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 diff --git a/dist/rpm/openQA.spec b/dist/rpm/openQA.spec index 0b0fd9b0d24..99b30b4f830 100644 --- a/dist/rpm/openQA.spec +++ b/dist/rpm/openQA.spec @@ -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 @@ -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 @@ -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 @@ -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} @@ -371,6 +388,9 @@ 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" \ @@ -378,6 +398,7 @@ if ! getent passwd _openqa-worker > /dev/null; then # 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} @@ -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 @@ -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 diff --git a/usr/lib/sysusers.d/geekotest.conf b/usr/lib/sysusers.d/geekotest.conf new file mode 100644 index 00000000000..017ba42fd58 --- /dev/null +++ b/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 diff --git a/usr/lib/sysusers.d/openQA-worker.conf b/usr/lib/sysusers.d/openQA-worker.conf new file mode 100644 index 00000000000..a07ccfcd4f1 --- /dev/null +++ b/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