summaryrefslogtreecommitdiffstats
path: root/make_boot_img
diff options
context:
space:
mode:
authorMatthias Badaire <mbadaire@mandriva.com>2001-07-04 19:35:54 +0000
committerMatthias Badaire <mbadaire@mandriva.com>2001-07-04 19:35:54 +0000
commitff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223 (patch)
tree806cf012cb7d9a654eb837ebf796386f8173596f /make_boot_img
parent49179d897c48c131d8e43d1e6da3ef013907f567 (diff)
downloaddrakx-ff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223.tar
drakx-ff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223.tar.gz
drakx-ff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223.tar.bz2
drakx-ff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223.tar.xz
drakx-ff19b12f08a9a15cdbf8cf9363ccb1d64d9d8223.zip
Ia64 Adaptation
Diffstat (limited to 'make_boot_img')
-rwxr-xr-xmake_boot_img28
1 files changed, 27 insertions, 1 deletions
diff --git a/make_boot_img b/make_boot_img
index 6afa19df9..ca226f309 100755
--- a/make_boot_img
+++ b/make_boot_img
@@ -72,7 +72,7 @@ sub initrd {
my $tar = "$instdir/stage1-data/stage1.tar.bz2";
__ "$sudo umount $tmp $mnt 2>/dev/null";
- _ "dd if=/dev/zero of=$tmp bs=1k count=" . ($type eq "all" ? 4000 : 2000);
+ _ "dd if=/dev/zero of=$tmp bs=1k count=" . ($arch =~ /ia64/ ? ($type eq "all" ? 12000 : 12000) : ($type eq "all" ? 4000 : 2000));
_ "$mke2fs $tmp";
_ "$sudo mount -t ext2 $tmp $mnt -o loop";
@@ -214,6 +214,32 @@ sub boot_img_alpha {
_ "df $mnt";
}
+sub boot_img_ia64 {
+ my ($mnt, $img, $kernel) = @_;
+
+ __ "$sudo umount $mnt 2>/dev/null";
+ _ "dd if=/dev/zero of=$img bs=1k count=12000";
+ _ "mkdosfs $img";
+ _ "$sudo mount -t vfat $img $mnt -o loop,umask=000";
+ _ "$sudo cp -f $kernel $mnt/vmlinux";
+ _ "cp -f images/$type.rdz $mnt/$type.rdz";
+ _ "$sudo cp -f tools/ia64/elilo.efi $mnt";
+ output("$mnt/elilo.conf", "
+prompt
+timeout=50
+
+image=vmlinux
+ label=linux
+ root=/dev/ram3
+ initrd=$type.rdz
+ append=\"ramdisk_size=120000\"
+ read-only
+");
+ _ "sync";
+ _ "df $mnt";
+
+}
+
sub boot_img_sparc {
my ($mnt, $img) = @_;
if ($type =~ /^live(.*)/) {
id='n198' href='#n198'>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
package network::network; # $Id$wir

#-######################################################################################
#- misc imports
#-######################################################################################

use strict;

use Socket;
use common;
use detect_devices;
use run_program;
use network::tools;
use vars qw(@ISA @EXPORT);
use log;

my $network_file = "/etc/sysconfig/network";
my $resolv_file = "/etc/resolv.conf";
my $tmdns_file = "/etc/tmdns.conf";


@ISA = qw(Exporter);
@EXPORT = qw(addDefaultRoute dns dnsServers gateway guessHostname is_ip is_ip_forbidden masked_ip netmask resolv sethostname);

#- $net hash structure
#-   autodetect
#-   type
#-   net_interface
#-   PROFILE: selected netprofile
#-   network (/etc/sysconfig/network) : NETWORKING FORWARD_IPV4 NETWORKING_IPV6 HOSTNAME GATEWAY GATEWAYDEV NISDOMAIN
#-     NETWORKING : networking flag : string : "yes" by default
#-     FORWARD_IPV4 : forward IP flag : string : "false" by default
#-     HOSTNAME : hostname : string : "localhost.localdomain" by default
#-     GATEWAY : gateway
#-     GATEWAYDEV : gateway interface
#-     NISDOMAIN : nis domain
#-     NETWORKING_IPV6 : use IPv6, "yes" or "no"
#-     IPV6_DEFAULTDEV
#-   resolv (/etc/resolv.conf): dnsServer, dnsServer2, dnsServer3, DOMAINNAME, DOMAINNAME2, DOMAINNAME3
#-     dnsServer : dns server 1
#-     dnsServer2 : dns server 2
#-     dnsServer3 : dns server 3 : note that we uses the dns1 for the LAN, and the 2 others for the internet conx
#-     DOMAINNAME : domainname : string : $net->{network}{HOSTNAME} =~ /\.(.*)/ by default
#-     DOMAINNAME2 : well it's another domainname : have to look further why we used 2
#-   adsl: bus, Encapsulation, vpi, vci provider_id, method, login, passwd, ethernet_device, capi_card
#-   cable: bpalogin, login, passwd
#-   zeroconf: hostname
#-   auth: LDAPDOMAIN WINDOMAIN
#-   ifcfg (/etc/sysconfig/network-scripts/ifcfg-*):
#-     key : device name
#-     value : hash containing ifcfg file values, see write_interface_conf() for an exhaustive list
#-       DHCP_HOSTNAME : If you have a dhcp and want to set the hostname
#-       IPADDR : IP address
#-       NETMASK : netmask
#-       DEVICE : device name
#-       BOOTPROTO : boot prototype : "bootp" or "dhcp" or "pump" or ...
#-       IPV6INIT
#-       IPV6TO4INIT
#-       MS_DNS1
#-       MS_DNS2
#-       DOMAIN

sub read_conf {
    my ($file) = @_;
    +{ getVarsFromSh($file) };
}

sub read_resolv_conf_raw {
    my ($o_file) = @_;
    my $s = cat_($o_file || $::prefix . $resolv_file);
    { nameserver => [ $s =~ /^\s*nameserver\s+(\S+)/mg ],
      search => [ if_($s =~ /^\s*search\s+(.*)/m, split(' ', $1)) ] };
}

sub read_resolv_conf {
    my ($o_file) = @_;
    my $resolv_conf = read_resolv_conf_raw($o_file);
    +{
      (mapn { $_[0] => $_[1] } [ qw(dnsServer dnsServer2 dnsServer3) ], $resolv_conf->{nameserver}),
      (mapn { $_[0] => $_[1] } [ qw(DOMAINNAME DOMAINNAME2 DOMAINNAME3) ], $resolv_conf->{search}),
     };
}

sub read_interface_conf {
    my ($file) = @_;
    my %intf = getVarsFromSh($file);

    $intf{BOOTPROTO} ||= 'static';
    $intf{isPtp} = $intf{NETWORK} eq '255.255.255.255';
    $intf{isUp} = 1;
    \%intf;
}

sub read_zeroconf() {
    cat_($::prefix . $tmdns_file) =~ /^\s*hostname\s*=\s*(\w+)/m && { ZEROCONF_HOSTNAME => $1 };
}

sub write_network_conf {
    my ($net) = @_;

    if ($net->{network}{HOSTNAME} && $net->{network}{HOSTNAME} =~ /\.(.+)$/) {
	$net->{resolv}{DOMAINNAME} = $1;
    }
    $net->{network}{NETWORKING} = 'yes';

    setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6 IPV6_DEFAULTDEV));
}

sub write_zeroconf {
    my ($net, $in) = @_;
    my $zhostname = $net->{zeroconf}{hostname};
    my $file = $::prefix . $tmdns_file;

    if ($zhostname) {
	$in->do_pkgs->ensure_binary_is_installed('tmdns', 'tmdns', 'auto') if !$in->do_pkgs->is_installed('bind');
	$in->do_pkgs->ensure_binary_is_installed('zcip', 'zcip', 'auto');
    }

    #- write blank hostname even if disabled so that drakconnect does not assume zeroconf is enabled
    eval { substInFile { s/^\s*(hostname)\s*=.*/$1 = $zhostname/ } $file } if $zhostname || -f $file;

    require services;
    services::set_status('tmdns', $net->{zeroconf}{hostname});
}

sub write_resolv_conf {
    my ($net) = @_;
    my $resolv = $net->{resolv};
    my $file = $::prefix . $resolv_file;

    my %new = (
        search => [ grep { $_ } uniq(@$resolv{'DOMAINNAME', 'DOMAINNAME2', 'DOMAINNAME3'}) ],
        nameserver => [ grep { $_ } uniq(@$resolv{'dnsServer', 'dnsServer2', 'dnsServer3'}) ],
    );

    my (%prev, @unknown);
    foreach (cat_($file)) {
	s/\s+$//;
	s/^[#\s]*//;

	if (my ($key, $val) = /^(search|nameserver)\s+(.*)$/) {
	    push @{$prev{$key}}, $val;
	} elsif (/^ppp temp entry$/) {
	} elsif (/\S/) {
	    push @unknown, $_;
	}
    }
    unlink $file if -l $file;  #- workaround situation when /etc/resolv.conf is an absolute link to /etc/ppp/resolv.conf or whatever

    if (@{$new{search}} || @{$new{nameserver}}) {
	$prev{$_} = [ difference2($prev{$_} || [], $new{$_}) ] foreach keys %new;

	my @search = do {
	    my @new = if_(@{$new{search}}, "search " . join(' ', @{$new{search}}) . "\n");
	    my @old = if_(@{$prev{search}}, "# search " . join(' ', @{$prev{search}}) . "\n");
	    @new, @old;
	};
	my @nameserver = do {
	    my @new = map { "nameserver $_\n" } @{$new{nameserver}};
	    my @old = map { "# nameserver $_\n" } @{$prev{nameserver}};
	    @new, @old;
	};
	output_with_perm($file, 0644, @search, @nameserver, (map { "# $_\n" } @unknown), "\n# ppp temp entry\n");

	#-res_init();		# reinit the resolver so DNS changes take affect
	1;
    } else {
	log::explanations("neither domain name nor dns server are configured");
	0;
    }
}

sub update_broadcast_and_network {
    my ($intf) = @_;
    my @ip = split '\.', $intf->{IPADDR};
    my @mask = split '\.', $intf->{NETMASK};
    $intf->{BROADCAST} = join('.', mapn { int($_[0]) | ((~int($_[1])) & 255) } \@ip, \@mask);