File: mkmnttab

package info (click to toggle)
ibcs 981105-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,800 kB
  • ctags: 4,031
  • sloc: ansic: 27,707; makefile: 471; sh: 199; perl: 18; pascal: 2
file content (26 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl
#
# Create a SCO-compatible /etc/mnttab out of a Linux /etc/mtab.
# Baba Z Buehler <baba@beckman.uiuc.edu>

$mnttab_struct = "a32 a32 I L";

open(MTAB, "/etc/mtab") || die "Cannot open /etc/mtab: $!\n";
open(MNTTAB, ">/etc/mnttab") || die "Cannot open /etc/mnttab: $!\n";

while(<MTAB>) {
    chop;
    /^(\S*)\s(\S*)\s(\S*)\s.*$/;
    $device = $1;
    $mountpt = $2;
    $fstype = $3;
    if($fstype ne "nfs" && $fstype ne "proc") {
        $mnttab_rec = 
            pack($mnttab_struct, $device, $mountpt, 0x9d2f, time());
        syswrite(MNTTAB, $mnttab_rec, 72);
        print "Made entry for: $device $mountpt $fstype\n";
    }
}

close(MNTTAB);
exit 0;