Skip to content

Commit

Permalink
pybridge: Move cockpit-beiboot from client into cockpit module
Browse files Browse the repository at this point in the history
Start shipping it in the cockpit-bridge rpm/deb in libexecdir. This
paves the way for enabling this functionality in the cockpit/ws
container and other places, and reduces the flatpak special cases.

Note that this still keeps the beiboot functionality disabled for
standard package installs, as desired -- this needs to be explicitly
configured in `cockpit.conf`.
  • Loading branch information
martinpitt committed Aug 24, 2023
1 parent 34a88e5 commit 11624cc
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ install-python:
python3 -m pip install --no-index --force-reinstall --root='$(DESTDIR)/' --prefix='$(prefix)' \
"$$(python3 '$(srcdir)'/src/build_backend.py --wheel '$(srcdir)' tmp/wheel)"
mkdir -p $(DESTDIR)$(libexecdir)
mv -t $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir)/cockpit-askpass
mv -t $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir)/cockpit-askpass $(DESTDIR)$(bindir)/cockpit-beiboot
endif


Expand Down
3 changes: 2 additions & 1 deletion src/build_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ def build_wheel(wheel_directory: str,
],
'entry_points.txt': [
'[console_scripts]',
'cockpit-bridge = cockpit.bridge:main',
'cockpit-askpass = cockpit._vendor.ferny.interaction_client:main',
'cockpit-beiboot = cockpit.beiboot:main',
'cockpit-bridge = cockpit.bridge:main',
],
}

Expand Down
7 changes: 1 addition & 6 deletions src/client/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

# We actually always install cockpit-client in libexec,
# but ENABLE_COCKPIT_CLIENT controls whether we install
# the desktop file, icons, a symlink in /usr/bin, and
# cockpit-beiboot.
# the desktop file, icons and a symlink in /usr/bin.
# This is currently **EXPERIMENTAL**

cockpitclientdir = $(libexecdir)
Expand All @@ -18,10 +17,6 @@ install-cockpit-client-symlink:
mkdir -p $(DESTDIR)/$(bindir)
ln -sfTv $(cockpitclientdir)/cockpit-client $(DESTDIR)/$(bindir)/cockpit-client

if WITH_PYBRIDGE
dist_cockpitclient_SCRIPTS += src/client/cockpit-beiboot
endif

dbusservicesdir = $(datadir)/dbus-1/services
dist_dbusservices_DATA = src/client/org.cockpit_project.CockpitClient.service

Expand Down
2 changes: 0 additions & 2 deletions src/client/cockpit-beiboot → src/cockpit/beiboot.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

# This file is part of Cockpit.
#
# Copyright (C) 2022 Red Hat, Inc.
Expand Down
5 changes: 2 additions & 3 deletions test/verify/check-client
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class TestClient(testlib.MachineCase):
super().setUp()
self.m_target = self.machines["target"]
self.m_client = self.machines["client"]
self.m_client.upload(["../src/client/cockpit-beiboot"], "/usr/local/bin/")
self.m_target.execute("hostnamectl set-hostname target")
# validate on-demand install: this does not work on arch, non-split package
if self.m_target.image.startswith("debian") or self.m_target.image.startswith("ubuntu"):
Expand All @@ -44,14 +43,14 @@ class TestClient(testlib.MachineCase):
self.m_target.execute("rpm --erase --verbose cockpit-pcp pcp")

# replicate the plumbing bits of src/client/cockpit-client to set up cockpit-beiboot
self.m_client.write("/etc/cockpit/cockpit.conf", """
self.m_client.write("/etc/cockpit/cockpit.conf", f"""
[WebService]
X-For-CockpitClient = true
LoginTo = true
[Ssh-Login]
ReportStderr = true
Command = /usr/local/bin/cockpit-beiboot
Command = {self.libexecdir}/cockpit-beiboot
""")

def logout(self, check_last_host=None):
Expand Down
3 changes: 2 additions & 1 deletion tools/cockpit.spec
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ for data in doc man pixmaps polkit-1; do
done
rm -r %{buildroot}/%{_prefix}/%{__lib}/tmpfiles.d
find %{buildroot}/%{_unitdir}/ -type f ! -name 'cockpit-session*' -delete
for libexec in cockpit-askpass cockpit-session cockpit-ws cockpit-tls cockpit-wsinstance-factory cockpit-client cockpit-client.ui cockpit-desktop cockpit-certificate-helper cockpit-certificate-ensure; do
for libexec in cockpit-askpass cockpit-beiboot cockpit-session cockpit-ws cockpit-tls cockpit-wsinstance-factory cockpit-client cockpit-client.ui cockpit-desktop cockpit-certificate-helper cockpit-certificate-ensure; do
rm -f %{buildroot}/%{_libexecdir}/$libexec
done
rm -r %{buildroot}/%{_sysconfdir}/pam.d %{buildroot}/%{_sysconfdir}/motd.d %{buildroot}/%{_sysconfdir}/issue.d
Expand Down Expand Up @@ -376,6 +376,7 @@ system on behalf of the web based user interface.
%{_libexecdir}/cockpit-askpass
%if %{cockpit_enable_python}
%{python3_sitelib}/%{name}*
%{_libexecdir}/cockpit-beiboot
%endif

%package doc
Expand Down
1 change: 1 addition & 0 deletions tools/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ifeq ($(C_BRIDGE),)
# we don't need this, it contains full build paths and breaks reproducibility
rm -r debian/tmp/usr/lib/python*/*-packages/*.dist-info
dh_install -p cockpit-bridge debian/tmp/usr/lib/python*
dh_install -p cockpit-bridge debian/tmp/usr/lib/cockpit/cockpit-beiboot
endif

make install-tests DESTDIR=debian/cockpit-tests
Expand Down

0 comments on commit 11624cc

Please sign in to comment.