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 HP-UX system.
11 if ( $uname ne "HP-UX" ) {
12 print "Sorry, this script only works for HP-UX systems!\n";
16 # Check whether the user is root.
19 if ( $id ne "root" ) {
20 print "Sorry, this script needs to be run by the superuser!\n";
24 # Determine all volume groups and the logical volumes in these volume groups.
25 print "\n\nScanning volume groups...\n";
26 open(LV, "vgdisplay -v 2>/dev/null |") or
27 die "$0: unable to open vgdisplay pipe: $!\n";
29 if ( m!^(VG Name\s+/dev/)(.*)! ) {
32 print "The volume group $v contains the following logical volumes:\n";
34 elsif ( m!(\s+LV Name\s+/dev/$v/)(.*)! ) {
40 warn "$0: error in closing vgdisplay pipe: $!\n";
42 # Now fix the device entries for all logical volumes.
43 print "\n\nFixing device entries...\n";
44 foreach $v ( keys(%vg) ) {
45 foreach $w ( split(/[\s]+/, $vg{$v} ) ) {
46 # First the link for the block device.
47 if ( ! -e "/dev/dsk/${v}_$w" ) {
48 print "Creating link for /dev/dsk/${v}_$w...";
49 if ( ! symlink("/dev/$v/$w", "/dev/dsk/${v}_$w") ) {
56 # Now the link for the raw devive.
57 if ( ! -e "/dev/rdsk/${v}_$w" ) {
58 print "Creating link for /dev/rdsk/${v}_$w...";
59 if ( ! symlink("/dev/$v/r$w", "/dev/rdsk/${v}_$w") ) {