summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakfont
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/drakfont')
-rwxr-xr-xperl-install/standalone/drakfont2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
index d244f2d1b..7871a94bf 100755
--- a/perl-install/standalone/drakfont
+++ b/perl-install/standalone/drakfont
@@ -530,7 +530,7 @@ sub help() {
$license =~ s/\n/\n\n/sg; # nicer formatting
my $w = gtknew('AboutDialog', name => N("Drakfont"),
version => mandrake_release_info()->{version},
- copyright => N("Copyright (C) 2001-2008 by Mandriva"),
+ copyright => N("Copyright (C) %s by Mandriva", '2001-2008'),
license => $license, wrap_license => 1,
comments => N("Font installer."),
website => 'http://mandrivalinux.com',
4 135 136 137 138 139 140 141
package devices; # $Id$

use diagnostics;
use strict;

use common qw(:system :file);
use run_program;
use log;
use c;

1;


sub size($) {
    local *F;
    sysopen F, $_[0], 0 or log::l("open $_[0]: $!"), return 0;

    my $valid_offset = sub { sysseek(F, $_[0], 0) && sysread(F, my $a, 1) };

    #- first try getting the size nicely
    my $size = 0;
    ioctl(F, c::BLKGETSIZE(), $size) and return unpack("i", $size) * $common::SECTORSIZE;

    #- sad it didn't work, well searching the size using the dichotomy algorithm!
    my $low = 0;
    my ($high, $mid);

    #- first find n where 2^n < size <= 2^n+1
    for ($high = 1; $high > 0 && &$valid_offset($high); $high *= 2) { $low = $high; }

    while ($low < $high - 1) {
	$mid = int ($low + $high) / 2;
	&$valid_offset($mid) ? $low : $high = $mid;
    }
    $low + 1;
}

sub set_loop {
    my ($file) = @_;

    foreach (0..7) {
	local *F;
	my $dev = make("loop$_");
	sysopen F, $dev, 2 or next;
	!ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO
	log::l("trying with loop $dev");
	return c::set_loop(fileno F, $file) && $dev;
    }
}

sub entry {
    my ($type, $major, $minor);
    local ($_) = @_;

    if (/^sd(.)(\d{0,2})/) {
	$type = c::S_IFBLK();
	$major = 8;
	$minor = 16 * (ord($1) - ord('a')) + ($2 || 0);
    } elsif (/^hd(.)(\d{0,2})/) {
	$type = c::S_IFBLK();
	($major, $minor) =
	    @{ $ {{'a' => [3, 0], 'b' => [3, 64],
		   'c' => [22,0], 'd' => [22,64],
		   'e' => [33,0], 'f' => [33,64],
		   'g' => [34,0], 'h' => [34,64],
	       }}{$1} or die "unknown device $_" };
	$minor += $2 || 0;
    } elsif (/^ram(.*)/) {
	$type = c::S_IFBLK();
	$major = 1;
	$minor = $1 eq '' ? 1 : $1;
    } elsif (m|^rd/c(\d+)d(\d+)(p(\d+))?|) {
	# dac 960 "rd/cXdXXpX"
        $type = c::S_IFBLK();
	$major = 48 + $1;
	$minor = 8 * $2 + $4;
    } elsif (m|ida/c(\d+)d(\d+)(p(\d+))?|) {
	# Compaq Smart Array "ida/c0d0{p1}"
	$type = c::S_IFBLK();
	$major = 72 + $1;
	$minor = 16 * $2 + ($4 || 0);
    } elsif (/(.*)(\d+)$/) {
	    ($type, $major, $minor) =
	     @{ ${{"fd"     => [ c::S_IFBLK(), 2,  0 ],
		   "hidbp-mse-" => [ c::S_IFCHR(), 10, 32 ],
		   "lp"     => [ c::S_IFCHR(), 6,  0 ],
		   "usb/lp" => [ c::S_IFCHR(), 180, 0 ],
		   "loop"   => [ c::S_IFBLK(), 7,  0 ],
		   "md"     => [ c::S_IFBLK(), 9,  0 ],
		   "nst"    => [ c::S_IFCHR(), 9, 128],
		   "scd"    => [ c::S_IFBLK(), 11, 0 ],