From 4f00dfbdb1abd4541a05e0eb833e3b02aab36655 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Fri, 7 Mar 2025 15:41:55 +0000 Subject: [PATCH] * Thu Mar 06 2025 Brian Read 11.0.0-63.sme - Add boot.svg image to Bug Report panel [SME: 12953] - Move report template to inside smanager tree - Add one-off systemd task to create boot.svg run from panel --- .../lib/systemd/system/bootsequence.service | 9 +++++ .../lib/SrvMngr/Controller/Bugreport.pm | 14 ++++++- .../default/public/configuration_report.tmpl | 38 +++++++++++++++++++ .../default/templates/bugreport2.html.ep | 13 +++++-- smeserver-manager.spec | 7 +++- 5 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 root/usr/lib/systemd/system/bootsequence.service create mode 100644 root/usr/share/smanager/themes/default/public/configuration_report.tmpl diff --git a/root/usr/lib/systemd/system/bootsequence.service b/root/usr/lib/systemd/system/bootsequence.service new file mode 100644 index 0000000..0a1fb81 --- /dev/null +++ b/root/usr/lib/systemd/system/bootsequence.service @@ -0,0 +1,9 @@ +[Unit] +Description=Koozali SME Server boot diagnostic tool +After=sme-server.target +PartOf=sme-server.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "/usr/bin/systemd-analyze plot > /usr/share/smanager/themes/default/public/images/boot.svg" +RemainAfterExit=yes diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm index e3c8609..45a8893 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm @@ -78,7 +78,7 @@ sub create_configuration_report { # create the reporting template my $configreport_template = Text::Template->new( TYPE => 'FILE', - SOURCE => '/etc/e-smith/web/common/configuration_report.tmpl', + SOURCE => '/usr/share/smanager/themes/default/public/configuration_report.tmpl', UNTAINT => 1 ); my $report_creation_time = gen_locale_date_string; @@ -114,11 +114,23 @@ sub create_configuration_report { # prcess template my $result = $configreport_template->fill_in(HASH => \%vars); + + #take out any multiple blank lines + #$result =~ s/\n{3,}/\n/g; + # write processed template to file open(my $cfgrep, '>', $configreportfile) or die "Could not create temporary file for config report!"; print $cfgrep $result; close $cfgrep; + + #And create boot analysis image - now run externally by systemd, only run once per boot. + $result = `/usr/bin/systemctl start bootsequence.service`; + if (!$? == 0) { + warn "/usr/bin/systemd-analyze plot Command failed \n"; + } + + } ## end sub create_configuration_report sub show_config_report { diff --git a/root/usr/share/smanager/themes/default/public/configuration_report.tmpl b/root/usr/share/smanager/themes/default/public/configuration_report.tmpl new file mode 100644 index 0000000..0884f6b --- /dev/null +++ b/root/usr/share/smanager/themes/default/public/configuration_report.tmpl @@ -0,0 +1,38 @@ +Configuration report created {$report_creation_time} + +================== +Base configuration +================== +SME server version: {$releaseversion} +SME server mode: {$systemmode} +SME server previous mode: {$previoussystemmode } +Running Kernel: {$curkernel} +=========================== +New RPMs not in base system +=========================== +{ foreach $i (@newrpms) { + $OUT .= "$i"; + } +} +=========================== +Custom and modified templates +=========================== +{ foreach $i (@templates) { + $OUT .= "$i"; + } +} +=========================== +Modified events +=========================== +{ foreach $i (@events) { + $OUT .= "$i"; + } +} +======================= +Additional repositories +======================= +{ foreach $r (@repositories) { + $OUT .= "$r"; + } +} +DONE! \ No newline at end of file diff --git a/root/usr/share/smanager/themes/default/templates/bugreport2.html.ep b/root/usr/share/smanager/themes/default/templates/bugreport2.html.ep index 98c9eec..00285e5 100644 --- a/root/usr/share/smanager/themes/default/templates/bugreport2.html.ep +++ b/root/usr/share/smanager/themes/default/templates/bugreport2.html.ep @@ -18,9 +18,16 @@ <% my $btn = l('bugr_Download this report'); %> %= form_for 'bugreportD' => (method => 'POST') => begin - %= submit_button "$btn", class => 'action' - %= hidden_field 'trt' => $bugr_datas->{trt} - % end + %= submit_button "$btn", class => 'action' + %= hidden_field 'trt' => $bugr_datas->{trt} + % end + + % my $out = "==================
"; + % $out .= "Boot anaysis image (right click and save image to download)
"; + % $out .= "==================
"; + % $out .= "boot timing image"; + +
<%= $c->render_to_string(inline=>$out) %>
diff --git a/smeserver-manager.spec b/smeserver-manager.spec index fc6442c..75142e5 100644 --- a/smeserver-manager.spec +++ b/smeserver-manager.spec @@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2 %define name smeserver-manager Name: %{name} %define version 11.0.0 -%define release 62 +%define release 63 Version: %{version} Release: %{release}%{?dist} License: GPL @@ -143,6 +143,11 @@ true %defattr(-,root,root) %changelog +* Thu Mar 06 2025 Brian Read 11.0.0-63.sme +- Add boot.svg image to Bug Report panel [SME: 12953] +- Move report template to inside smanager tree +- Add one-off systemd task to create boot.svg run from panel + * Tue Mar 04 2025 Brian Read 11.0.0-62.sme - Update *_en.lex files to conform to standard english punctuation [SME: 11809]