## Copyright (C) 2014-2020 Red Hat, Inc.# SPDX-License-Identifier: LGPL-2.1-or-later## This file is maintained at the following location:# https://github.com/cockpit-project/cockpit/blob/main/tools/cockpit.spec## If you are editing this file in another location, changes will likely# be clobbered the next time an automated release is done.## Check first cockpit-devel@lists.fedorahosted.org## earliest base that the subpackages work on; this is still required as long as# we maintain the basic/optional split, then it can be replaced with just %{version}.%define required_base 266# we generally want CentOS packages to be like RHEL; special cases need to check %{centos} explicitly%if 0%{?centos}%define rhel %{centos}%endif%define _hardened_build 1%define __lib lib%if 0%{?suse_version} > 1500%define pamconfdir %{_pam_vendordir}%define pamconfig tools/cockpit.suse.pam%else%define pamconfdir %{_sysconfdir}/pam.d%define pamconfig tools/cockpit.pam%endif%if %{defined _pamdir}%define pamdir %{_pamdir}%else%define pamdir %{_libdir}/security%endif# distributions which ship nodejs-esbuild can rebuild the bundle during package build# allow override from command line (e.g. for development builds)%if 0%{?fedora} >= 42%{!?rebuild_bundle: %define rebuild_bundle 1}%endif# to avoid using asciidoc-py in RHEL and CentOS we use the prebuilt docs%if 0%{?rhel}%define bundle_docs 1%endifName: cockpitSummary: Web Console for Linux serversLicense: LGPL-2.1-or-later AND GPL-3.0-or-later AND MIT AND CC-BY-SA-3.0 AND BSD-3-ClauseURL: https://cockpit-project.org/Version: 0Release: 1%{?dist}Source0: https://github.com/cockpit-project/cockpit/releases/download/%{version}/cockpit-%{version}.tar.xzSource1: https://github.com/cockpit-project/cockpit/releases/download/%{version}/cockpit-node-%{version}.tar.xz%if 0%{?fedora} >= 41 || 0%{?rhel}ExcludeArch: %{ix86}%endif%define enable_multihost 1%if 0%{?fedora} >= 41 || 0%{?rhel} >= 10%define enable_multihost 0%endif# Ship custom SELinux policy%define selinuxtype targeted%define selinux_configure_arg --enable-selinux-policy=%{selinuxtype}BuildRequires: gccBuildRequires: pkgconfig(gio-unix-2.0)BuildRequires: pkgconfig(json-glib-1.0)BuildRequires: pkgconfig(polkit-agent-1) >= 0.105BuildRequires: pam-develBuildRequires: autoconf automakeBuildRequires: makeBuildRequires: python3-develBuildRequires: gettext >= 0.21BuildRequires: openssl-develBuildRequires: gnutls-devel >= 3.4.3BuildRequires: zlib-develBuildRequires: krb5-devel >= 1.11BuildRequires: glib-networkingBuildRequires: sedBuildRequires: glib2-devel >= 2.68.0# this is for runtimedir in the tls proxy ace21c8879BuildRequires: systemd-devel >= 235%if 0%{?suse_version}BuildRequires: distribution-releaseBuildRequires: opensshBuildRequires: distribution-logosBuildRequires: wallpaper-branding%elseBuildRequires: openssh-clients%endifBuildRequires: krb5-serverBuildRequires: gdb%if 0%{?rebuild_bundle}BuildRequires: nodejsBuildRequires: %{_bindir}/nodeBuildRequires: nodejs-esbuild%endif%if !%{defined bundle_docs}%if 0%{?suse_version}BuildRequires: rubygem(asciidoctor)%elseBuildRequires: asciidoctor%endif%endifBuildRequires: selinux-policyBuildRequires: selinux-policy-devel# This is the "cockpit" metapackage. It should only# Require, Suggest or Recommend other cockpit-xxx subpackagesRequires: cockpit-bridgeRequires: cockpit-wsRequires: cockpit-system# Optional componentsRecommends: (cockpit-storaged if udisks2)Recommends: (cockpit-packagekit if dnf)%if 0%{?suse_version} == 0Recommends: (dnf5daemon-server if dnf5)%endifSuggests: python3-pcp%if 0%{?rhel} == 0Recommends: (cockpit-networkmanager if NetworkManager)# c-ostree is not in RHEL 8/9Recommends: (cockpit-ostree if rpm-ostree)Suggests: cockpit-selinux%endif%if 0%{?rhel} && 0%{?centos} == 0Recommends: subscription-manager-cockpit%endifBuildRequires: python3-develBuildRequires: python3-pip%if 0%{?rhel} == 0 && !0%{?suse_version}# All of these are only required for running pytest (which we only do on Fedora)BuildRequires: procps-ngBuildRequires: python3-pytest-asyncioBuildRequires: python3-pytest-timeout%endif%prep%setup -q -n cockpit-%{version}%if 0%{?rebuild_bundle}%setup -q -D -T -a 1 -n cockpit-%{version}%endif%build%if 0%{?rebuild_bundle}rm -rf dist# HACK: node module packaging is currently broken in Fedora ≤ 43, should be in# common location, not major version specific oneNODE_ENV=production NODE_PATH=/usr/lib/node_modules:$(echo /usr/lib/node_modules_*) ./build.js%else# Use pre-built bundle on distributions without nodejs-esbuild%endif%configure \%{?selinux_configure_arg} \%if 0%{?suse_version}--docdir=%_defaultdocdir/%{name} \%endif--with-pamdir='%{pamdir}' \%if %{enable_multihost}--enable-multihost \%endif%if %{defined bundle_docs}--disable-doc \%endif%make_build%checkmake -j$(nproc) check%if 0%{?rhel} == 0 && 0%{?suse_version} == 0export NO_QUNIT=1%pytest%endif%install%if 0%{?suse_version}export NO_BRP_STALE_LINK_ERROR="yes"%endif%make_installmkdir -p $RPM_BUILD_ROOT%{pamconfdir}install -p -m 644 %{pamconfig} $RPM_BUILD_ROOT%{pamconfdir}/cockpitrm -f %{buildroot}/%{_libdir}/cockpit/*.soinstall -D -p -m 644 AUTHORS README.md %{buildroot}%{_docdir}/cockpit/# We install the upstream pre-built docs as we can't build them%if %{defined bundle_docs}%define docbundledir %{_builddir}/%{name}-%{version}/doc/output/htmlinstall -d %{buildroot}%{_docdir}/cockpit/guidecp -rp %{docbundledir}/* %{buildroot}%{_docdir}/cockpit/guide/# Install pre-built man pages%define manbundledir %{_builddir}/%{name}-%{version}/doc/output/manfor section in 1 5 8; dofor manpage in %{manbundledir}/*.${section}; doinstall -D -p -m 644 "$manpage" %{buildroot}%{_mandir}/man${section}/$(basename "$manpage")donedone%endif# Build the package lists for resource packages# cockpit-bridge is the basic dependency for all cockpit-* packages, so centrally own the page directoryecho '%dir %{_datadir}/cockpit' > base.listecho '%dir %{_datadir}/cockpit/base1' >> base.listfind %{buildroot}%{_datadir}/cockpit/base1 -type f -o -type l >> base.listecho '%{_sysconfdir}/cockpit/machines.d' >> base.listecho %{buildroot}%{_datadir}/polkit-1/actions/org.cockpit-project.cockpit-bridge.policy >> base.listecho '%dir %{_datadir}/cockpit/shell' >> system.listfind %{buildroot}%{_datadir}/cockpit/shell -type f >> system.listecho '%dir %{_datadir}/cockpit/systemd' >> system.listfind %{buildroot}%{_datadir}/cockpit/systemd -type f >> system.listecho '%dir %{_datadir}/cockpit/users' >> system.listfind %{buildroot}%{_datadir}/cockpit/users -type f >> system.listecho '%dir %{_datadir}/cockpit/metrics' >> system.listfind %{buildroot}%{_datadir}/cockpit/metrics -type f >> system.listecho '%dir %{_datadir}/cockpit/kdump' > kdump.listfind %{buildroot}%{_datadir}/cockpit/kdump -type f >> kdump.listecho '%dir %{_datadir}/cockpit/sosreport' > sosreport.listfind %{buildroot}%{_datadir}/cockpit/sosreport -type f >> sosreport.listecho '%dir %{_datadir}/cockpit/storaged' > storaged.listfind %{buildroot}%{_datadir}/cockpit/storaged -type f >> storaged.listecho '%dir %{_datadir}/cockpit/networkmanager' > networkmanager.listfind %{buildroot}%{_datadir}/cockpit/networkmanager -type f >> networkmanager.listecho '%dir %{_datadir}/cockpit/packagekit' > packagekit.listfind %{buildroot}%{_datadir}/cockpit/packagekit -type f >> packagekit.listecho '%dir %{_datadir}/cockpit/apps' >> packagekit.listfind %{buildroot}%{_datadir}/cockpit/apps -type f >> packagekit.listecho '%dir %{_datadir}/cockpit/selinux' > selinux.listfind %{buildroot}%{_datadir}/cockpit/selinux -type f >> selinux.listecho '%dir %{_datadir}/cockpit/static' > static.listecho '%dir %{_datadir}/cockpit/static/fonts' >> static.listfind %{buildroot}%{_datadir}/cockpit/static -type f >> static.listsed -i "s|%{buildroot}||" *.list%if 0%{?suse_version}# remove files of not installable packagesrm -r %{buildroot}%{_datadir}/cockpit/sosreportrm -f %{buildroot}/%{_prefix}/share/metainfo/org.cockpit_project.cockpit_sosreport.metainfo.xmlrm -f %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/cockpit-sosreport.png%else%global _debugsource_packages 1%global _debuginfo_subpackages 0%define find_debug_info %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} %{?_debugsource_packages:-S debugsourcefiles.list} "%{_builddir}/%{?buildsubdir}"%endif# /suse_versionrm -rf %{buildroot}/usr/src/debug# On RHEL kdump, networkmanager, selinux, and sosreport are part of the system package%if 0%{?rhel}cat kdump.list sosreport.list networkmanager.list selinux.list >> system.listrm -f %{buildroot}%{_datadir}/metainfo/org.cockpit_project.cockpit_sosreport.metainfo.xmlrm -f %{buildroot}%{_datadir}/metainfo/org.cockpit_project.cockpit_kdump.metainfo.xmlrm -f %{buildroot}%{_datadir}/metainfo/org.cockpit_project.cockpit_selinux.metainfo.xmlrm -f %{buildroot}%{_datadir}/metainfo/org.cockpit_project.cockpit_networkmanager.metainfo.xmlrm -f %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/cockpit-sosreport.png%endif# -------------------------------------------------------------------------------# Sub-packages%descriptionThe Cockpit Web Console enables users to administer GNU/Linux servers using aweb browser.It offers network configuration, log inspection, diagnostic reports, SELinuxtroubleshooting, interactive command-line sessions, and more.%files%license LICENSES/LGPL-2.1.txt%{_docdir}/cockpit/AUTHORS%{_docdir}/cockpit/README.md%{_datadir}/metainfo/org.cockpit_project.cockpit.appdata.xml%{_datadir}/icons/hicolor/128x128/apps/cockpit.png%doc %{_mandir}/man1/cockpit.1.gz%package bridgeSummary: Cockpit bridge server-side componentBuildArch: noarch%description bridgeThe Cockpit bridge component installed server side and runs commands on thesystem on behalf of the web based user interface.%files bridge -f base.list%license LICENSES/GPL-3.0.txt%doc %{_mandir}/man1/cockpit-bridge.1.gz%{_bindir}/cockpit-bridge%{_libexecdir}/cockpit-askpass%{python3_sitelib}/%{name}*%package docSummary: Cockpit deployment and developer guideBuildArch: noarch%description docThe Cockpit Deployment and Developer Guide shows sysadmins how todeploy Cockpit on their machines as well as helps developers who want toembed or extend Cockpit.%files doc%license LICENSES/LGPL-2.1.txt%exclude %{_docdir}/cockpit/AUTHORS%exclude %{_docdir}/cockpit/README.md%{_docdir}/cockpit%package systemSummary: Cockpit admin interface package for configuring and troubleshooting a systemBuildArch: noarchRequires: cockpit-bridge >= %{version}-%{release}%if !0%{?suse_version}Requires: shadow-utils%endifRequires: grepRequires: /usr/bin/pwscoreRequires: /usr/bin/dateProvides: cockpit-shell = %{version}-%{release}Provides: cockpit-systemd = %{version}-%{release}Provides: cockpit-tuned = %{version}-%{release}Provides: cockpit-users = %{version}-%{release}%if 0%{?rhel}Requires: NetworkManager >= 1.6Requires: sosRequires: sudoRecommends: setroubleshoot-server >= 3.3.3Recommends: /usr/bin/kdumpctlSuggests: NetworkManager-teamSuggests: python3-pcpProvides: cockpit-kdump = %{version}-%{release}Provides: cockpit-networkmanager = %{version}-%{release}Provides: cockpit-selinux = %{version}-%{release}Provides: cockpit-sosreport = %{version}-%{release}%endif#NPM_PROVIDES%description systemThis package contains the Cockpit shell and system configuration interfaces.%files system -f system.list%license LICENSES/LGPL-2.1.txt%dir %{_datadir}/cockpit/shell/images%package wsSummary: Cockpit Web ServiceRequires: opensslRequires: glib2 >= 2.68.0Requires: (%{name}-ws-selinux = %{version}-%{release} if selinux-policy-base)Recommends: sscg >= 2.3Recommends: system-logosSuggests: sssd-dbus >= 2.6.2# for cockpit-desktopSuggests: python3Obsoletes: cockpit-tests < 331# prevent hard python3 dependency for cockpit-desktop, it falls back to other browsers%global __requires_exclude_from ^%{_libexecdir}/cockpit-client$%description wsThe Cockpit Web Service listens on the network, and authenticates users.If sssd-dbus is installed, you can enable client certificate/smart cardauthentication via sssd/FreeIPA.%files ws -f static.list%license LICENSES/LGPL-2.1.txt%doc %{_mandir}/man1/cockpit-desktop.1.gz%doc %{_mandir}/man5/cockpit.conf.5.gz%doc %{_mandir}/man8/cockpit-ws.8.gz%doc %{_mandir}/man8/cockpit-tls.8.gz%doc %{_mandir}/man8/pam_ssh_add.8.gz%dir %{_sysconfdir}/cockpit%config(noreplace) %{_sysconfdir}/cockpit/ws-certs.d%config(noreplace) %{pamconfdir}/cockpit# created in %post, so that users can rm the files%ghost %{_sysconfdir}/issue.d/cockpit.issue%ghost %{_sysconfdir}/motd.d/cockpit%ghost %attr(0644, root, root) %{_sysconfdir}/cockpit/disallowed-users%dir %{_datadir}/cockpit/issue%{_datadir}/cockpit/issue/update-issue%{_datadir}/cockpit/issue/inactive.issue%{_unitdir}/cockpit.service%{_unitdir}/cockpit-issue.service%{_unitdir}/cockpit.socket%{_unitdir}/cockpit-session-socket-user.service%{_unitdir}/cockpit-session.socket%{_unitdir}/cockpit-session@.service%{_unitdir}/cockpit-wsinstance-http.socket%{_unitdir}/cockpit-wsinstance-http.service%{_unitdir}/cockpit-wsinstance-https-factory.socket%{_unitdir}/cockpit-wsinstance-https-factory@.service%{_unitdir}/cockpit-wsinstance-https@.socket%{_unitdir}/cockpit-wsinstance-https@.service%{_unitdir}/cockpit-wsinstance-socket-user.service%{_unitdir}/system-cockpithttps.slice%{_prefix}/%{__lib}/tmpfiles.d/cockpit-ws.conf%{pamdir}/pam_ssh_add.so%{_libexecdir}/cockpit-ws%{_libexecdir}/cockpit-wsinstance-factory%{_libexecdir}/cockpit-tls%{_libexecdir}/cockpit-client%{_libexecdir}/cockpit-client.ui%{_libexecdir}/cockpit-desktop%{_libexecdir}/cockpit-certificate-ensure%{_libexecdir}/cockpit-certificate-helper%{_libexecdir}/cockpit-session%{_datadir}/cockpit/branding%post ws# set up dynamic motd/issue symlinks on first-time install; don't bring them back on upgrades if admin removed them# disable root login on first-time install; so existing installations aren't changedif [ "$1" = 1 ]; thenmkdir -p /etc/motd.d /etc/issue.dln -s ../../run/cockpit/issue /etc/motd.d/cockpitln -s ../../run/cockpit/issue /etc/issue.d/cockpit.issueprintf "# List of users which are not allowed to login to Cockpit\n" > /etc/cockpit/disallowed-usersprintf "root\n" >> /etc/cockpit/disallowed-userschmod 644 /etc/cockpit/disallowed-usersfi# on upgrades, adjust motd/issue links to changed target if they still exist (changed in 331)if [ "$1" = 2 ]; thenif [ "$(readlink /etc/motd.d/cockpit 2>/dev/null)" = "../../run/cockpit/motd" ]; thenln -sfn ../../run/cockpit/issue /etc/motd.d/cockpitfiif [ "$(readlink /etc/issue.d/cockpit.issue 2>/dev/null)" = "../../run/cockpit/motd" ]; thenln -sfn ../../run/cockpit/issue /etc/issue.d/cockpit.issuefifi%tmpfiles_create cockpit-ws.conf%systemd_post cockpit.socket cockpit.service# firewalld only partially picks up changes to its services files without thistest -f %{_bindir}/firewall-cmd && firewall-cmd --reload --quiet || true# remove obsolete system user on upgrade (replaced with DynamicUser in version 330)if getent passwd cockpit-wsinstance >/dev/null; thenuserdel cockpit-wsinstancefi%preun ws%systemd_preun cockpit.socket cockpit.service%postun ws%systemd_postun_with_restart cockpit.socket cockpit.service%package ws-selinuxSummary: SELinux security policy for cockpit-ws# older -ws contained the SELinux policy, now split outConflicts: %{name}-ws < 337-1.2025Requires(post): selinux-policy-%{selinuxtype} >= %{_selinux_policy_version}Requires(post): libselinux-utilsRequires(post): policycoreutils%description ws-selinuxSELinux policy module for the cockpit-ws package.%files ws-selinux%license LICENSES/LGPL-2.1.txt%{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2%{_mandir}/man8/%{name}_session_selinux.8cockpit.*%{_mandir}/man8/%{name}_ws_selinux.8cockpit.*%ghost %{_selinux_store_path}/%{selinuxtype}/active/modules/200/%{name}%pre ws-selinux%selinux_relabel_pre -s %{selinuxtype}%post ws-selinux%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{name}.pp.bz2%selinux_relabel_post -s %{selinuxtype}%postun ws-selinux%selinux_modules_uninstall -s %{selinuxtype} %{name}%selinux_relabel_post -s %{selinuxtype}# -------------------------------------------------------------------------------# Sub-packages that are part of cockpit-system in RHEL/CentOS, but separate in Fedora%if 0%{?rhel} == 0%package kdumpSummary: Cockpit user interface for kernel crash dumpingRequires: cockpit-bridge >= %{required_base}Requires: cockpit-shell >= %{required_base}%if 0%{?suse_version}Requires: kexec-tools%elseRequires: /usr/bin/kdumpctl%endifBuildArch: noarch%description kdumpThe Cockpit component for configuring kernel crash dumping.%files kdump -f kdump.list%license LICENSES/LGPL-2.1.txt%{_datadir}/metainfo/org.cockpit_project.cockpit_kdump.metainfo.xml# sosreport is not supported on opensuse yet%if !0%{?suse_version}%package sosreportSummary: Cockpit user interface for diagnostic reportsRequires: cockpit-bridge >= %{required_base}Requires: cockpit-shell >= %{required_base}Requires: sosBuildArch: noarch%description sosreportThe Cockpit component for creating diagnostic reports with thesosreport tool.%files sosreport -f sosreport.list%license LICENSES/LGPL-2.1.txt%{_datadir}/metainfo/org.cockpit_project.cockpit_sosreport.metainfo.xml%{_datadir}/icons/hicolor/64x64/apps/cockpit-sosreport.png%endif%package networkmanagerSummary: Cockpit user interface for networking, using NetworkManagerRequires: cockpit-bridge >= %{required_base}Requires: cockpit-shell >= %{required_base}Requires: NetworkManager >= 1.6# Optional componentsRecommends: NetworkManager-teamBuildArch: noarch%description networkmanagerThe Cockpit component for managing networking. This package usesNetworkManager.%files networkmanager -f networkmanager.list%license LICENSES/LGPL-2.1.txt%{_datadir}/metainfo/org.cockpit_project.cockpit_networkmanager.metainfo.xml%endif%if 0%{?rhel} == 0%package selinuxSummary: Cockpit SELinux packageRequires: cockpit-bridge >= %{required_base}Requires: cockpit-shell >= %{required_base}# setroubleshoot is available on SLE Micro starting with 5.5%if !0%{?is_smo} || ( 0%{?is_smo} && 0%{?sle_version} >= 150500 )Requires: setroubleshoot-server >= 3.3.3%endifBuildArch: noarch%description selinuxThis package contains the Cockpit user interface integration with theutility setroubleshoot to diagnose and resolve SELinux issues.%files selinux -f selinux.list%license LICENSES/LGPL-2.1.txt%{_datadir}/metainfo/org.cockpit_project.cockpit_selinux.metainfo.xml%endif%package -n cockpit-storagedSummary: Cockpit user interface for storage, using udisksRequires: cockpit-shell >= %{required_base}Requires: udisks2 >= 2.9Recommends: udisks2-lvm2 >= 2.9Recommends: udisks2-iscsi >= 2.9%if ! 0%{?rhel}Recommends: (udisks2-btrfs >= 2.9 if btrfs-progs)%endifRecommends: device-mapper-multipathRecommends: clevis-luksRequires: %{__python3}%if 0%{?suse_version}Requires: python3-dbus-python%elseRequires: python3-dbus%endifBuildArch: noarch%description -n cockpit-storagedThe Cockpit component for managing storage. This package uses udisks.%files -n cockpit-storaged -f storaged.list%license LICENSES/LGPL-2.1.txt%{_datadir}/metainfo/org.cockpit_project.cockpit_storaged.metainfo.xml%post storaged# version 332 moved the btrfs temp mounts db to /runif [ "$1" = 2 ] && [ -d /var/lib/cockpit/btrfs ]; thenrm -rf --one-file-system /var/lib/cockpit/btrfs || truefi%package -n cockpit-packagekitSummary: Cockpit user interface for packagesBuildArch: noarchRequires: cockpit-bridge >= %{required_base}Requires: PackageKitRecommends: python3-tracer# HACK: https://bugzilla.redhat.com/show_bug.cgi?id=1800468Requires: polkit%description -n cockpit-packagekitThe Cockpit components for installing OS updates and Cockpit add-ons,via PackageKit.%files -n cockpit-packagekit -f packagekit.list%license LICENSES/LGPL-2.1.txt# The changelog is automatically generated and merged%changelog