3 # Copyright (C) 2007-2009 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 chdir(unpack_update
($file));
57 open(PATCH
, '<', "patch") or die $!;
65 if ($Verbose::level
< 0) {
68 my $desc = get_short_description
($kid);
72 print "$kid: no description available\n";
78 foreach(split(/\n/, runstr
("lsmod"))) {
79 next unless my ($mid) = m/^ksplice_(\S*)\s/;
80 $module = "ksplice_$mid";
81 ($kid = $mid) =~ s/[-_].*$//;
82 next unless (-e
"/sys/module/$module/ksplice/stage");
83 open STAGE
, '<', "/sys/module/$module/ksplice/stage" or die
84 "Unable to read stage file; are you root?";
85 show_kid
($kid) if(<STAGE
> eq "applied\n");
88 if (-e
"/sys/kernel/ksplice") {
89 chdir("/sys/kernel/ksplice");
90 foreach $update (glob("*")) {
91 ($kid = $update) =~ s/^ksplice_//;
92 show_kid
($kid) if(get_stage
($kid) eq "applied");
99 ksplice-view - View in-kernel or on-disk Ksplice kernel updates
105 B<ksplice-view> B<--id=>I<KSPLICE_ID>
107 B<ksplice-view> B<--file=>{I<UPDATE_TARBALL> | I<UPDATE_TREE>}
111 When called with no arguments, B<ksplice-view> lists the identification tags of
112 all of the Ksplice updates that are currently present in the running kernel,
113 along with their descriptions.
115 B<ksplice-view> can report about a specific Ksplice update when given the
116 update's identification tag I<KSPLICE_ID> (if the update is in the kernel) or
117 given the update's tarball filename I<UPDATE_TARBALL> or unpacked tree root
118 I<UPDATE_TREE> (if the update is on disk).
124 =item B<--id=>I<KSPLICE_ID>
126 Report information about the Ksplice update I<KSPLICE_ID> currently loaded in
129 =item B<--file=>{I<UPDATE_TARBALL> | I<UPDATE_TREE>}
131 Report information about the Ksplice update on disk as the tarball
132 I<UPDATE_TARBALL> or unpacked as the tree I<UPDATE_TREE>.
136 Output only the update IDs, one per line, omitting descriptions.
142 L<ksplice-create(8)>, L<ksplice-apply(8)>, L<ksplice-undo(8)>
146 Please report bugs to <PACKAGE_BUGREPORT>.
150 Jeff Arnold, Anders Kaseorg, and Tim Abbott
154 Copyright (C) 2007-2009 Ksplice, Inc.
156 This is free software and documentation. You can redistribute and/or modify it
157 under the terms of the GNU General Public License, version 2.