aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/images/no_avatar.gif
blob: ad73330e713ec9a21f97366b326a8c66afe5e9bb (plain)
ofshex dumpascii
0000 47 49 46 38 39 61 64 00 64 00 d5 00 00 c3 cc d4 e1 e6 e9 da e0 e4 d0 d7 dd fe fe fe e6 ea ed f0 GIF89ad.d.......................
0020 f2 f4 fa fb fc c5 ce d5 dc e1 e6 f1 f3 f5 e4 e8 ec c3 cd d4 f6 f7 f8 e9 ed ef d1 d8 de c7 d0 d7 ................................
0040 e5 e9 ed f4 f6 f7 db e1 e5 e1 e5 e9 e5 e9 ec ee f1 f3 f5 f7 f8 d4 db e0 cf d7 dd f6 f8 f9 d8 de ................................
0060 e3 e0 e5 e8 c1 ca d2 d6 dc e1 ed f0 f2 c8 d1 d7 ce d5 dc f8 f9 fa f3 f5 f7 d7 dd e2 fd fd fe c9 ................................
0080 d1 d8 dd e2 e6 e3 e7 eb f5 f6 f8 fb fb fc fc fc fd c5 ce d6 d3 da e0 ef f1 f4 ee f0 f3 fc fc fc ................................
00a0 d9 df e3 fa fb fb bf c9 d1 ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 21 f9 04 00 00 00 00 00 2c 00 00 00 00 64 00 64 00 00 06 .............!.......,....d.d...
00e0 ff c0 99 70 48 2c 1a 8f c8 a4 72 c9 6c 3a 9f d0 a8 74 4a ad 5a af d8 ac 76 cb ed 7a bf e0 b0 78 ...pH,....r.l:...tJ.Z...v..z...x
0100 4c 2e 9b cf e8 b4 fa 0c 18 4c 22 96 cb 81 40 38 5c 2c 91 c9 00 b0 36 03 30 15 12 34 83 84 85 85 L........L"...@8\,....6.0..4....
0120 12 15 18 7c 7d 5f 10 09 06 86 91 92 83 06 09 10 8c 5b 00 02 0a 93 9d 92 0a 02 8b 98 55 03 0e 9e ...|}_...........[..........U...
0140 a7 92 0e 03 a3 54 02 0d a8 b0 86 0d 02 ac 50 0c 01 04 b1 ba 84 04 01 0c b5 4c 08 0b bb c4 84 0b .....T........P..........L......
0160 08 c0 49 0c c3 c5 cd 0b bf c9 46 01 cd d4 34 01 d1 45 02 b9 d5 c5 04 b4 d8 33 03 af dc cd 0d ab ..I.......F...4..E.......3......
0180 d1 00 a6 e4 d4 0e a2 b5 02 eb dc df b5 10 9c f1 d4 0a 97 b5 09 f7 dc 09 b5 00 20 f5 a3 66 c0 5d .............................f.]
01a0 1f 0c 03 b9 61 60 55 21 61 b5 0a a3 00 08 72 d8 4c 82 c1 34 03 28 56 3b d7 67 82 46 6a 13 30 45 ....a`U!a.....r.L..4.(V;.g.Fj.0E
01c0 f8 d8 2c 02 26 0b 24 8b 59 c0 74 21 25 b1 0b 98 0e b8 dc 75 00 d3 b6 99 b0 08 d8 c4 19 4b 27 23 ..,.&.$.Y.t!%......u.........K'#
01e0 ff 99 3c 51 d5 64 d4 32 e8 29 98 8c 50 1a f5 b4 92 d1 c8 a5 9d 4c 32 f2 08 75 52 48 46 19 ab 4a ..<Q.d.2.)..P........L2..uRHF..J
0200 e2 b8 46 a2 56 43 16 47 35 fc 4a 08 e2 28 84 64 07 2d 8c 28 f0 6b c1 7d 69 ff d1 b3 57 35 5f 32 ..F.VC.G5.J..(.d.-.(.k.}i...W5_2
0220 78 5a e7 01 54 b7 b4 1d 36 71 4b cd 81 9b a1 2d a8 b7 c1 42 a6 f1 bc 86 78 c6 32 9c cf 1a 0b 11 xZ..T...6qK....-...B....x.2.....
0240 e6 f2 98 e4 21 b7 6e 26 ec 05 ed f2 10 57 0e 67 79 3e 52 6a a0 aa d1 48 34 d1 ad 06 ea 22 6a 22 ....!.n&.....W.gy>Rj...H4...."j"
0260 8e da 12 ab a4 ef 35 12 16 2d 02 b8 80 51 0c 86 8b 00 2d 58 d8 2e 82 c0 43 01 0d f7 34 14 f0 80 ......5..-...Q....-X....C...4...
0280 ec 75 88 00 23 34 8e 08 10 c2 f3 83 02 40 49 1e 28 f0 00 71 86 02 2b 82 ae 28 90 21 9a 09 0a 22 .u..#4.......@I.(..q..+..(.!..."
02a0 aa 8a a0 60 a2 16 09 d9 55 0d 90 c0 04 02 45 89 b4 83 4a a0 00 b1 e6 c1 07 fc 86 7c d0 1d 1a 1b ...`....U.....E...J........|....
02c0 a4 00 60 24 29 6c 70 c6 09 2a 1c 28 89 0a 27 90 d1 01 07 0e 7a c2 41 07 61 74 40 41 85 a7 50 80 ..`$)lp..*.(..'.....z.A.at@A..P.
02e0 bf e1 17 14 72 78 0a 07 5f 9c 20 22 2c 11 72 b1 41 83 27 9e a2 82 82 5a 3c 60 60 8b a8 a4 30 e0 ....rx.._..",.r.A.'....Z<``...0.
0300 15 20 fc 47 23 2c 1f f0 77 05 0a 3b ea 82 c2 15 24 dc 17 24 2c 25 cc 47 85 09 f0 1d e9 89 01 ed ...G#,..w..;....$..$,%.G........
0320 4d b1 a1 93 ba 50 30 45 06 e9 51 19 8b 08 e5 45 51 80 96 bb 14 10 c5 03 e1 81 19 cb 0a 37 36 f1 M....P0E..Q....EQ............76.
0340 a5 99 ba 88 e9 44 08 d9 b1 29 54 75 4d 28 26 67 2c 8c 2d 81 40 74 77 c6 32 42 73 4a 78 d0 e7 2e .....D...)TuM(&g,.-.@tw.2BsJx...
0360 1e 30 b1 e6 a0 b0 b8 99 04 0b c8 21 0a 8b 06 c2 25 d1 82 a3 ba b4 a0 84 9d 94 9e 92 e7 11 2f 64 .0.........!....%............./d
0380 0a cb 0b 49 20 20 83 a7 a8 c8 00 68 11 19 90 0a 4b 97 46 c4 a0 2a 2a 31 20 81 e9 ab 92 6c 1a 04 ...I.......h....K.F..**1.....l..
03a0 00 3b .;
'#n104'>104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
package fs; # $Id$

use diagnostics;
use strict;

use MDK::Common::System;
use MDK::Common::Various;
use common;
use log;
use devices;
use fs::type;
use fs::get;
use fs::format;
use fs::mount_options;
use run_program;
use detect_devices;
use modules;
use fsedit;
use loopback;


sub read_fstab {
    my ($prefix, $file, @reading_options) = @_;

    if (member('keep_default', @reading_options)) {
	push @reading_options, 'freq_passno', 'keep_devfs_name', 'keep_device_LABEL';
    }

    my %comments;
    my $comment;
    my @l = grep {
	if (/^Filename\s*Type\s*Size/) {
	    0; #- when reading /proc/swaps
	} elsif (/^\s*#/) {
	    $comment .= chomp_($_) . "\n";
	    0;
	} else {
	    $comments{$_} = $comment if $comment;
	    $comment = '';
	    1;
	}
    } cat_("$prefix$file");

    #- attach comments at the end of fstab to the previous line
    $comments{$l[-1]} = $comment if $comment;

    map {
	my ($dev, $mntpoint, $fs_type, $options, $freq, $passno) = split;
	my $comment = $comments{$_};

	$options = 'defaults' if $options eq 'rw'; # clean-up for mtab read

	if ($fs_type eq 'supermount') {
	    # normalize this bloody supermount
	    $options = join(",", 'supermount', grep {
		if (/fs=(.*)/) {
		    $fs_type = $1;
		    0;
		} elsif (/dev=(.*)/) {
		    $dev = $1;
		    0;
		} elsif ($_ eq '--') {
		    0;
		} else {
		    1;
		}
	    } split(',', $options));
	} elsif ($fs_type eq 'smb') {
	    # prefering type "smbfs" over "smb"
	    $fs_type = 'smbfs';
	}
	s/\\040/ /g foreach $mntpoint, $dev, $options;

	my $h = { 
		 mntpoint => $mntpoint, fs_type => $fs_type,
		 options => $options, comment => $comment,
		 if_(member('keep_freq_passno', @reading_options), freq => $freq, passno => $passno),
		};

	put_in_hash($h, subpart_from_wild_device_name($dev));

	if ($h->{device_LABEL} && member('keep_device_LABEL', @reading_options)) {
	    $h->{prefer_device_LABEL} = 1;
        } elsif ($h->{devfs_device} && member('keep_devfs_name', @reading_options)) {
	    $h->{prefer_devfs_name} = 1;
	}

	if ($h->{options} =~ /credentials=/ && !member('verbatim_credentials', @reading_options)) {
	    require network::smb;
	    #- remove credentials=file with username=foo,password=bar,domain=zoo
	    #- the other way is done in fstab_to_string
	    my ($options, $unknown) = fs::mount_options::unpack($h);
	    my $file = delete $options->{'credentials='};
	    my $credentials = network::smb::read_credentials_raw($file);
	    if ($credentials->{username}) {
		$options->{"$_="} = $credentials->{$_} foreach qw(username password domain);
		fs::mount_options::pack($h, $options, $unknown);
	    }
	}

	$h;
    } @l;
}

sub merge_fstabs {
    my ($loose, $fstab, @l) = @_;

    foreach my $p (@$fstab) {
	my ($l1, $l2) = partition { fsedit::is_same_hd($_, $p) } @l;
	my ($p2) = @$l1 or next;
	@l = @$l2;

	$p->{mntpoint} = $p2->{mntpoint} if delete $p->{unsafeMntpoint};

	$p->{fs_type} = $p2->{fs_type} if $p2->{fs_type} && !$loose;
	$p->{options} = $p2->{options} if $p2->{options} && !$loose;
	#- important to get isMounted property else DrakX may try to mount already mounted partitions :-(
	add2hash($p, $p2);
	$p->{device_alias} ||= $p2->{device_alias} || $p2->{device} if $p->{device} ne $p2->{device} && $p2->{device} !~ m|/|;

	$p->{fs_type} && $p2->{fs_type} && $p->{fs_type} ne $p2->{fs_type}
	  && $p->{fs_type} ne 'auto' && $p2->{fs_type} ne 'auto' and
	    log::l("err, fstab and partition table do not agree for $p->{device} type: $p->{fs_type} vs $p2->{fs_type}");
    }
    @l;
}

sub analyze_wild_device_name {
    my ($dev) = @_;

    if ($dev =~ m!^/u?dev/(.*)!) {
	'dev', $dev;
    } elsif ($dev !~ m!^/! && (-e "/dev/$dev" || -e "$::prefix/dev/$dev")) {
	'dev', "/dev/$dev";
    } elsif ($dev =~ /^LABEL=(.*)/) {
	'label', $1;
    } elsif ($dev eq 'none' || $dev eq 'rootfs') {
	'virtual';
    } elsif ($dev =~ m!^(\S+):/\w!) {
	'nfs';
    } elsif ($dev =~ m!^//\w!) {
	'smb';
    } elsif ($dev =~ m!^http://!) {
	'dav';
    }
}

sub subpart_from_wild_device_name {
    my ($dev) = @_;

    my $part = { device => $dev, faked_device => 1 }; #- default

    if (my ($kind, $val) = analyze_wild_device_name($dev)) {
	if ($kind eq 'label') {	    
	    $part->{device_LABEL} = $val;
	} elsif ($kind eq 'dev') {
	    my %part = (faked_device => 0);
	    if (my $rdev = (stat "$::prefix$dev")[6]) {
		($part{major}, $part{minor}) = unmakedev($rdev);
	    }

	    my $symlink = readlink("$::prefix$dev");
	    $dev =~ s!/u?dev/!!;

	    if ($symlink && $symlink =~ m|^[^/]+$|) {
		$part{device_alias} = $dev;
		$dev = $symlink;
	    }

	    if (my (undef, $part_number) = $dev =~ m!/(disc|part(\d+))$!) {
		$part{part_number} = $part_number if $part_number;
		$part{devfs_device} = $dev;
	    } else {
		my $part_number = devices::part_number(\%part);
		$part{part_number} = $part_number if $part_number;
	    }
	    $part{device} = $dev;
	    return \%part;
	}
    } else {
	if ($dev =~ m!^/! && -f "$::prefix$dev") {
	    #- it must be a loopback file or directory to bind
	} else {
	    log::l("part_from_wild_device_name: unknown device $dev");
	}
    }
    $part;
}

sub part2wild_device_name {
    my ($prefix, $part) = @_;

    if ($part->{prefer_device_LABEL}) {
	'LABEL=' . $part->{device_LABEL};
    } elsif ($part->{prefer_devfs_name}) {
	"/dev/$part->{devfs_device}";
    } elsif ($part->{device_alias}) {
	"/dev/$part->{device_alias}";
    } else {
	my $faked_device = exists $part->{faked_device} ? 
	    $part->{faked_device} : 
	    do {
		#- in case $part has been created without using subpart_from_wild_device_name()
		my ($kind) = analyze_wild_device_name($part->{device});
		$kind ? $kind ne 'dev' : $part->{device} =~ m!^/!;
	    };
	if ($faked_device) {
	    $part->{device};
	} elsif ($part->{device} =~ m!^/dev/!) {
	    log::l("ERROR: i have a full device $part->{device}, this should not happen. use subpart_from_wild_device_name() instead of creating bad part data-structures!");
	    $part->{device};
	} else {
	    my $dev = "/dev/$part->{device}";
	    eval { devices::make("$prefix$dev") };
	    $dev;
	}
    }
}

sub add2all_hds {
    my ($all_hds, @l) = @_;

    @l = merge_fstabs('', [ fs::get::really_all_fstab($all_hds) ], @l);

    foreach (@l) {
	my $s = 
	    $_->{fs_type} eq 'nfs' ? 'nfss' :
	    $_->{fs_type} eq 'smbfs' ? 'smbs' :
	    $_->{fs_type} eq 'davfs' ? 'davs' :
	    isTrueLocalFS($_) || isSwap($_) || isOtherAvailableFS($_) ? '' :
	    'special';
	push @{$all_hds->{$s}}, $_ if $s;
    }
}

sub get_major_minor {
    eval {
	my (undef, $major, $minor) = devices::entry($_->{device});
	($_->{major}, $_->{minor}) = ($major, $minor);
    } foreach @_;
}

sub merge_info_from_mtab {
    my ($fstab) = @_;

    my @l1 = map { my $l = $_; 
		   my $h = fs::type::fs_type2subpart('swap');
		   $h->{$_} = $l->{$_} foreach qw(device major minor); 
		   $h;
	       } read_fstab('', '/proc/swaps');
    
    my @l2 = map { read_fstab('', $_) } '/etc/mtab', '/proc/mounts';

    foreach (@l1, @l2) {
	log::l("found mounted partition on $_->{device} with $_->{mntpoint}");
	if ($::isInstall && $_->{mntpoint} =~ m!/tmp/(image|hdimage)!) {
	    $_->{real_mntpoint} = delete $_->{mntpoint};
	    if ($_->{real_mntpoint} eq '/tmp/hdimage') {
		log::l("found hdimage on $_->{device}");
		$_->{mntpoint} = "/mnt/hd"; #- remap for hd install.
	    }
	}
	$_->{isMounted} = 1;
	set_isFormatted($_, 1);
	delete $_->{options};
    } 
    merge_fstabs('loose', $fstab, @l1, @l2);
}

# - when using "$loose", it does not merge in type&options from the fstab
sub merge_info_from_fstab {
    my ($fstab, $prefix, $uniq, $loose) = @_;

    my @l = grep { 
	if ($uniq) {
	    my $part = fs::get::mntpoint2part($_->{mntpoint}, $fstab);
	    !$part || fsedit::is_same_hd($part, $_); #- keep it only if it is the mountpoint AND the same device
	} else {
	    1;
	}
    } read_fstab($prefix, '/etc/fstab', 'keep_default');

    merge_fstabs($loose, $fstab, @l);
}

sub get_info_from_fstab {
    my ($all_hds) = @_;
    my @l = read_fstab($::prefix, '/etc/fstab', 'keep_default');
    add2all_hds($all_hds, @l);
}

sub prepare_write_fstab {
    my ($fstab, $o_prefix, $b_keep_smb_credentials) = @_;
    $o_prefix ||= '';

    my %new;
    my @smb_credentials;
    my @l = map { 
	my $device = 
	  isLoopback($_) ? 
	      ($_->{mntpoint} eq '/' ? "/initrd/loopfs" : $_->{loopback_device}{mntpoint}) . $_->{loopback_file} :
	  part2wild_device_name($o_prefix, $_);

	my $real_mntpoint = $_->{mntpoint} || ${{ '/tmp/hdimage' => '/mnt/hd' }}{$_->{real_mntpoint}};
	mkdir_p("$o_prefix$real_mntpoint") if $real_mntpoint =~ m|^/|;
	my $mntpoint = loopback::carryRootLoopback($_) ? '/initrd/loopfs' : $real_mntpoint;

	my ($freq, $passno) =
	  exists $_->{freq} ?
	    ($_->{freq}, $_->{passno}) :
	  isTrueLocalFS($_) && $_->{options} !~ /encryption=/ && (!$_->{is_removable} || member($_->{mntpoint}, fs::type::directories_needed_to_boot())) ? 
	    (1, $_->{mntpoint} eq '/' ? 1 : loopback::carryRootLoopback($_) ? 0 : 2) : 
	    (0, 0);

	if (($device eq 'none' || !$new{$device}) && ($mntpoint eq 'swap' || !$new{$mntpoint})) {
	    #- keep in mind the new line for fstab.
	    $new{$device} = 1;
	    $new{$mntpoint} = 1;

	    my $options = $_->{options};

	    if ($_->{fs_type} eq 'smbfs' && $options =~ /password=/ && !$b_keep_smb_credentials) {
		require network::smb;
		if (my ($opts, $smb_credentials) = network::smb::fstab_entry_to_credentials($_)) {
		    $options = $opts;
		    push @smb_credentials, $smb_credentials;
		}
	    }

	    my $fs_type = $_->{fs_type} || 'auto';

	    s/ /\\040/g foreach $mntpoint, $device, $options;

	    # handle bloody supermount special case
	    if ($options =~ /supermount/) {
		my @l = grep { $_ ne 'supermount' } split(',', $options);
		my ($l1, $l2) = partition { member($_, 'ro', 'exec') } @l;
		$options = join(",", "dev=$device", "fs=$fs_type", @$l1, if_(@$l2, '--', @$l2));
		($device, $fs_type) = ('none', 'supermount');
	    } else {
		#- if we were using supermount, the type could be something like ext2:vfat
		#- but this can not be done without supermount, so switching to "auto"
		$fs_type = 'auto' if $fs_type =~ /:/;
	    }

	    my $file_dep = $options =~ /\b(loop|bind)\b/ ? $device : '';

	    [ $file_dep, $mntpoint, $_->{comment} . join(' ', $device, $mntpoint, $fs_type, $options || 'defaults', $freq, $passno) . "\n" ];
	} else {
	    ();
	}