… | |
… | |
12 | |
12 | |
13 | my $device = undef; |
13 | my $device = undef; |
14 | my $image = undef; |
14 | my $image = undef; |
15 | my $offset = undef; |
15 | my $offset = undef; |
16 | my $size = undef; |
16 | my $size = undef; |
|
|
17 | my $mount = undef; |
17 | my $verbose = 0; |
18 | my $verbose = 0; |
18 | |
19 | |
19 | GetOptions ( |
20 | GetOptions ( |
20 | "device|d=s" => \$device, |
21 | "device|d=s" => \$device, |
21 | "image|i=s" => \$image, |
22 | "image|i=s" => \$image, |
22 | "offset|o=i" => \$offset, |
23 | "offset|o=i" => \$offset, |
23 | "size|s=i" => \$size, |
24 | "size|s=i" => \$size, |
24 | "verbose|v" => \$verbose, |
25 | "verbose|v" => \$verbose, |
|
|
26 | "mount|m=s" => \$mount, |
25 | "help|h|?" => sub { |
27 | "help|h|?" => sub { |
26 | require Pod::Usage; |
28 | require Pod::Usage; |
27 | Pod::Usage::pod2usage(-exitstatus => 0, verbose => 2); |
29 | Pod::Usage::pod2usage(-exitstatus => 0, verbose => 2); |
28 | }, |
30 | }, |
29 | ) or exit 1; |
31 | ) or exit 1; |
… | |
… | |
74 | $client->socket($a); |
76 | $client->socket($a); |
75 | $client->run_async; |
77 | $client->run_async; |
76 | |
78 | |
77 | $device = $client->device; |
79 | $device = $client->device; |
78 | |
80 | |
|
|
81 | if (defined $mount) { |
|
|
82 | print "Running mount (you have to unmount yourself)\n"; |
|
|
83 | exec "mount", "-tiso9660", "-oro", $device, $mount |
|
|
84 | if fork == 0; |
|
|
85 | print "Everything set up, starting server\n"; |
|
|
86 | } else { |
79 | print <<EOF; |
87 | print <<EOF; |
80 | |
88 | |
81 | Everything seems to be set up now, try something like: |
89 | Everything seems to be set up now, try something like: |
82 | |
90 | |
83 | mount -tiso9660 $device /mnt |
91 | mount -tiso9660 $device /mnt |
84 | |
92 | |
85 | Press ^C to exit... |
93 | Press ^C to exit... |
86 | EOF |
94 | EOF |
|
|
95 | } |
87 | |
96 | |
88 | # now create a server instance and handle |
97 | # now create a server instance and handle |
89 | # the requests. |
98 | # the requests. |
90 | |
99 | |
91 | my $server = Server->new(socket => $b); |
100 | my $server = Server->new(socket => $b); |
92 | $server->run; |
101 | $server->run; |
|
|
102 | # never returns |
93 | } |
103 | } |
94 | |
104 | |
95 | BEGIN { |
105 | BEGIN { |
96 | @Server::ISA = Linux::NBD::Server::; |
106 | @Server::ISA = Linux::NBD::Server::; |
97 | }; |
107 | }; |
… | |
… | |
131 | |
141 | |
132 | attach-bincue - attach a .bin (cdrom image) containing an iso9660 fs to nbd |
142 | attach-bincue - attach a .bin (cdrom image) containing an iso9660 fs to nbd |
133 | |
143 | |
134 | =head1 SYNOPSIS |
144 | =head1 SYNOPSIS |
135 | |
145 | |
136 | attach-bincue -i iso9660.bin & # start server |
146 | attach-bincue -i iso9660.bin -m /mnt & # start server |
137 | mount -tiso9660 /dev/ndx /mnt |
|
|
138 | |
147 | |
139 | # kill server |
148 | # kill server |
140 | umount /mnt |
149 | umount /mnt |
141 | attach-bincue -d /dev/ndx # disconnect server |
150 | attach-bincue -d /dev/ndx # disconnect server |
142 | |
151 | |
… | |
… | |
173 | |
182 | |
174 | =item --verbose |
183 | =item --verbose |
175 | |
184 | |
176 | Increase verbosity. With this switch, read requests will be logged to stdout. |
185 | Increase verbosity. With this switch, read requests will be logged to stdout. |
177 | |
186 | |
|
|
187 | =item --mount path |
|
|
188 | |
|
|
189 | Try to mount the CD as iso image on the given path. |
|
|
190 | |
178 | =back |
191 | =back |
179 | |
192 | |
180 | =head1 EXAMPLES |
193 | =head1 EXAMPLES |
181 | |
194 | |
182 | Common combinations of offset and blocksize |
195 | Common combinations of offset and blocksize |