3 # Copyright (C) 2008 Jeffrey Brian Arnold <jbarnold@mit.edu>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License, version 2.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
19 use Cwd
'abs_path', 'getcwd';
24 use Fatal
qw(:void copy rename move chdir mkdir unlink rmtree);
28 use lib
'KSPLICE_DATA_DIR';
30 use verbose
qw(copy rename move chdir mkdir mkpath unlink rmtree mktemp mkdtemp);
33 my ($help, $wantversion) = (0, 0);
34 GetOptions
("help|?" => \
$help,
35 "version" => \
$wantversion,
36 "verbose|v!" => \
$verbose::level
,
38 "file=s" => \
$file) or pod2usage
(1);
44 pod2usage
(1) if($help || scalar(@ARGV) != 0);
45 my $actions = (defined $kid) + (defined $file);
46 pod2usage
(1) if($actions > 1);
48 view_kid
() if(defined $kid);
49 view_file
() if(defined $file);
50 view_list
() if($actions == 0);
55 $kid =~ s/^ksplice[_-]//;
57 if(! -d
"/sys/module") {
58 print "/sys not mounted?\n";
61 if(! -d
"/sys/module/ksplice_$kid/ksplice") {
62 print "Ksplice id $kid is not present in the kernel\n";
65 open STAGE
, '<', "/sys/module/ksplice_$kid/ksplice/stage" or die $!;
69 print "Ksplice id $kid is present in the kernel and is $stage.\n";
73 $file = abs_path
($file);
75 my $tmpdir = init_tmpdir
();
78 my $ksplice = unpack_update
($file);
79 print runstr
("cat $ksplice/patch");
86 foreach $kid (glob("ksplice_*")) {
87 $kid =~ s/^ksplice_//;
88 open STAGE
, '<', "/sys/module/ksplice_$kid/ksplice/stage" or next;
89 print "$kid\n" if(<STAGE
> eq "applied\n");
96 ksplice-view - View in-kernel or on-disk Ksplice kernel updates
100 B<ksplice-view> [B<--id=>I<KSPLICE_ID> | B<--file=>I<UPDATE_TARBALL>]
104 When called with no arguments, B<ksplice-view> lists the identification tags of
105 all of the Ksplice updates that are currently present in the running kernel.
107 B<ksplice-view> can report about a specific Ksplice update when given the
108 update's identification tag (if the update is in the kernel) or given the
109 update's tarball filename I<UPDATE_TARBALL> (if the update is on disk).
113 L<ksplice-create(8)>, L<ksplice-apply(8)>, L<ksplice-undo(8)>
117 Copyright (C) 2008 Jeffrey Brian Arnold <jbarnold@mit.edu>.
119 This is free software and documentation. You can redistribute and/or modify it
120 under the terms of the GNU General Public License, version 2.