Revert "remove tsol from xorg-server"
[unleashed-userland.git] / components / system-tools-backends / patches / system-tools-backends-03-disks.patch
blobef0468a8524fb932ee52799e5b321c2a94867d76
1 diff -ru /var/tmp/clean/system-tools-backends-1.4.2/disks-conf.in system-tools-backends-1.4.2/disks-conf.in
2 --- /var/tmp/clean/system-tools-backends-1.4.2/disks-conf.in 2005-11-21 01:14:51.000000000 +0000
3 +++ system-tools-backends-1.4.2/disks-conf.in 2006-03-13 10:14:56.140947000 +0000
4 @@ -66,7 +66,7 @@
5 @platforms = ("redhat-5.2", "redhat-6.0", "redhat-6.1", "redhat-6.2", "redhat-7.0",
6 "redhat-7.1", "mandrake-7.2", "debian-2.2", "debian-woody", "debian-sarge",
7 "debian-3.1", "suse-7.0", "suse-9.1", "suse-1.0", "unitedlinux-1.0",
8 - "turbolinux-7.0", "rpath");
9 + "turbolinux-7.0", "nexenta-1.0", "solaris-2.11");
11 $description =<<"end_of_description;";
12 Configures locally mounted partitioned media.
13 @@ -83,7 +83,11 @@
14 # Right now there's only one entry per array, as I couldn't find any
15 # typical deviations.
17 -@fstab_names = ( "/etc/fstab" );
18 +if ($$tool{"system"} eq "SunOS") {
19 + @fstab_names = ( "/etc/vfstab" );
20 +} else {
21 + @fstab_names = ( "/etc/fstab" );
25 # --- Internal configuration variables --- #
26 @@ -698,7 +702,7 @@
30 -sub scan_ide_bus
31 +sub scan_ide_bus_linux
33 my $device = shift;
35 @@ -733,7 +737,145 @@
36 closedir (DIR);
39 -sub scan_scsi_bus
40 +# wait_for(handle, regexp, regexp, ...)
41 +# Read from the input stream until one of the regexps matches..
42 +sub wait_for
44 + local ($c, $i, $sw, $rv, $ha); undef($wait_for_input);
45 + $ha = $_[0];
46 + $codes =
47 + "local \$hit;\n".
48 + "while(1) {\n".
49 + " if ((\$c = getc(\$ha)) eq \"\") { return -1; }\n".
50 + " \$wait_for_input .= \$c;\n";
51 + for($i=1; $i<@_; $i++) {
52 + $sw = $i>1 ? "elsif" : "if";
53 + $codes .= " $sw (\$wait_for_input =~ /$_[$i]/i) { \$hit = $i-1; }\n";
54 + }
55 + $codes .=
56 + " if (defined(\$hit)) {\n".
57 + " \@matches = (-1, \$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9);\n".
58 + " return \$hit;\n".
59 + " }\n".
60 + " }\n";
61 + $rv = eval $codes;
62 + if ($@) {
63 + print STDERR $codes,"\n";
64 + &error("wait_for error : $@\n");
65 + }
66 + return $rv;
69 +# text(message, [substitute]+)
70 +sub text
72 + local $rv = $text{$_[0]};
73 + local $i;
74 + for($i=1; $i<@_; $i++) {
75 + $rv =~ s/\$$i/$_[$i]/g;
76 + }
77 + return $rv;
80 +# list_disks()
81 +# Returns a list of structures, one per disk
82 +sub list_disks_sunos
84 + local(@rv);
85 + local $temp = "/tmp/stb-format.tmp";
86 + open(TEMP, ">$temp");
87 + print TEMP "disk\n";
88 + close(TEMP);
89 + open(FORMAT, "format -f $temp |");
90 + while(1) {
91 + local $rv = &wait_for(FORMAT, 'Specify', '\s+\d+\. (\S+) <(.*) cyl (\d+) alt (\d+) hd (\d+) sec (\d+)>\s*(\S*)', '\s+\d+\. (\S+) <drive type unknown>', 'space for more');
92 + if ($rv == 0) { last; }
93 + elsif ($rv == 1) {
94 + local $disk = { 'device' => "/dev/dsk/$matches[1]",
95 + 'type' => $matches[2] eq 'DEFAULT' ?
96 + undef : $matches[2],
97 + 'cyl' => $matches[3],
98 + 'alt' => $matches[4],
99 + 'hd' => $matches[5],
100 + 'sec' => $matches[6],
101 + 'volume' => $matches[7] };
102 + if ($matches[1] =~ /c(\d+)t(\d+)d(\d+)$/) {
103 + $disk->{'desc'} = &text('select_device',
104 + "$1", "$2", "$3");
106 + elsif ($matches[1] =~ /c(\d+)d(\d+)$/) {
107 + $disk->{'desc'} = &text('select_idedevice',
108 + chr($1*2 + $2 + 65));
110 + push(@rv, $disk);
113 + close(FORMAT);
114 + unlink($temp);
115 + return @rv;
118 +# list_partitions(device)
119 +# Returns a list of structures, one per partition
120 +sub list_partitions_sunos
122 + local(@rv, $secs, $i);
123 + local @tag = ("unassigned", "boot", "root", "swap", "usr", "backup", "stand", "var", "home", "alternates", "cache");
124 + open(VTOC, "prtvtoc $_[0]s0 |");
125 + while(<VTOC>) {
126 + if (/(\d+)\s+sectors\/cylinder/) {
127 + $secs = $1;
129 + if (/^\s+(\d+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) {
130 + local $n = $1;
131 + local $part = { 'tag' => $tag[$2],
132 + 'flag' => $3 eq "00" ? "wm" :
133 + $3 eq "01" ? "wu" :
134 + $3 eq "10" ? "rm" : "ru",
135 + 'start' => int($4 / $secs),
136 + 'end' => int($6 / $secs),
137 + 'device' => $_[0]."s$n" };
138 + $rv[$n] = $part;
141 + close(VTOC);
142 + for($i=0; $i<8 || $i<@rv; $i++) {
143 + $rv[$i] = { 'tag' => 'unassigned',
144 + 'flag' => 'wm',
145 + 'device' => $_[0]."s$i" } if (!$rv[$i]);
146 + if ($_[0] =~ /c(\d+)t(\d+)d(\d+)$/) {
147 + $rv[$i]->{'desc'} = &text('select_part',
148 + "$1", "$2", "$3", $i);
150 + elsif ($_[0] =~ /c(\d+)d(\d+)$/) {
151 + $rv[$i]->{'desc'} = &text('select_idepart',
152 + chr($1*2 + $2 + 65), $i);
155 + return @rv;
158 +sub scan_any_bus_sunos
160 + my $device = shift;
161 +# foreach $disk (&list_disks_sunos()) {
162 +# &update_disk_data ($part->{'device'}, "media", $part->{'desc'});
163 +# foreach $part (&list_partitions_sunos($disk->{'device'})) {
164 +# &update_disk_data ($part->{'device'}, "media", 'disk');
165 +# if ($scsi[$i]->{'device'}) { &update_disk_data ($scsi[$i]->{'device'}, "model", "$vendor $model");}
166 +# }
167 +# }
170 +sub scan_ide_bus
172 + my $device = shift;
174 + &scan_ide_bus_linux($device) if ($$tool{"system"} eq "Linux");
175 + &scan_ide_bus_sunos($device) if ($$tool{"system"} eq "SunOS");
178 +sub scan_scsi_bus_linux
180 my $device = shift;
182 @@ -833,7 +975,20 @@
183 close (PROC_SCSI_FILE);
186 -sub scan_floppy
187 +sub scan_scsi_bus_sunos
189 + my $device = shift;
192 +sub scan_scsi_bus
194 + my $device = shift;
196 + &scan_scsi_bus_linux($device) if ($$tool{"system"} eq "Linux");
197 + &scan_scsi_bus_sunos($device) if ($$tool{"system"} eq "SunOS");
200 +sub scan_floppy_linux
202 #FIXME: I don't like it
203 $floppy = `grep fd /proc/devices | wc -l`;
204 @@ -849,6 +1004,16 @@
208 +sub scan_floppy_sunos
212 +sub scan_floppy
214 + &scan_floppy_linux($device) if ($$tool{"system"} eq "Linux");
215 + &scan_floppy_sunos($device) if ($$tool{"system"} eq "SunOS");
218 sub get_fs_type
220 my ($device) = @_;