commit
[crak.git] / src / ins
bloba919d30a7d50775d4c1f09b79def0e0a53d44507
1 #!/usr/bin/perl
3 # this applet is to load the clock device driver and create
4 # the corresponding /dev/clock file.
6 use strict;
8 my $device = "ckpt";
9 my $devfile = "/dev/ckpt";
10 my $listfile = "/proc/devices";
11 my $major = -1;
13 system "/sbin/insmod ckpt.ko";
15 # get the major number from /dev/clock
16 open LIST, $listfile or die "can't open $listfile!\n";
18 my $line;
20 while ($line = <LIST>) {
21 chomp $line;
22 my $dev = substr($line, 4);
23 if ($dev eq $device) { # is it "ckpt"?
24 $major = substr($line, 0, 3);
25 $major =~ s/ //g;
26 last;
30 close LIST;
32 # not found?
33 die "loading failed..please check your code\n" if ($major == -1);
35 if (-e $devfile) {
36 print STDERR "$devfile exists\n"; # dev file already exists
38 else {
39 # print "mknod $devfile c $major 0\n";
40 system "mknod $devfile c $major 0";
41 system "chmod 666 $devfile";
42 print "ckpt loaded\n";