From 23b9028c58b52ea11dfce1fcf5413201da43ff3c4b77377cabfd0283be43e2c9 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Fri, 17 Jun 2022 10:06:35 +0000 Subject: [PATCH] Accepting request 982641 from home:dgdavid:branches:systemsmanagement:cockpit Start loading a custom CSS file In order to override Cockpit's default styling, another CSS file is loaded in every HTML page. It works, but as a workaround already discussed with upstream [1]. We will revert this patch when Cockpit provides better technique [2]. For now, it fulfills the requirements of [3]. Note that the empty css-overrides.css file is placed into /usr/share/cockpit/static because, at least during the prototype phase, the cockpit-suse-theme will put the real css-overrides.css file in /usr/share/cockpit/branding/default instead of using a specific release $ID (i.e, no /usr/share/cockpit/branding/opensuse-tumbleweed/css-overrides.css by now). See [4]. [1] https://github.com/cockpit-project/cockpit/pull/17437 [2] https://github.com/cockpit-project/cockpit/issues/16359 [3] https://en.opensuse.org/openSUSE:ALP/Workgroups/SysMngmnt [4] https://github.com/cockpit-project/cockpit/blob/main/doc/branding.md OBS-URL: https://build.opensuse.org/request/show/982641 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:cockpit/cockpit?expand=0&rev=91 --- cockpit.spec | 2 + css-overrides.patch | 353 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 355 insertions(+) create mode 100644 css-overrides.patch diff --git a/cockpit.spec b/cockpit.spec index 718cda3..2e21353 100644 --- a/cockpit.spec +++ b/cockpit.spec @@ -52,6 +52,7 @@ Source97: node_modules.spec.inc Patch1: 0001-selinux-allow-login-to-read-motd-file.patch Patch2: hide-docs.patch Patch3: suse-microos-branding.patch +Patch4: css-overrides.patch # SLE Micro specific patches Patch100: remove-pwscore.patch Patch101: hide-pcp.patch @@ -277,6 +278,7 @@ find %{buildroot}%{_datadir}/cockpit/playground -type f >> tests.list echo '%dir %{_datadir}/cockpit/static' > static.list echo '%dir %{_datadir}/cockpit/static/fonts' >> static.list +cp pkg/static/css-overrides.css %{buildroot}%{_datadir}/cockpit/static/ find %{buildroot}%{_datadir}/cockpit/static -type f >> static.list # when not building basic packages, remove their files diff --git a/css-overrides.patch b/css-overrides.patch new file mode 100644 index 0000000..628048d --- /dev/null +++ b/css-overrides.patch @@ -0,0 +1,353 @@ +From 617d236f005538be4a53b4a4cb88aac0ad6bf14b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= +Date: Mon, 13 Jun 2022 20:05:21 +0100 +Subject: [PATCH] Load custom CSS + +In order to override Cockpit's default styling, another CSS file is +loaded in every HTML page. It works, but as a workaround already +discussed with upstream [1]. + +We will revert this patch when Cockpit provides better technique [2]. For +now, it fulfills the requirements of [3]. + +[1] https://github.com/cockpit-project/cockpit/pull/17437 +[2] https://github.com/cockpit-project/cockpit/issues/16359 +[3] https://en.opensuse.org/openSUSE:ALP/Workgroups/SysMngmnt +--- + pkg/apps/index.html | 1 + + pkg/kdump/index.html | 1 + + pkg/metrics/index.html | 1 + + pkg/networkmanager/firewall.html | 1 + + pkg/networkmanager/index.html | 1 + + pkg/packagekit/index.html | 1 + + pkg/playground/index.html | 1 + + pkg/playground/journal.html | 1 + + pkg/playground/metrics.html | 1 + + pkg/playground/plot.html | 1 + + pkg/playground/react-patterns.html | 1 + + pkg/playground/speed.html | 1 + + pkg/playground/test.html | 1 + + pkg/selinux/setroubleshoot.html | 1 + + pkg/shell/index.html | 1 + + pkg/shell/shell.html | 1 + + pkg/sosreport/index.html | 1 + + pkg/storaged/index.html | 1 + + pkg/systemd/hwinfo.html | 1 + + pkg/systemd/index.html | 1 + + pkg/systemd/logs.html | 1 + + pkg/systemd/services.html | 1 + + pkg/systemd/terminal.html | 1 + + pkg/users/index.html | 1 + + src/branding/default/css-overrides.css | 12 ++++++++++++ + 25 files changed, 36 insertions(+) + create mode 100644 src/branding/default/css-overrides.css + +diff --git a/pkg/apps/index.html b/pkg/apps/index.html +index 176f2eb01..b77cfd6d9 100644 +--- a/pkg/apps/index.html ++++ b/pkg/apps/index.html +@@ -23,6 +23,7 @@ along with Cockpit; If not, see . + Applications + + ++ + + + +diff --git a/pkg/kdump/index.html b/pkg/kdump/index.html +index 6c5228ccb..87ca05d74 100644 +--- a/pkg/kdump/index.html ++++ b/pkg/kdump/index.html +@@ -25,6 +25,7 @@ along with Cockpit; If not, see . + + + ++ + + + +diff --git a/pkg/metrics/index.html b/pkg/metrics/index.html +index a62d780b5..9d5d104a5 100644 +--- a/pkg/metrics/index.html ++++ b/pkg/metrics/index.html +@@ -23,6 +23,7 @@ along with this package; If not, see . + + + ++ + + + +diff --git a/pkg/networkmanager/firewall.html b/pkg/networkmanager/firewall.html +index 016650651..da60cb121 100644 +--- a/pkg/networkmanager/firewall.html ++++ b/pkg/networkmanager/firewall.html +@@ -23,6 +23,7 @@ along with Cockpit; If not, see . + + + ++ + + + +diff --git a/pkg/networkmanager/index.html b/pkg/networkmanager/index.html +index ada48b1f1..e44e7cdd1 100644 +--- a/pkg/networkmanager/index.html ++++ b/pkg/networkmanager/index.html +@@ -24,6 +24,7 @@ + + + ++ + + + +diff --git a/pkg/packagekit/index.html b/pkg/packagekit/index.html +index 9489fe9c4..eafa63726 100644 +--- a/pkg/packagekit/index.html ++++ b/pkg/packagekit/index.html +@@ -24,6 +24,7 @@ along with Cockpit; If not, see . + + + ++ + + + +diff --git a/pkg/playground/index.html b/pkg/playground/index.html +index bfa507064..f8419f572 100644 +--- a/pkg/playground/index.html ++++ b/pkg/playground/index.html +@@ -5,6 +5,7 @@ + Cockpit Development Playground + + ++ + + + +diff --git a/pkg/playground/journal.html b/pkg/playground/journal.html +index df2743a75..61ce3cd46 100644 +--- a/pkg/playground/journal.html ++++ b/pkg/playground/journal.html +@@ -5,6 +5,7 @@ + Cockpit Journal Box + + ++ + + + +diff --git a/pkg/playground/metrics.html b/pkg/playground/metrics.html +index c16c619c4..7987d0cf5 100644 +--- a/pkg/playground/metrics.html ++++ b/pkg/playground/metrics.html +@@ -5,6 +5,7 @@ + Cockpit Monitoring + + ++ + + + +diff --git a/pkg/playground/plot.html b/pkg/playground/plot.html +index f451bef1a..06dad225d 100644 +--- a/pkg/playground/plot.html ++++ b/pkg/playground/plot.html +@@ -5,6 +5,7 @@ + Cockpit Plots + + ++ + + + +diff --git a/pkg/playground/react-patterns.html b/pkg/playground/react-patterns.html +index 0bf888664..3db9e08a2 100644 +--- a/pkg/playground/react-patterns.html ++++ b/pkg/playground/react-patterns.html +@@ -5,6 +5,7 @@ + Cockpit React Patterns Usage + + ++ + + + +diff --git a/pkg/playground/speed.html b/pkg/playground/speed.html +index 86a8cd7a6..0920be9dc 100644 +--- a/pkg/playground/speed.html ++++ b/pkg/playground/speed.html +@@ -5,6 +5,7 @@ + Cockpit Speed Tests + + ++ + + + +diff --git a/pkg/playground/test.html b/pkg/playground/test.html +index 61220e5df..34cd6d738 100644 +--- a/pkg/playground/test.html ++++ b/pkg/playground/test.html +@@ -5,6 +5,7 @@ + Cockpit playground + + ++ + + + +diff --git a/pkg/selinux/setroubleshoot.html b/pkg/selinux/setroubleshoot.html +index d412acf4a..981dc30bc 100644 +--- a/pkg/selinux/setroubleshoot.html ++++ b/pkg/selinux/setroubleshoot.html +@@ -25,6 +25,7 @@ along with Cockpit; If not, see . + + + ++ + + + +diff --git a/pkg/shell/index.html b/pkg/shell/index.html +index 4e7204f48..6c85e2faf 100644 +--- a/pkg/shell/index.html ++++ b/pkg/shell/index.html +@@ -6,6 +6,7 @@ + + + ++ + + + +diff --git a/pkg/shell/shell.html b/pkg/shell/shell.html +index 5c7bcd121..edc8edd99 100644 +--- a/pkg/shell/shell.html ++++ b/pkg/shell/shell.html +@@ -5,6 +5,7 @@ + + + ++ + + +
+diff --git a/pkg/sosreport/index.html b/pkg/sosreport/index.html +index 37c26f81d..7273c108e 100644 +--- a/pkg/sosreport/index.html ++++ b/pkg/sosreport/index.html +@@ -22,6 +22,7 @@ along with Cockpit; If not, see . + Diagnostic reports + + ++ + + + +diff --git a/pkg/storaged/index.html b/pkg/storaged/index.html +index d56fcb7b5..36953f0d9 100644 +--- a/pkg/storaged/index.html ++++ b/pkg/storaged/index.html +@@ -24,6 +24,7 @@ + + + ++ + + + +diff --git a/pkg/systemd/hwinfo.html b/pkg/systemd/hwinfo.html +index ef0fa560d..fb649d358 100644 +--- a/pkg/systemd/hwinfo.html ++++ b/pkg/systemd/hwinfo.html +@@ -4,6 +4,7 @@ + Hardware information + + ++ + + + +diff --git a/pkg/systemd/index.html b/pkg/systemd/index.html +index bea228152..f4a6983bd 100644 +--- a/pkg/systemd/index.html ++++ b/pkg/systemd/index.html +@@ -7,6 +7,7 @@ + + + ++ + + + +diff --git a/pkg/systemd/logs.html b/pkg/systemd/logs.html +index 1475a96ec..7cd64312b 100644 +--- a/pkg/systemd/logs.html ++++ b/pkg/systemd/logs.html +@@ -23,6 +23,7 @@ along with Cockpit; If not, see . + Journal + + ++ + + + +diff --git a/pkg/systemd/services.html b/pkg/systemd/services.html +index 038680dcd..c665da6cf 100644 +--- a/pkg/systemd/services.html ++++ b/pkg/systemd/services.html +@@ -5,6 +5,7 @@ + + + ++ + + + +diff --git a/pkg/systemd/terminal.html b/pkg/systemd/terminal.html +index 536ae4eed..ff5a592d6 100644 +--- a/pkg/systemd/terminal.html ++++ b/pkg/systemd/terminal.html +@@ -5,6 +5,7 @@ + + + ++ + + + +diff --git a/pkg/users/index.html b/pkg/users/index.html +index 6b945a3a9..7060e88fd 100644 +--- a/pkg/users/index.html ++++ b/pkg/users/index.html +@@ -24,6 +24,7 @@ + + + ++ + + + +diff --git a/pkg/static/css-overrides.css b/pkg/static/css-overrides.css +new file mode 100644 +index 000000000..f489352af +--- /dev/null ++++ b/pkg/static/css-overrides.css +@@ -0,0 +1,12 @@ ++/** ++ * PLEASE, DO NOT CHANGE THIS FILE. ++ * ++ * It is here to avoid 404 errors on openSUSE Cockpit patched version when no ++ * package for overriding the default style is installed. If a better ++ * alternative becomes available, it will be removed. ++ * ++ * To know more, please follow below links ++ * ++ * - https://github.com/cockpit-project/cockpit/pull/17437 ++ * - https://github.com/cockpit-project/cockpit/issues/16359 ++ */ +-- +2.36.1 +