2 eval '(exit $?0)' && eval 'exec perl -x -S $0 ${1+"$@"}'
3 & eval 'exec perl -x -S $0 $argv:q'
8 # Check whether we're on a SINIX system.
11 if ( $uname !~ /SINIX/ ) {
12 die("Sorry, this script only works for SINIX systems!\n");
15 # Check whether the user is root.
18 if ( $id ne "root" ) {
19 die("Sorry, this script needs to be run by the superuser!\n");
22 # Determine all filesystems currently mounted.
23 print "\nDetermining all filesystems currently mounted...\n";
24 open(VD, "/usr/bin/mount -p 2>/dev/null |") or
25 die("$0: unable to open mount pipe: $!\n");
27 if ( m!^(/dev/\S*)\s+-\s+(\S+)\s+(vxfs|ufs)\s+! ) {
29 print "Found filesystem $v\n";
34 warn "$0: error in closing mount pipe: $!\n";
36 # Determine all virtual disks.
38 print "\nDetermining all virtual disks...\n";
39 open(VD, "/sbin/dkconfig -lA 2>/dev/null |") or
40 die("$0: unable to open dkconfig pipe: $!\n");
42 if ( m!^(/dev/\S*):\s+\d+\s+blocks! ) {
44 print "Found virtual disk $v\n";
49 warn "$0: error in closing dkconfig pipe: $!\n";
51 # Check whether our target directories are present.
52 foreach $d ( "/dev/dsk", "/dev/rdsk" ) {
54 if ( ! mkdir($d, 0755) ) {
55 die("Failed to create directory $d!\n");
60 # Now fix the device entries for all virtual disks.
61 print "\nFixing device entries...\n";
62 foreach $v ( keys(%vd) ) {
63 # determine the basename of the device
64 ( $name ) = $v =~ m!^/dev/(.+)$!;
65 if ( $name =~ m!/! ) {
66 ( $p, $dev_orig ) = $name =~ m!(.*/)(.*)!;
73 # replace all slashes with _'s
77 # First the link for the block device.
78 if ( ! -e "/dev/dsk/$dev_new" ) {
79 print "Creating link for /dev/dsk/$dev_new...";
80 if ( ! symlink($v, "/dev/dsk/$dev_new") ) {
87 # Now the link for the raw devive.
88 if ( ! -e "/dev/rdsk/$dev_new" ) {
89 print "Creating link for /dev/rdsk/$dev_new...";
90 if ( ! symlink("/dev/${p}r$dev_orig", "/dev/rdsk/$dev_new") ) {