3 # Copyright (C) 2007-2008 Ksplice, Inc.
4 # Authors: Jeff Arnold, Anders Kaseorg, Tim Abbott
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License, version 2.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 use lib
'KSPLICE_DATA_DIR';
24 my ($kid, $mid, $module, $update, $file);
25 GetOptions
(@common_options,
27 "file=s" => \
$file) or pod2usage
(1);
29 pod2usage
(1) if($help || scalar(@ARGV) != 0);
30 my $actions = (defined $kid) + (defined $file);
31 pod2usage
(1) if($actions > 1);
33 view_kid
() if(defined $kid);
34 view_file
() if(defined $file);
35 view_list
() if($actions == 0);
40 $kid =~ s/^ksplice[_-]//;
41 $kid =~ s/[-_].*$//; # In case we got an mid instead
42 $update = "ksplice_$kid";
43 if(!update_loaded
($kid)) {
44 print "Ksplice id $kid is not present in the kernel\n";
47 my $stage = get_stage
($kid);
48 print "Ksplice id $kid is present in the kernel and is $stage.\n\n";
49 my $source_diff = get_patch
($kid);
50 return if($source_diff eq "");
51 print "Here is the source code patch associated with this update:\n";
56 my $tmpdir = tempdir
('ksplice-tmp-XXXXXX', TMPDIR
=> 1, CLEANUP
=> 1);
57 copy
($file, "$tmpdir/" . basename
($file));
59 my $ksplice = unpack_update
($file);
60 open(PATCH
, '<', "$ksplice/patch") or die $!;
68 if ($Verbose::level
< 0) {
71 my $desc = get_short_description
($kid);
75 print "$kid: no description available\n";
81 foreach(split(/\n/, runstr
("lsmod"))) {
82 next unless my ($mid) = m/^ksplice_(\S*)\s/;
83 $module = "ksplice_$mid";
84 ($kid = $mid) =~ s/[-_].*$//;
85 next unless (-e
"/sys/module/$module/ksplice/stage");
86 open STAGE
, '<', "/sys/module/$module/ksplice/stage" or next;
87 show_kid
($kid) if(<STAGE
> eq "applied\n");
90 if (-e
"/sys/kernel/ksplice") {
91 chdir("/sys/kernel/ksplice");
92 foreach $update (glob("*")) {
93 ($kid = $update) =~ s/^ksplice_//;
94 show_kid
($kid) if(get_stage
($kid) eq "applied");
101 ksplice-view - View in-kernel or on-disk Ksplice kernel updates
105 B<ksplice-view> [B<--id=>I<KSPLICE_ID> | B<--file=>I<UPDATE_TARBALL>]
109 When called with no arguments, B<ksplice-view> lists the identification tags of
110 all of the Ksplice updates that are currently present in the running kernel.
112 B<ksplice-view> can report about a specific Ksplice update when given the
113 update's identification tag (if the update is in the kernel) or given the
114 update's tarball filename I<UPDATE_TARBALL> (if the update is on disk).
118 L<ksplice-create(8)>, L<ksplice-apply(8)>, L<ksplice-undo(8)>
122 Please report bugs to <PACKAGE_BUGREPORT>.
126 Jeff Arnold, Anders Kaseorg, and Tim Abbott
130 Copyright (C) 2007-2008 Ksplice, Inc.
132 This is free software and documentation. You can redistribute and/or modify it
133 under the terms of the GNU General Public License, version 2.