1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-yum-1.2.0/root/etc/e-smith/web/functions/yum mezzanine_patched_smeserver-yum-1.2.0/root/etc/e-smith/web/functions/yum |
2 |
--- smeserver-yum-1.2.0/root/etc/e-smith/web/functions/yum 2006-11-21 13:34:25.756517569 +1100 |
3 |
+++ mezzanine_patched_smeserver-yum-1.2.0/root/etc/e-smith/web/functions/yum 2006-11-21 13:18:11.621185791 +1100 |
4 |
@@ -36,7 +36,7 @@ |
5 |
|
6 |
if (-e "/var/run/yum.pid") |
7 |
{ |
8 |
- print_yum_status_page(); |
9 |
+ $f->print_yum_status_page(); |
10 |
exit(0); |
11 |
} |
12 |
|
13 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-yum-1.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/yum.pm mezzanine_patched_smeserver-yum-1.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/yum.pm |
14 |
--- smeserver-yum-1.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/yum.pm 2006-11-21 13:34:25.757517394 +1100 |
15 |
+++ mezzanine_patched_smeserver-yum-1.2.0/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/yum.pm 2006-11-21 13:30:42.103471925 +1100 |
16 |
@@ -222,7 +222,7 @@ |
17 |
|
18 |
$db->reload; |
19 |
|
20 |
- print_yum_status_page(); |
21 |
+ $fm->print_yum_status_page(); |
22 |
} |
23 |
|
24 |
sub print_skip_header |
25 |
@@ -230,24 +230,33 @@ |
26 |
return "<INPUT TYPE=\"hidden\" NAME=\"skip_header\" VALUE=\"1\">\n"; |
27 |
} |
28 |
|
29 |
+sub format_yum_log |
30 |
+{ |
31 |
+ my ($fm) = @_; |
32 |
+ |
33 |
+ my $yum_log = $db->get_prop('yum', 'LogFile'); |
34 |
+ |
35 |
+ return '' unless $yum_log and -f $yum_log; |
36 |
+ |
37 |
+ my @contents; |
38 |
+ |
39 |
+ open my $log_file, "<", $yum_log or die "Couldn't open $yum_log\n"; |
40 |
+ push @contents, "<PRE>", <$log_file>, "</PRE>"; |
41 |
+ close $log_file or die "Failed to close $yum_log\n"; |
42 |
+ |
43 |
+ return @contents; |
44 |
+} |
45 |
+ |
46 |
sub print_yum_status_page |
47 |
{ |
48 |
+ my ($fm) = @_; |
49 |
my @yum_status; |
50 |
|
51 |
open(YUM_STATUS, "</var/run/yum.status"); |
52 |
@yum_status = <YUM_STATUS>; |
53 |
close(YUM_STATUS); |
54 |
|
55 |
- my $yum_log = $db->get_prop('yum', 'LogFile'); |
56 |
- my @yum_log; |
57 |
- |
58 |
- if ($yum_log) |
59 |
- { |
60 |
- open(YUM_LOG, "<", "$yum_log"); |
61 |
- |
62 |
- @yum_log = <YUM_LOG>; |
63 |
- close YUM_LOG |
64 |
- } |
65 |
+ my @yum_log = $fm->format_yum_log(); |
66 |
|
67 |
my $page_output = << "EOF"; |
68 |
Expires: 0 |
69 |
@@ -265,9 +274,7 @@ |
70 |
</HEAD> |
71 |
<BODY TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"> |
72 |
<BR><center><H2>Please Wait - Yum Running (@yum_status)</H2></center> |
73 |
- <PRE> |
74 |
@yum_log |
75 |
- </PRE> |
76 |
</BODY> |
77 |
</HTML> |
78 |
EOF |
79 |
@@ -339,16 +346,9 @@ |
80 |
{ |
81 |
my $fm = shift; |
82 |
|
83 |
- my $yum_log = $db->get_prop('yum', 'LogFile'); |
84 |
- |
85 |
- return unless $yum_log and -f $yum_log; |
86 |
- |
87 |
- open my $log_file, "<", $yum_log or die "Couldn't open $yum_log\n"; |
88 |
- print "<PRE>"; |
89 |
- print <$log_file>; |
90 |
- print "</PRE>"; |
91 |
- close $log_file or die "Failed to close $yum_log\n"; |
92 |
+ print $fm->format_yum_log(); |
93 |
|
94 |
+ my $yum_log = $db->get_prop_and_delete('yum', 'LogFile'); |
95 |
return; |
96 |
} |
97 |
|
98 |
@@ -356,7 +356,6 @@ |
99 |
{ |
100 |
my $fm = shift; |
101 |
|
102 |
- $db->get_prop_and_delete("yum", "LogFile"); |
103 |
$fm->success('HEADER_POSTUPGRADE_REQUIRED', 'YUM_PAGE_POSTUPGRADE'); |
104 |
|
105 |
$fm->{cgi}->param(-name => "page", -value => 0); |