summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/.perl_checker10
-rw-r--r--tools/Makefile7
-rwxr-xr-xtools/draklive1034
-rwxr-xr-xtools/drakx-in-chroot135
-rwxr-xr-xtools/find-drivers-needing-nonfree-firmware94
-rwxr-xr-xtools/gencryptofiles115
-rwxr-xr-xtools/hd_grub.cgi6
-rwxr-xr-xtools/i386/busyboxbin55508 -> 0 bytes
-rwxr-xr-xtools/ia64/elilo.efibin315800 -> 0 bytes
-rwxr-xr-xtools/install-xml-file-list36
-rwxr-xr-xtools/mdkinst_stage2_tool18
-rw-r--r--tools/ppc/README52
-rwxr-xr-xtools/ppc/convert5
-rwxr-xr-xtools/ppc/magic89
-rwxr-xr-xtools/ppc/mapping36
-rw-r--r--tools/serial_probe/serial.c13
-rwxr-xr-xtools/x86_64/busyboxbin74064 -> 0 bytes
17 files changed, 242 insertions, 1408 deletions
diff --git a/tools/.perl_checker b/tools/.perl_checker
deleted file mode 100644
index 8dc1d2d7d..000000000
--- a/tools/.perl_checker
+++ /dev/null
@@ -1,10 +0,0 @@
-AutoLoader
-Carp::Heavy
-constant
-Cwd
-Digest::base
-Encode
-File::Path
-Gtk2::Gdk::Keysyms
-IO::Handle
-Pod::Usage \ No newline at end of file
diff --git a/tools/Makefile b/tools/Makefile
index 669b6f987..40194245d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,7 +1,8 @@
DIRS = serial_probe
-CFLAGS = -Wall
+LDFLAGS = $(shell pkg-config libtirpc --libs)
+CFLAGS = -Wall $(shell pkg-config libtirpc --cflags)
-ARCH := $(shell arch | egrep "(x86_64|sparc64|s390x)")
+ARCH := $(shell arch | grep -E "x86_64")
ifneq ("x$(ARCH)", "x")
LIB_NAME = lib64
else
@@ -10,7 +11,7 @@ endif
.PHONY: clean install $(DIRS)
-all: $(DIRS) xhost+ rpcinfo-flushed
+all: $(DIRS) rpcinfo-flushed
$(DIRS):
make -C $@
diff --git a/tools/draklive b/tools/draklive
deleted file mode 100755
index 52ae3634b..000000000
--- a/tools/draklive
+++ /dev/null
@@ -1,1034 +0,0 @@
-#!/usr/bin/perl
-
-# draklive $Id$
-
-# Copyright (C) 2005 Mandriva
-# Olivier Blin <oblin@mandriva.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-use lib qw(/usr/lib/libDrakX);
-use MDK::Common;
-use common;
-use list_modules;
-use modules;
-use detect_devices;
-use run_program;
-use POSIX qw(strftime);
-use Cwd 'abs_path';
-use Getopt::Long;
-use Pod::Usage;
-
-my $dir_distrib_sqfs = {
- mountpoint => '/distrib',
- type => 'squashfs',
- source => 'distrib.sqfs',
- build_from => '/',
-};
-my $dir_memory = {
- mountpoint => '/memory',
- type => 'tmpfs',
-};
-
-# this is not unused (it can be used from config file):
-my %predefined = (
- mounts => {
- simple_union => {
- root => '/union',
- overlay => 'unionfs',
- dirs => [
- $dir_memory,
- { mountpoint => '/media' },
- ],
- },
- squash_union => {
- root => '/union',
- overlay => 'unionfs',
- dirs => [
- {
- mountpoint => '/system',
- type => 'loopfs',
- pre_allocate => '100k',
- source => 'system.loop'
- },
- $dir_distrib_sqfs,
- ],
- },
- volatile_squash_union => {
- root => '/union',
- overlay => 'unionfs',
- dirs => [
- $dir_memory,
- $dir_distrib_sqfs,
- ],
- },
- multi_squash_union => {
- root => '/union',
- overlay => 'unionfs',
- dirs => [
- $dir_memory,
- {
- mountpoint => '/system',
- type => 'squashfs',
- source => 'system.sqfs'
- },
- $dir_distrib_sqfs,
- ],
- },
- },
-);
-
-# this is not unused (it can be used from config file):
-my %custom = (
- media => {
- nfs => sub {
- my ($module, $client, $source) = @_;
- {
- extra_modules => [ $module ],
- fs => 'nfs',
- pre => "ifconfig eth0 $client up",
- source => $source,
- };
- },
- },
-);
-
-my %storage = (
- cdrom => {
- modules => 'bus/usb disk/cdrom|hardware_raid|ide|raw|sata|scsi|usb',
- fs => 'iso9660',
- source => 'LABEL=MDVCDROOT',
- read_only => 1,
- detect => \&detect_devices::burners,
- create => \&create_cdrom_master,
- format => \&format_cdrom_device,
- record => \&record_cdrom_master,
- },
- usb => {
- modules => 'bus/usb disk/raw|usb',
- fs => 'vfat',
- source => 'LABEL=MDVUSBROOT',
- detect => sub { grep { detect_devices::isKeyUsb($_) } detect_devices::get() },
- create => undef,
- format => \&format_usb_device,
- record => \&record_usb_master,
- },
-);
-
-sub nls_modules {
- my ($live) = @_;
- if_(get_media_setting($live->{media}, 'fs') eq 'vfat', 'nls_cp437'), #- default FAT codepage
- map { "nls_$_" } (map { "iso8859-$_" } 1..7, 9, 13..15), 'utf8';
-}
-
-sub progress_start {
- my ($total, $time, $o_exp_divide) = @_;
- {
- total => $total,
- current => 0,
- start_time => $time,
- exp_divide => $o_exp_divide,
- maxl => length($total) - $o_exp_divide,
- };
-}
-
-sub progress_show_incr {
- my ($progress, $incr, $time) = @_;
- $progress->{current} += $incr;
- my $elapsed_time = $time - $progress->{start_time};
- my $eta = int($elapsed_time*$progress->{total}/$progress->{current});
- printf("\r%3d%% (%$progress->{maxl}s/%-$progress->{maxl}s), %8s/%8s (ETA)",
- int(100*$progress->{current}/$progress->{total}),
- (map { substr($_, 0, length($_)-$progress->{exp_divide}) } $progress->{current}, $progress->{total}),
- (map { POSIX::strftime("%H:%M:%S", gmtime($_)) } $elapsed_time, $eta));
-}
-
-sub progress_end() { print "\n" }
-
-my $loop_number = 0;
-my %loop = (
- squashfs => {
- read_only => 1,
- modules => [ qw(loop squashfs) ],
- build => sub {
- my ($dest, $root) = @_;
- my $total = first(split /\s/, `du -sb $root`);
- print "have to process " . int($total/1000000) . " MB\n";
- my $progress = progress_start($total, time(), 6);
- open(my $OUTPUT, '-|', 'mksquashfs', $root, $dest, '-info');
- {
- local $_; #- avoid outside $_ to be overwritten
- while (<$OUTPUT>) {
- if (/^mksquashfs: file .*, uncompressed size (\d+) bytes, (?:DUPLICATE)?$/) {
- progress_show_incr($progress, $1, time());
- }
- }
- }
- progress_end();
- },
- mount => sub {
- my ($live, $dir) = @_;
- my @mnt = (
- "/bin/losetup -r /dev/loop$loop_number $live->{prefix}{live_mnt}$live->{prefix}{media_mnt}$live->{prefix}{loopbacks}/$dir->{source}",
- "mount -o ro -t squashfs /dev/loop$loop_number $live->{prefix}{live_mnt}$dir->{mountpoint}");
- $loop_number++;
- @mnt;
- },
- },
- loopfs => {
- modules => [],
- create => sub {
- my ($dest, $size) = @_;
- run_('dd', "of=$dest", 'count=0', "seek=$size", 'bs=1k');
- run_('mke2fs', '-F', $dest);
- },
- mount => sub {
- my ($live, $dir) = @_;
- my @mnt = (
- "losetup /dev/loop$loop_number $live->{prefix}{live_mnt}$live->{prefix}{media_mnt}$live->{prefix}{loopbacks}/$dir->{source}",
- "mount -t ext2 /dev/loop$loop_number $live->{prefix}{live_mnt}$dir->{mountpoint}");
- $loop_number++;
- @mnt;
- },
- },
- tmpfs => {
- mount => sub {
- my ($live, $dir) = @_;
- "mount -t tmpfs none $live->{prefix}{live_mnt}$dir->{mountpoint}";
- },
- },
-);
-
-my %overlay = (
- unionfs => {
- modules => [ qw(unionfs) ],
- mount => sub {
- my ($live) = @_;
- #- build dirs list: "dir1=ro:dir2:ro:dir3=rw"
- my $dirs = join(':',
- map { "$live->{prefix}{live_mnt}$_->{mountpoint}=" .
- ($_->{type} && !$loop{$_->{type}}{read_only} ? 'rw' : 'ro');
- } @{$live->{mount}{dirs} || []});
- "mount -o dirs=$dirs -t unionfs unionfs $live->{prefix}{live_mnt}$live->{mount}{root}";
- },
- },
-);
-
-my %moddeps;
-sub load_moddeps {
- my ($root, $kernel_path) = @_;
- my $get_modname = sub { first($_[0] =~ m!^$kernel_path/kernel/(?:.*/|)(.*?)\.k?o!) };
- %moddeps = (map {
- my ($f, $deps) = split ':';
- my $modname = $get_modname->($f);
- $modname => { full => $f, deps => [ map { $get_modname->($_) } split ' ', $deps ] };
- } cat_($root . $kernel_path . '/modules.dep'));
-}
-sub moddeps_closure {
- my ($module) = @_;
- my @deps = @{$moddeps{$module}{deps}};
- (map { moddeps_closure($_) } @deps), @deps;
-}
-
-sub run_ {
- my $options = ref $_[0] eq 'HASH' ? shift @_ : {};
- print STDERR "running " . (exists $options->{root} && "(in chroot) ") . join(' ', @_) . "\n";
- run_program::raw($options, @_);
-}
-
-sub get_region_suffix {
- my ($live) = @_;
- defined $live->{system}{region} ? '/' . $live->{system}{region} : ref $live->{regions} ? '/noregion' : '';
-}
-
-sub get_workdir {
- my ($live) = @_;
- $live->{workdir} . get_region_suffix($live);
-}
-
-sub get_system_root {
- my ($live) = @_;
- $live->{system}{root} . get_region_suffix($live);
-}
-
-sub get_initrd_path {
- my ($live, $media) = @_;
- $live->{prefix}{boot} . '/' . $media->{storage} . '/initrd.gz';
-}
-
-sub get_syslinux_path {
- my ($live, $media, $o_boot_only) = @_;
- $live->{prefix}{boot} . '/' . $media->{storage} . '/syslinux' . ($o_boot_only && $media->{boot} && '-boot') . '.cfg';
-}
-
-sub create_initrd {
- my ($live) = @_;
- foreach ($live->{media}, @{$live->{extra_media}}) {
- create_initrd_for_media($live, $_);
- }
- $live->{copy_initrd} and cp_f(get_workdir($live) . get_initrd_path($live, $live->{media}), $live->{copy_initrd});
-}
-
-sub create_initrd_for_media {
- my ($live, $media) = @_;
-
- my $initrd_tree = get_workdir($live) . $live->{prefix}{initrd} . '/' . $media->{storage};
- rm_rf($initrd_tree) if -e $initrd_tree;
-
- mkdir_p($initrd_tree . $_) foreach
- qw(/bin /dev /lib /proc /sys),
- map { $live->{prefix}{live_mnt} . $_ }
- $live->{prefix}{media_mnt},
- $live->{mount}{root},
- map { $_->{mountpoint} } @{$live->{mount}{dirs} || []};
-
- # cp_f(get_system_root($live) . '/sbin/nash', $initrd_tree . '/bin/');
- #- use nash from cooker for now, label support
- cp_f('/sbin/nash', $initrd_tree . '/bin/');
- #- needed to mount loopbacks read-only and move mountpoints
- cp_f('/bin/mount', '/sbin/losetup', $initrd_tree . '/bin/');
- cp_f('/lib/ld-linux.so.2', '/lib/tls/libc.so.6', $initrd_tree . '/lib/');
- #- busybox is required to detect usb-storage process (we need sh/while/ps/grep)
- cp_f('/usr/bin/busybox', $initrd_tree . '/bin');
-
- if (get_media_setting($media, 'fs') eq 'nfs') {
- cp_f('/sbin/ifconfig', $initrd_tree . '/bin/');
- if ($live->{debug}) {
- cp_f('/bin/ping', $initrd_tree . '/bin/');
- cp_f('/lib/libresolv.so.2', $initrd_tree . '/lib/');
- }
- }
- if ($live->{debug}) {
- cp_f('/usr/bin/strace', $initrd_tree . '/bin/');
- my @l = map { /functions:/ .. /^$/ ? do { s/\s//g; split /,/ } : () } `busybox`;
- shift @l;
- #- don't override programs we copy in initrd
- @l = difference2(\@l, [ qw(losetup mount) ]);
- symlink('busybox', $initrd_tree . "/bin/$_") foreach @l;
- }
-
- require devices;
- devices::make($initrd_tree . "/dev/$_") foreach
- qw(console initrd null ram systty),
- (map { "tty$_" } 0..5),
- (map { "loop$_" } 0..7);
-
- load_moddeps(get_system_root($live), "/lib/modules/" . $live->{system}{kernel});
-
- my ($modules, $skipped) = partition { exists $moddeps{$_} }
- uniq(map { modules::cond_mapping_24_26($_) } category2modules(get_media_setting($media, 'modules')));
- my ($extra_modules, $missing) = partition { exists $moddeps{$_} }
- nls_modules($live),
- get_media_fs_module($media),
- @{get_media_setting($media, 'extra_modules') || []},
- (map { @{$loop{$_}{modules} || []} } uniq(map { $_->{type} } grep { $_->{type} } @{$live->{mount}{dirs} || []})),
- ($live->{mount}{overlay} ? @{$overlay{$live->{mount}{overlay}}{modules} || []} : ());
-
- @$missing and die "missing mandatory modules:" . join("\n", '', sort(@$missing));
- push @$modules, @$extra_modules;
-
- my @module_deps = uniq(map { moddeps_closure($_) } @$modules);
- run_('gzip', '>', $initrd_tree . "/lib/$_.ko", '-dc', get_system_root($live) . $moddeps{$_}{full})
- foreach @module_deps, @$modules;
-
- @$skipped and warn "skipped modules:" . join("\n", '', sort(@$skipped));
-
- #- move ide-generic to end of loaded modules, so that it registers unhandled drives only
- #- this avoid it to take-over drives which would have been managed by SATA modules
- my ($head, $tail) = partition { $_ ne 'ide-generic' } @$modules;
- @$modules = (@$head, @$tail);
-
- create_initrd_linuxrc($live, $media, @module_deps, @$modules);
- compress_initrd_tree($live, $media);
- add_splash($live, $media);
-}
-
-sub create_initrd_linuxrc {
- my ($live, $media, @modules) = @_;
- my $target = $live->{prefix}{live_mnt} . ($live->{mount}{root} || $live->{prefix}{media_mnt});
- my $pre = get_media_setting($media, 'pre');
- my $fs = get_media_setting($media, 'fs');
- output_with_perm(get_workdir($live) . $live->{prefix}{initrd} . '/' . $media->{storage} . '/linuxrc', 0755,
- join("\n",
- "#!/bin/nash",
- (map { "insmod /lib/$_.ko" } @modules),
- #- required for labels and ps
- "mount -t proc none /proc",
- #- required for cdrom labels
- "mount -t sysfs none /sys",
- if_(member('usb-storage', @modules),
- #- wait some seconds for the usb-stor-scan process to be run
- "sleep 2",
- q(busybox sh -c 'while busybox ps | busybox grep -q \\\[usb-stor-scan\\\]; do busybox sleep 1; done')),
- if_($live->{debug}, "/bin/sh"),
- if_($pre, deref_array($pre)),
- ($fs eq 'nfs' ? '/bin/mount -n -o ro,nolock' : 'mount') .
- (get_media_setting($media, 'read_only') && " -o ro") .
- " -t $fs " . get_media_setting($media, 'source') . " $live->{prefix}{live_mnt}$live->{prefix}{media_mnt}",
- (map { $loop{$_->{type}}{mount}->($live, $_) } grep { $_->{type} } @{$live->{mount}{dirs} || []}),
- ($live->{mount}{overlay} ? $overlay{$live->{mount}{overlay}}{mount}->($live) : ()),
- "echo 0x0100 > /proc/sys/kernel/real-root-dev",
- "umount /sys",
- "umount /proc",
- "pivot_root $target $target/initrd",
- "/bin/sh -c 'rmdir /initrd$target; cd /initrd$live->{prefix}{live_mnt}; for i in `/bin/ls -1`; do mkdir -p $live->{prefix}{live_mnt}/\$i; mount -n --move \$i $live->{prefix}{live_mnt}/\$i; done'",
- if_($live->{post}, deref_array($live->{post})),
- ""));
-}
-
-sub compress_initrd_tree {
- my ($live, $media) = @_;
-
- my $initrd_tree = get_workdir($live) . $live->{prefix}{initrd} . '/' . $media->{storage};
- my $size = run_program::get_stdout("du -ks $initrd_tree | awk '{print \$1}'") + 250;
- my $inodes = run_program::get_stdout("find $initrd_tree | wc -l") + 1250;
- $size = int($size + $inodes / 10) + 1; #- 10 inodes needs 1K
- my $initrd = get_workdir($live) . get_initrd_path($live, $media);
- $initrd =~ s/.gz$//;
-
- mkdir_p(dirname($initrd));
- run_('dd', 'if=/dev/zero', "of=$initrd", 'bs=1k', "count=$size");
- run_('mke2fs', '-q', '-m', 0, '-F', '-N', $inodes, '-s', 1, $initrd);
- mkdir_p($live->{mnt});
- run_('mount', '-o', 'loop', '-t', 'ext2', $initrd, $live->{mnt});
- cp_af(glob("$initrd_tree/*"), $live->{mnt});
- rm_rf($live->{mnt} . "/lost+found");
- run_('umount', $live->{mnt});
- run_('gzip', '-f', '-9', $initrd);
-}
-
-sub add_splash {
- my ($live, $media) = @_;
- if ($live->{system}{vga_mode} && $live->{system}{splash} ne 'no') {
- require bootloader;
- my $initrd = get_workdir($live) . get_initrd_path($live, $media);
- my $tmp_initrd = '/tmp/initrd.gz';
- cp_f($initrd, get_system_root($live) . $tmp_initrd);
- {
- local $::prefix = get_system_root($live);
- bootloader::add_boot_splash($tmp_initrd, $live->{system}{vga_mode});
- }
- cp_f(get_system_root($live) . $tmp_initrd, $initrd);
- unlink(get_system_root($live) . $tmp_initrd);
- }
-}
-
-sub build_syslinux_cfg {
- my ($live, $media, $opts) = @_;
- #- fastboot is needed to avoid fsck
- my $append = "fastboot splash=silent vga=$live->{system}{vga_mode}";
- #- syslinux wants files at root (used with vfat fs)
- my $to_root = get_boot_setting($media, 'fs', $opts->{boot_only}) eq 'vfat';
- my ($initrd, $kernel, $display, $help) = map { $to_root ? basename($_) : $_ }
- get_initrd_path($live, $media), map { $live->{prefix}{boot} . '/' . $_ } qw(vmlinuz live.msg help.msg);
- qq(default live
-prompt 1
-timeout 40
-display $display
-F1 $help
-label live
- kernel $kernel
- append initrd=$initrd $append
-);
-}
-
-sub install_system {
- my ($live) = @_;
- my @langs = uniq((ref $live->{regions} ? @{$live->{regions}{$live->{system}{region}}} : ()), @{$live->{system}{langs_always}});
- run_({ timeout => 3600 },
- 'drakx-in-chroot',
- $live->{system}{repository},
- get_system_root($live),
- if_($live->{system}{region}, '--langs', join(':', @langs)),
- if_($live->{system}{auto_install}, '--auto_install', Cwd::abs_path($live->{system}{auto_install})),
- if_($live->{system}{patch_install}, '--defcfg', Cwd::abs_path($live->{system}{patch_install})),
- if_($live->{system}{rpmsrate}, '--rpmsrate', Cwd::abs_path($live->{system}{rpmsrate})))
- or die "unable to install system chroot";
- post_install_system($live);
-}
-
-sub post_install_system {
- my ($live) = @_;
-
- #- add all additional media first, there may be some interaction between them
- foreach (@{$live->{system}{additional_media}}) {
- run_({ root => get_system_root($live) }, 'urpmi.addmedia', if_($_->{distrib}, '--distrib'), $_->{name}, $_->{path})
- or die "unable to add media from $_->{path}";
- }
- foreach (@{$live->{system}{additional_media}}) {
- run_({ root => get_system_root($live) }, 'urpmi', '--auto', '--no-verify-rpm', if_(!$_->{distrib}, '--searchmedia', $_->{name}), @{$_->{packages}})
- or die "unable to install packages from $_->{path}";
- }
-
- #- additional rpms may have dependencies in additionnal media
- if (@{$live->{system}{rpms}}) {
- my $rpm_tmp_dir = '/tmp/draklive_rpms';
- mkdir_p(get_system_root($live) . $rpm_tmp_dir);
- cp_f(@{$live->{system}{rpms}}, get_system_root($live) . $rpm_tmp_dir);
- run_({ root => get_system_root($live) }, 'urpmi', '--auto', '--no-verify-rpm',
- map { $rpm_tmp_dir . '/' . basename($_) } @{$live->{system}{rpms}})
- or die "unable to install additionnal system rpms";
- rm_rf(get_system_root($live) . $rpm_tmp_dir);
- }
-
- #- remove urpmi media added by drakx-in-chroot and additional media, they're unusable
- run_({ root => get_system_root($live) }, 'urpmi.removemedia', '-a');
-
- my $erase = join(' ', @{$live->{system}{erase_rpms}});
- run_({ root => get_system_root($live) }, 'sh', '-c', "rpm -qa $erase | xargs rpm -e ") if $erase;
-
- run_({ root => get_system_root($live) }, 'chkconfig', '--del', $_) foreach @{$live->{system}{disable_services}};
-
- my @patches = map { Cwd::abs_path($_) } @{$live->{system}{patches}};
- each_index { !defined $_ and die "unable to find file " . $live->{system}{patches}[$::i] } @patches;
- run_('patch', '-p0', '-s', '-N', '-F', 0, '-d', get_system_root($live), '-r', '/tmp', '-i', $_) foreach @patches;
-
- foreach (@{$live->{system}{files}}) {
- my ($source, $dest, $o_perm) = @$_;
- $dest = get_system_root($live) . $dest;
- cp_f($source, $dest);
- chmod $o_perm, $dest if $o_perm;
- }
-
- #- make sure harddrake is run:
- #- if previous HW config file is empty, we assumes DrakX has just completed the installation
- #- (do it in chroot, or else Storable from the build box may write an incompatible config file)
- run_({ root => get_system_root($live) },
- 'perl', '-MStorable', '-e', qq(Storable::store({ UNKNOWN => {} }, '/etc/sysconfig/harddrake2/previous_hw')));
-
- #- remove some build-machine specific configuration
- substInFile { undef $_ if /^[^#]/ } get_system_root($live) . $_
- foreach qw(/etc/fstab /etc/mtab /etc/modprobe.conf /etc/modprobe.preload /etc/iftab /etc/shorewall/interfaces /etc/mdadm.conf);
- output_with_perm(get_system_root($live) . '/etc/fstab', 0644, "none / unionfs rw 0 0\n");
-
- #- run harddrake because a crappy snd-usb-audio workaround may do something at shutdown
- #- (do it after the modprobe files are cleaned)
- run_({ root => get_system_root($live) }, '/usr/share/harddrake/service_harddrake', 'stop');
-
- #- interactive mode can lead to race in initscripts
- #- (don't use addVarsInSh from MDK::Common, it breaks shell escapes)
- substInFile { s/^PROMPT=.*/PROMPT=no/ } get_system_root($live) . '/etc/sysconfig/init';
-
- #- preselect guest user in kdm
- my $kdm_cfg = '/etc/kde/kdm/kdmrc';
- update_gnomekderc(get_system_root($live) . $kdm_cfg,
- 'X-:0-Greeter' => (PreselectUser => 'Default', DefaultUser => 'guest')) if -f $kdm_cfg;
-}
-
-sub create_loopback_files {
- my ($live) = @_;
- mkdir_p(get_workdir($live) . $live->{prefix}{loopbacks});
- foreach (grep { $_->{build_from} } @{$live->{mount}{dirs} || []}) {
- my $tree = get_system_root($live) . $_->{build_from};
- my $dest = get_workdir($live) . $live->{prefix}{loopbacks} . '/' . $_->{source};
- unlink($dest);
- $loop{$_->{type}}{build}->($dest, $tree);
- }
- foreach (grep { $_->{pre_allocate} } @{$live->{mount}{dirs} || []}) {
- my $dest = get_workdir($live) . $live->{prefix}{loopbacks} . '/' . $_->{source};
- unlink($dest);
- $loop{$_->{type}}{create}->($dest, $_->{pre_allocate});
- }
-}
-
-#- mainly for storage-specific subroutines
-sub get_storage_setting {
- my ($media, $setting) = @_;
- $storage{$media->{storage}}{$setting};
-}
-
-#- for actions that support an optionnal boot storage type
-sub get_boot_setting {
- my ($media, $setting, $boot_only) = @_;
- $boot_only && $media->{boot} ? $storage{$media->{boot}}{$setting} : get_storage_setting($media, $setting);
-}
-
-#- for user-customisable media setting, that can override storage setting
-sub get_media_setting {
- my ($media, $setting) = @_;
- $media->{$setting} || get_storage_setting($media, $setting);
-}
-
-sub get_media_fs_module {
- my ($media) = @_;
- my $fs = get_media_setting($media, 'fs');
- $fs eq 'iso9660' ? 'isofs' : $fs;
-}
-
-sub get_media_label {
- my ($media) = @_;
- first(get_media_setting($media, 'source') =~ /^LABEL=(.*)$/);
-}
-
-sub get_media_device {
- my ($media) = @_;
- return $media->{device} if $media->{device};
- my $label = get_media_label($media) or return get_media_setting($media, 'source');
- my $device = chomp_(`readlink -f /dev/disk/by-label/$label`)
- or die "unable to find device for /dev/disk/by-label/$label";
- $device;
-}
-
-sub prepare_bootloader {
- my ($live, $opts) = @_;
- create_initrd($live);
- cp_f(get_system_root($live) . '/boot/vmlinuz-' . $live->{system}{kernel}, get_workdir($live) . $live->{prefix}{boot} . '/vmlinuz');
- require bootsplash;
- my $theme = do {
- local $::prefix = get_system_root($live);
- bootsplash::themes_read_sysconfig('800x600');
- };
- my $msg = get_system_root($live) . "/usr/share/bootsplash/themes/$theme->{name}/lilo/syslinux";
- if (-f $msg) {
- print "using $msg as syslinux splash image\n";
- cp_f($msg, get_workdir($live) . $live->{prefix}{boot} . '/live.msg');
- } else {
- warn "unable to find syslinux splash ($msg)";
- }
- output(get_workdir($live) . $live->{prefix}{boot} . '/help.msg',
- pack("C*", 0x0E, 0x80, 0x03, 0x00, 0xC) . qq(
-Welcome to Mandriva live!
-
-The command line can be used to specify kernel options.
-
-live <kernel options>
-
-));
- foreach ($live->{media}, @{$live->{extra_media}}) {
- output(get_workdir($live) . get_syslinux_path($live, $_, $opts->{boot_only}), build_syslinux_cfg($live, $_, $opts));
- }
-}
-
-sub get_cdrom_master_path {
- my ($live, $opts) = @_;
- get_workdir($live) . $live->{prefix}{images} . '/' . ($opts->{boot_only} ? 'boot' : 'live') . '.iso';
-}
-
-sub create_cdrom_master {
- my ($live, $media, $opts) = @_;
- my $label = get_media_label($media) or die "the source device must be described by a label";
- my $dest;
- unless ($opts->{onthefly}) {
- $dest = get_cdrom_master_path($live, $opts);
- mkdir_p(dirname($dest));
- }
- run_('mkisofs', '-pad', '-l', '-R', '-J', '-v', '-v',
- '-V', $label, #'-A', $application, '-p', $preparer, '-P', $publisher,
- '-b', 'isolinux/isolinux.bin',
- '-c', 'isolinux/boot.cat',
- '-hide-rr-moved', '-no-emul-boot',
- '-boot-load-size', 4, '-boot-info-table',
- '-graft-points',
- if_($dest, '-o', $dest),
- 'isolinux/isolinux.bin=/usr/lib/syslinux/isolinux-graphic.bin',
- 'isolinux/isolinux.cfg=' . get_workdir($live) . get_syslinux_path($live, $media, $opts->{boot_only}),
- $live->{prefix}{boot} . '=' . get_workdir($live) . $live->{prefix}{boot},
- if_(!$opts->{boot_only}, $live->{prefix}{loopbacks} . '=' . get_workdir($live) . $live->{prefix}{loopbacks}),
- );
- run_('mkcd', '--addmd5', $dest) if $dest;
-}
-
-#- $opts:
-#- media: alternate media
-#- onthefly : if true, the create function must output to stdout
-sub create_master {
- my ($live, $opts) = @_;
- my $media = $opts->{media} || $live->{media};
-
- if (my $create = get_boot_setting($media, 'create', $opts->{boot_only})) {
- $create->($live, $media, $opts);
- } else {
- warn "not implemented yet";
- }
-}
-
-sub maybe_umount_device {
- my ($device) = @_;
- run_('umount', $device) if cat_('/proc/mounts') =~ m!^$device\s+!m;
-}
-
-sub format_cdrom_device {
- my ($_live, $media) = @_;
- run_('cdrecord', '-v', 'dev=' . $media->{device}, "blank=fast");
-}
-
-sub format_usb_device {
- my ($_live, $media) = @_;
- maybe_umount_device($media->{device});
- run_('mkdosfs', $media->{device})
- or die "unable to format device $media->{device}";
-}
-
-#- $opts:
-#- media: alternate media
-sub format_device {
- my ($live, $opts) = @_;
- my $media = $opts->{media} || $live->{media};
-
- $media->{device} or die "no device defined in media configuration";
- if (my $format = get_boot_setting($media, 'format', $opts->{boot_only})) {
- $format->($live, $media);
- } else {
- warn "not implemented yet";
- }
-}
-
-sub record_cdrom_master {
- my ($live, $media, $opts) = @_;
- $media->{device} or die "no device defined in media configuration";
- my $src = $opts->{onthefly} ? '-' : get_cdrom_master_path($live, $opts);
- run_('cdrecord', '-v', 'dev=' . $media->{device}, $src);
-}
-
-sub record_usb_master {
- my ($live, $media, $opts) = @_;
- if (my $label = $media->{device} && get_media_label($media)) {
- run_('mlabel', '-i', $media->{device}, '::' . $label);
- }
- my $device = get_media_device($media)
- or die "unable to find recording device (missing label? try with --device <device>)";
- mkdir_p($live->{mnt});
- run_('mount', $device, $live->{mnt})
- or die "unable to mount $device";
- cp_af(get_workdir($live) . $live->{prefix}{boot}, $live->{mnt});
- cp_f(get_workdir($live) . get_syslinux_path($live, $media, $opts->{boot_only}), $live->{mnt});
- cp_f(get_workdir($live) . $_, $live->{mnt}) foreach
- get_initrd_path($live, $media), map { $live->{prefix}{boot} . '/' . $_ } qw(vmlinuz live.msg);
- run_('rsync', '-vdP', '--inplace', get_workdir($live) . $live->{prefix}{loopbacks} . '/', $live->{mnt} . $live->{prefix}{loopbacks})
- unless $opts->{boot_only};
- run_('umount', $live->{mnt});
- maybe_umount_device($device);
- #- use syslinux -s, "safe, slow and stupid" version of SYSLINUX, unless specified otherwise
- run_('syslinux', if_(!$media->{fast_syslinux}, '-s'), $device)
- or die "unable to run syslinux on $device";
-}
-
-#- $opts:
-#- media: alternate media
-#- onthefly : if true, the record function must read from stdin
-sub record_master {
- my ($live, $opts) = @_;
- my $media = $opts->{media} || $live->{media};
-
- if (my $record = get_boot_setting($media, 'record', $opts->{boot_only})) {
- $record->($live, $media, $opts);
- } else {
- warn "not implemented yet";
- }
-}
-
-sub pipe_subs {
- my ($writer, $reader) = @_;
- my ($r, $w) = POSIX::pipe;
- if (my $pid = fork()) {
- POSIX::close($w) or die "couldn't close: $!\n";
- my $stdin = POSIX::dup(0) or die "couldn't dup: $!\n";
- POSIX::dup2($r, 0) or die "couldn't dup2: $!\n";
- POSIX::close($r);
- $reader->();
- POSIX::close(0) or warn "writer exited $?";
- POSIX::dup2($stdin, 0) or die "couldn't dup2: $!\n";
- waitpid($pid, 0);
- } else {
- POSIX::close($r) or die "couldn't close: $!\n";
- #- don't screw up reader
- POSIX::dup2(POSIX::open('/dev/null', &POSIX::O_WRONLY), 2) or die "couldn't dup2: $!\n";
- POSIX::dup2($w, 1) or die "couldn't dup2: $!\n";
- POSIX::close($w);
- $| = 1; #- autoflush write
- exit !$writer->();
- }
-}
-
-sub record_onthefly {
- my ($live, $opts) = @_;
- my $media = $opts->{media} || $live->{media};
-
- my $record = get_storage_setting($media, 'record');
- unless ($record) {
- warn "not implemented yet";
- return;
- }
- if (my $create = get_storage_setting($media, 'create')) {
- #- pipe creation step to recording step
- pipe_subs(sub { $create->($live, $media, { onthefly => 1 }) },
- sub { $record->($live, $media, { onthefly => 1 }) });
- } else {
- #- no creation step, record directly
- $record->($live, $media);
- }
-}
-
-sub copy_wizard {
- my ($live) = @_;
- my $root = get_workdir($live) . $live->{prefix}{boot};
- my @available_storage = sort(grep { -d "$root/$_" && exists $storage{$_}{detect} } all($root));
- my @available_devices;
- require interactive;
- require wizards;
- my $in = 'interactive'->vnew('su');
- my ($storage, $device, $format);
- my $w = wizards->new({
- name => N("Live system copy wizard"),
- pages => {
- welcome => {
- name => N("Welcome to the live system copy wizard"),
- next => 'storage',
- },
- storage => {
- name => N("Please select the medium type"),
- data => [ { type => 'list', allow_empty_list => 1,
- val => \$storage, list => \@available_storage } ],
- next => 'device',
- },
- device => {
- name => N("Please select the device that will contain the new live system"),
- pre => sub {
- my %devices = map { $_->{device} => $_ } $storage{$storage}{detect}->();
- $_->{formatted_name} = $_->{usb_description} || $_->{info} || $_->{device} foreach values %devices;
- @available_devices = ();
- require fs::proc_partitions;
- foreach (fs::proc_partitions::read([ values %devices ])) {
- if ($_->{rootDevice} && exists $devices{$_->{rootDevice}}) {
- my $description = $devices{$_->{rootDevice}}{usb_description} || $devices{$_->{rootDevice}}{info};
- $_->{formatted_name} = $description ? "$description ($_->{device})" : $_->{device};
- push @available_devices, $_;
- }
- }
- delete $devices{$_->{rootDevice}} foreach @available_devices;
- unshift @available_devices, map { $devices{$_} } sort keys %devices;
- undef $device;
- },
- data => [ { type => 'list', allow_empty_list => 1,
- val => \$device, , list => \@available_devices,
- format => sub { $_[0]{formatted_name} } },
- { text => N("Format selected device"), val => \$format, type => 'bool' } ],
- complete => sub {
- return 0 if defined $device;
- $in->ask_warn(N("Error"), N("You must select a device!"));
- 1;
- },
- post => sub {
- my $media = { media => { storage => $storage, device => '/dev/' . $device->{device} } };
- format_device($live, $media) if $format;
- record_onthefly($live, $media);
- },
- end => 1,
- },
- }
- });
- $w->process($in);
-}
-
-sub complete_config {
- my ($live) = @_;
-
- my $default_prefix = {
- media_mnt => '/media',
- live_mnt => '/live',
- loopbacks => '/loopbacks',
- images => '/images',
- boot => '/boot',
- initrd => '/initrd',
- };
-
- if ($live->{copy_wizard}) {
- add2hash($live->{prefix} ||= {}, $default_prefix);
- #- assumes the current live media is mounted there
- $live->{workdir} = $live->{prefix}{live_mnt} . $live->{prefix}{media_mnt};
- $live->{mnt} = '/tmp/mnt';
- } else {
- #- set unsupplied config dirs
- $live->{workdir} ||= '/tmp/draklive';
- $live->{mnt} ||= get_workdir($live) . "/mnt";
-
- #- check for minimum requirements
- ref $live->{media} && $live->{media}{storage} or die "no media storage definition";
- ref $live->{system} or die "no system definition";
- $live->{system}{kernel} or die "no kernel has been configured";
- mkdir_p(get_workdir($live));
-
- add2hash($live->{prefix} ||= {}, $default_prefix);
- }
-}
-
-sub clean {
- my ($live) = @_;
- rm_rf($_) foreach grep { -e $_ } get_workdir($live), get_system_root($live);
-}
-
-my @actions = (
- { name => 'clean', do => \&clean },
- { name => 'install', do => \&install_system },
- { name => 'post-install', do => \&post_install_system },
- { name => 'initrd', do => \&create_initrd },
- { name => 'boot', do => \&prepare_bootloader },
- { name => 'loop', do => \&create_loopback_files },
- { name => 'master', do => \&create_master },
- { name => 'format', do => \&format_device },
- { name => 'record', do => \&record_master },
- { name => 'record-onthefly', do => \&record_onthefly },
-);
-my @all = qw(install boot loop master);
-
-require_root_capability();
-
-my (%live, %opts);
-GetOptions(
- "help" => sub { Pod::Usage::pod2usage('-verbose' => 1) },
- "copy-wizard" => \$live{copy_wizard},
- "boot-only" => \$opts{boot_only},
- "all" => sub { $_->{to_run} = 1 foreach grep { member($_->{name}, @all) } @actions },
- (map { $_->{name} => \$_->{to_run} } @actions),
- "device:s" => sub { $live{media}{device} = $_[1] },
- "region:s" => sub { $live{system}{region} = $_[1] },
- "all-regions" => sub { $live{all_regions} = 1 },
- "config:s" => sub {
- my $path = $_[1];
- #- don't use do(), since it can't see lexicals in the enclosing scope
- my $cfg = eval(cat_($path)) or die "unable to load $path: $@";
- put_in_hash(\%live, $cfg);
- print "loaded $path as config file\n";
- },
-) or Pod::Usage::pod2usage();
-
-require standalone;
-if ($live{copy_wizard}) {
- complete_config(\%live);
- copy_wizard(\%live);
-} else {
- every { !$_->{to_run} } @actions and die 'nothing to do';
- unless (keys(%live)) {
- warn 'no live definition';
- Pod::Usage::pod2usage();
- }
- foreach my $region ($live{all_regions} ? sort(keys %{$live{regions}}) : $live{system}{region}) {
- $region and print qq(=== proceeding with region "$region"\n);
- $live{system}{region} = $region;
- complete_config(\%live);
- foreach (grep { $_->{to_run} } @actions) {
- print qq(* entering step "$_->{name}"\n);
- $_->{do}->(\%live, \%opts);
- print qq(* step "$_->{name}" done\n);
- }
- }
-}
-
-__END__
-
-=head1 NAME
-
-draklive - A live distribution mastering tool
-
-=head1 SYNOPSIS
-
-draklive [options]
-
- Options:
- --help long help message
-
- --install install selected distribution in chroot
- --boot prepare initrd and bootloader files
- --loop build compressed loopback files
- --master build master image
-
- --all run all steps, from installation to mastering
-
- --clean clean installation chroot and work directory
-
- --device <dev> use this device for live recording (not needed
- if the device already has the required label)
- --format format selected device
- --record record live on selected media
- --record-onthefly record live by creating master from loopback files
- on the fly
-
- --initrd build initrd only
- --post-install run post install only (rpms and patches installation)
-
- --config <file> use this configuration file as live description
-
- --region <region> use the matching set of langs
- (from the regions configuration hash)
- --all-regions proceed with all configured regions
-
- --copy-wizard run the copy wizard
-
- --boot-only consider only boot media
- (affects boot/master/format/record steps)
-
-Examples:
-
- draklive --config config/live.cfg --clean
-
- draklive --config config/live.cfg --all
-
- draklive --config config/live.cfg --record --device /dev/sdb1
-
-=head1 OPTIONS
-
-=over 8
-
-=item B<--config>
-
-Makes draklive use the next argument as a configuration file.
-This file should contain an hash describing the live distribution,
-meaning the system (chroot and boot), media (usb, cdrom, nfs),
-and mount type (simple R/W union, union with squash files).
-
-Here's a configuration sample:
-
- {
- system => {
- root => '/chroot/live-move',
- repository => '/mnt/ken/2006.0/i586',
- kernel => '2.6.12-12mdk-i586-up-1GB',
- auto_install => 'config/auto_inst.cfg.pl',
- patch_install => 'config/patch-2006-live.pl',
- rpmsrate => 'config/rpmsrate',
- rpms => [
- 'rpms/unionfs-kernel-2.6.12-12mdk-i586-up-1GB-1.1.1.1.20051124.1mdk-1mdk.i586.rpm'
- ],
- patches => [
- 'patches/halt.loopfs.patch',
- ],
- vga_mode => 788,
- },
- media => {
- storage => 'cdrom',
- },
- extra_media => [
- {
- storage => 'usb',
- },
- ],
- mount => $predefined{mounts}{squash_union}
- };
-
-=back
-
-=head1 DESCRIPTION
-
-B<draklive> builds a live distribution according to a
-configuration file, creates a master image,
-and optionnally installs it on a device.
-
-See L<http://qa.mandriva.com/twiki/bin/view/Main/DrakLive>
-
-=head1 AUTHOR
-
-Olivier Blin <oblin@mandriva.com>
-
-=cut
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index 4f8b61c4f..6565ec9e0 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -9,16 +9,45 @@ my $prefix_ROOTED = '/mnt';
my $IMAGE_LOCATION_ROOTED = '/tmp/image';
my $MEDIA_LOCATION_ROOTED = '/tmp/media';
my $STAGE2_LOCATION_ROOTED = '/tmp/stage2';
+my $LOOP_MOUNT_POINT = "$SLASH_LOCATION/tmp/loop";
my $LIVE_LOCATION_REL = 'install/stage2/live/';
my $COMPRESSED_LOCATION_REL = 'install/stage2/';
my $COMPRESSED_FILE_REL = $COMPRESSED_LOCATION_REL . 'mdkinst.sqfs';
my $AUTO_INSTALL_ROOTED = '/tmp/auto_inst.cfg.pl';
my $DEFCFG_ROOTED = '/tmp/defcfg.pl';
my $RPMSRATE_ROOTED = '/tmp/rpmsrate';
+my $resolution = '1024x768';
+my ($disk_iso_repository, $repository_uri);
-@ARGV >= 2 or die "usage: drakx-in-chroot <root of distrib> <dir to install to> [options]\n";
+@ARGV >= 2 or die "usage: drakx-in-chroot <root of distrib> <dir to install to> [options]\n
+\nOptions specific to drakx-in-chroot:
+ --flang XX use XX locale
+ --disk-iso path of a distro
+ --resolution=XXXxYYYY (eg: --resolution=800x600)\n
+ --repository=<path> path of packages repository
+ --text text mode installer
+ --depth=XX set screen color depth
+ --stage2-update X,Y will mount --bind X on Y
+";
(my $repository, my $dir, @ARGV) = @ARGV;
+my ($wrapper);
+foreach (@ARGV) {
+ if (/--resolution=(.*)/) {
+ $resolution = $1;
+ } elsif (/--disk-iso=(.*)/) {
+ $disk_iso_repository = $1;
+ } elsif (/--repository=(.*)/) {
+ $repository_uri = $1;
+ } elsif (/--gdb/) {
+ $wrapper = "gdb -q --args";
+ } elsif (/--strace/) {
+ $wrapper = "strace -e file $ENV{STRACE_OPTIONS}";
+ } elsif (/--depth=(.*)/) {
+ $resolution .= "x$1";
+ }
+}
+my ($repository_without_arch, $repository_arch) = basename($repository) eq arch() ? (dirname($repository), '/' . arch()) : ($repository, '');
my $STAGE2_LOCATION = $SLASH_LOCATION . $STAGE2_LOCATION_ROOTED;
my $sudo;
@@ -27,15 +56,18 @@ if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}
+my @mounts;
+my $_b = before_leaving { sys("$sudo umount $_") foreach reverse @mounts };
+
undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files
if (-d $SLASH_LOCATION) {
- umount_all() == 0 or exit(1);
+ umount_all(1) == 0 or exit(1);
sys("$sudo rm -rf $SLASH_LOCATION/var/lib/rpm $SLASH_LOCATION/dev/mapper");
rm_rf($SLASH_LOCATION);
}
-mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/dev/usb', '/etc', '/var', '/proc', '/sys', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED;
+mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/etc', '/var', '/proc', '/sys', '/run', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED;
sys("$sudo rm -rf $dir") if $ENV{CLEAN};
-e $dir or sys("$sudo mkdir -p $dir");
@@ -48,18 +80,40 @@ if ($remote_repository) {
sys("curl --silent -o $local_mdkinst $repository/$COMPRESSED_FILE_REL");
mount_mdkinst($local_mdkinst);
} elsif (-d "$repository/$LIVE_LOCATION_REL") {
- sys("$sudo mount -o bind $repository/$LIVE_LOCATION_REL $STAGE2_LOCATION");
+ mount("$repository/$LIVE_LOCATION_REL", $STAGE2_LOCATION, "-o bind");
} elsif (-e "$repository/$COMPRESSED_FILE_REL") {
mount_mdkinst("$repository/$COMPRESSED_FILE_REL");
}
-sys("$sudo mount -o bind $dir $SLASH_LOCATION$prefix_ROOTED");
-sys("$sudo mount -o bind $repository $SLASH_LOCATION$MEDIA_LOCATION_ROOTED") if !$remote_repository;
-sys("$sudo mount -t proc none $SLASH_LOCATION/proc");
-sys("$sudo mount -t sysfs none $SLASH_LOCATION/sys");
-symlinkf('media', "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED");
+mount($dir, "$SLASH_LOCATION$prefix_ROOTED", "-o bind");
+$repository_uri ||= $repository_without_arch if !$remote_repository;
+mount($repository_uri, "$SLASH_LOCATION$MEDIA_LOCATION_ROOTED", "-o bind") if $repository_uri;
+
+mount('/dev', "$SLASH_LOCATION/dev", " --bind -o ro");
+mount('none', "$SLASH_LOCATION/proc", "-t proc");
+mount('none', "$SLASH_LOCATION/sys", "-t sysfs");
+mount('none', "$SLASH_LOCATION/sys/kernel/debug", "-t debugfs");
+mount('none', "$SLASH_LOCATION/run", "-t tmpfs");
+
+# - Ensure we mount the udev run dir for various extra metadata from udevadm
+# - If dracut has been used (and thus udev has yummy metadata) make sure
+# drakx knows about it when running in the chroot
+# - Also speedup blkid by using its cache
+foreach my $dir (qw(initramfs udev blkid)) {
+ next if !-d "/run/$dir";
+ mkdir_p("$SLASH_LOCATION/run/$dir");
+ mount("/run/$dir", "$SLASH_LOCATION/run/$dir", "-o bind");
+}
+
+if ($disk_iso_repository) {
+ my $repository_arch = $repository_arch || 'i586';
+ mkdir_p($LOOP_MOUNT_POINT);
+ mount($disk_iso_repository, $LOOP_MOUNT_POINT, "-o loop,ro");
+ symlinkf('loop/' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); # FIXME: arch()
+}
+
+symlinkf('media' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED");
create_initial_symlinks();
-create_initial_devices();
apply_stage2_updates();
@@ -71,24 +125,24 @@ mkdir_p("$dir/dev");
eval { cp_af($_, "$dir$_") } foreach qw(/dev/root);
#- if the DISPLAY is remote, we may need to resolve the name:
-eval { cp_af($_, "$SLASH_LOCATION$_") } foreach qw(/etc/resolv.conf);
+eval { cp_af('/etc/resolv.conf', "$SLASH_LOCATION/etc/resolv.conf") };
{
chomp(my $kernel_version = `uname -r`);
my $dir = "/modules/$kernel_version";
mkdir_p("$SLASH_LOCATION$dir");
- cp_af("/lib/$dir/modules.dep", "/lib/$dir/modules.alias", "$SLASH_LOCATION$dir");
+ output_p("$SLASH_LOCATION$dir" . $_, "\n") foreach "/lib/$dir/modules.dep", "/lib/$dir/modules.alias";
}
my $Xnest_pid;
-my $Xnest_bin = find { whereis_binary($_) } 'Xnest', 'Xephyr';
-if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && $Xnest_bin) {
+if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && join('', @ARGV) !~ /--text/) {
+ my $Xnest_bin = find { whereis_binary($_) } 'Xephyr', 'Xnest' or die "Xephyr not found! Please install x11-server-xephyr!\n";
my $DISPLAY = ':8';
$Xnest_pid = fork();
if (!$Xnest_pid) {
- exec $Xnest_bin, $DISPLAY, '-ac', ($Xnest_bin eq 'Xephyr' ? '-screen' : '-geometry'), '800x600' or die "Xnest failed\n";
+ exec $Xnest_bin, $DISPLAY, '-ac', ($Xnest_bin eq 'Xephyr' ? '-screen' : '-geometry'), $resolution or die "Xnest failed\n";
}
- $ENV{DISPLAY} = '127.0.0.1' . $DISPLAY;
+ $ENV{DISPLAY} = $DISPLAY;
}
if (my $pid = fork()) {
@@ -98,15 +152,27 @@ if (my $pid = fork()) {
} else {
$ENV{TERM} = 'linux'; # we only have terminfo for terminal "linux"
$ENV{HOME} = '/';
- # to kept sync with gi/mdk-stage1/init.c::env:
- $ENV{LD_LIBRARY_PATH}='/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/usr/X11R6/lib:/mnt/usr/X11R6/lib:/lib64:/usr/lib64:/usr/X11R6/lib64:/mnt/lib64:/mnt/usr/lib64:/mnt/usr/X11R6/lib64';
+ # to kept sync with mdk-stage1/init.c::env:
+ $ENV{LD_LIBRARY_PATH}='/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/lib64:/usr/lib64:/mnt/lib64:/mnt/usr/lib64';
if ($remote_repository) {
$ENV{URLPREFIX} = $repository;
}
my $cmd = join(' ', "/usr/bin/runinstall2 --local_install",
+ if_($disk_iso_repository, "--method disk-iso"),
if_($remote_repository, "--method $remote_repository"),
@ARGV);
- exec "$sudo chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n";
+ if ($wrapper) {
+ warn qq(GDB USAGE
+Beware that debug info won't be found so on segfault
+just generate a core dump with "gcore" and then
+analyze it offline.
+Thus you sessions will look like:
+(gdb) run
+(gdb) gcore
+(gdb) exit
+);
+ }
+ exec "$sudo $wrapper chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n";
}
sub system_verbose { warn join(' ', @_), "\n" if $verbose; system(@_) }
@@ -114,7 +180,7 @@ sub sys { &system_verbose; $? and die qq(running "@_" failed: $?\n) }
sub mount_mdkinst {
my ($mdkinst) = @_;
- sys("$sudo mount -t squashfs -o loop,ro $mdkinst $STAGE2_LOCATION");
+ mount($mdkinst, $STAGE2_LOCATION, "-t squashfs -o loop,ro");
}
sub create_initial_symlinks() {
foreach (cat_or_die("$STAGE2_LOCATION/usr/share/symlinks")) {
@@ -125,21 +191,36 @@ sub create_initial_symlinks() {
symlink $from, $to or die "symlinking $to failed\n";
}
}
+ my $from = "$STAGE2_LOCATION_ROOTED/usr";
+ my $to = "$SLASH_LOCATION/usr";
+ symlink $from, $to or die "symlinking $to failed\n";
+ foreach ('bin', 'sbin', 'lib', 'lib64') {
+ $from = "usr/$_";
+ $to = "$SLASH_LOCATION/$_";
+ symlink $from, $to or die "symlinking $to failed\n";
+ }
}
-sub create_initial_devices() {
- sys("$sudo cp -a /dev/{mem,null} $SLASH_LOCATION/dev");
+sub mount {
+ my ($from, $mntpt, @opts) = @_;
+ push @mounts, $mntpt;
+ sys("$sudo mount $from $mntpt " . join(' ', @opts));
}
-sub umount_all() {
+sub umount_all {
+ my ($b_umount_dev_too) = @_;
my $err;
clean_stage2_updates();
- my @procs = ('/proc/bus/usb', '/proc', '/sys');
- foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
+ my @procs = (qw(/proc /sys/kernel/debug /sys /run/udev /run/blkid /run/initramfs /run));
+ # special case for !draklive case (else a 2nd run would fail):
+ if ($b_umount_dev_too && cat_('/proc/mounts') =~ m! $SLASH_LOCATION/dev !) {
+ system_verbose "$sudo umount $SLASH_LOCATION/dev" and rm_rf("$SLASH_LOCATION/dev");
+ }
+ foreach ((map { "$prefix_ROOTED$_" } @procs, '/dev', ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
my $dir = "$SLASH_LOCATION$_";
rmdir $dir;
if (-d $dir) {
- if (m!/proc/bus/usb! || begins_with($_, $prefix_ROOTED)) {
+ if (m!/sys/kernel/debug! || begins_with($_, $prefix_ROOTED)) {
system_verbose "$sudo umount $dir 2>/dev/null";
next;
}
@@ -186,7 +267,7 @@ sub apply_stage2_updates() {
undef $ARGV[$::i+1];
undef $ARGV[$::i+2];
push @stage2_updates, $dest;
- sys("$sudo mount --bind $file $STAGE2_LOCATION/$dest");
+ mount($file, "$STAGE2_LOCATION/$dest", " --bind");
}
}
} @ARGV;
diff --git a/tools/find-drivers-needing-nonfree-firmware b/tools/find-drivers-needing-nonfree-firmware
new file mode 100755
index 000000000..e8068baee
--- /dev/null
+++ b/tools/find-drivers-needing-nonfree-firmware
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+use MDK::Common;
+use Data::Dumper;
+use Data::Dumper::Perltidy;
+
+my $debug = member('--debug', @ARGV);
+
+my $path = '../../cache';
+my %cache = (
+ version => "$path/version.txt",
+ modules => "$path/modules.txt",
+ firmwares => "$path/firmwares.txt",
+ modinfo => "$path/modinfo.",
+ );
+
+mkdir_p($path) if !-d $path;
+# version of main kernel flavor:
+my $kernel = chomp_(cat_($cache{version}));
+if (!$kernel) {
+ # get regular flavor:
+ ($kernel) = split('\|', chomp_(`urpmq -f kernel-desktop-latest`));
+ # get real package name:
+ $kernel =~ s/-latest//;
+ # drop arch as it confuses urpmq:
+ $kernel =~ s/\.[^.]*$//;
+ output($cache{version}, $kernel);
+}
+warn ">> GOT '$kernel'\n" if $debug;
+
+# list of modules:
+my @modules = cat_($cache{modules});
+if (!@modules) {
+ @modules = grep { /\.ko/ } `urpmq -l $kernel`;
+ output($cache{modules}, @modules);
+}
+@modules = map { chomp; $_ } @modules;
+
+# list of those module firmwares:
+my %firmwares;
+{
+ my @firmwares = cat_($cache{firmwares});
+ if (!@firmwares) {
+ @firmwares = `urpmf --qf '%name-%version-%release.%arch:%files' /lib/firmware/ |sort -u`;
+ output($cache{firmwares}, @firmwares);
+ }
+ %firmwares = map { chomp; s!^(.*):/lib/firmware/!!; $_ => $1 } @firmwares;
+}
+
+#warn Data::Dumper->Dump([ \@modules ], [ 'modules' ]);
+warn Data::Dumper->Dump([ \%firmwares ], [ 'firmwares' ]) if $debug;
+
+# compute list of module that needs nonfree firmwares:
+my @non_free_fw_drivers;
+foreach (uniq(@modules)) {
+ my ($raw) = m!([^/]*)$!;
+ my $cache = $cache{modinfo} . $raw;
+ my @firmwares = cat_($cache);
+ # speedup: cache might exists but being empty:
+ if (!-e $cache) {
+ #warn ">> run '/sbin/modinfo $_ | grep firmware:'\n" if $debug;
+ @firmwares = `/sbin/modinfo $_ | grep firmware:`;
+ output($cache, @firmwares);
+ }
+ @firmwares = map { chomp; s/^.*:\s+//; $_ } @firmwares;
+ next if !@firmwares;
+ warn Data::Dumper->Dump([ \@firmwares ], [ 'firmware' ]) if $debug;
+ if (any { $firmwares{$_} && $firmwares{$_} =~ /nonfree/ } @firmwares) {
+ push @non_free_fw_drivers, $_;
+ #last;
+ }
+}
+
+# cleaning:
+@non_free_fw_drivers = sort map { s!.*/!!; s!\.ko.*$!!; $_ } @non_free_fw_drivers;
+
+#$Data::Dumper::Perltidy::ARGV = '-it=2 -l 100';
+#warn Dumper(\@non_free_fw_drivers) . "\n";
+
+# Pretty dump:
+my $sep = ' ';
+my $s = $sep . 'qw(' . join(' ', @non_free_fw_drivers) . ')';
+$s =~ s/(.{70}\S*)\s+/$1\n$sep/g;
+
+output('list_firmwares.pm',
+ "# generated using $kernel\n",
+ q(# This list is autogenerated ; Do NOT alter manually.
+
+package list_firmwares;
+
+our @modules_with_nonfree_firmware =
+),
+ $s, ";\n\n1;\n");
+
+
diff --git a/tools/gencryptofiles b/tools/gencryptofiles
deleted file mode 100755
index cfa11ee2b..000000000
--- a/tools/gencryptofiles
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/perl
-
-#- Mandriva cryptographic package hdlist and depslist generation tools.
-#- Copyright (C) 1999-2005 Mandriva (fpons@mandriva.com)
-#-
-#- This program is free software; you can redistribute it and/or modify
-#- it under the terms of the GNU General Public License as published by
-#- the Free Software Foundation; either version 2, or (at your option)
-#- any later version.
-#-
-#- This program is distributed in the hope that it will be useful,
-#- but WITHOUT ANY WARRANTY; without even the implied warranty of
-#- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#- GNU General Public License for more details.
-#-
-#- You should have received a copy of the GNU General Public License
-#- along with this program; if not, write to the Free Software
-#- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#- usage: gencryptofiles <crypto_dir>
-#- build an hdlist and depslist file for crypto, need rpmtools also.
-
-my %resolver = (
- '/bin/sh' => 'bash',
- '/bin/bash' => 'bash',
- '/usr/bin/perl' => 'perl',
- '/usr/bin/perl5' => 'perl',
-
- 'libBrokenLocale.so' => 'glibc',
- 'libICE.so' => 'XFree86-libs',
- 'libSM.so' => 'XFree86-libs',
- 'libX11.so' => 'XFree86-libs',
- 'libXext.so' => 'XFree86-libs',
- 'libXmu.so' => 'XFree86-libs',
- 'libXpm.so' => 'xpm',
- 'libXt.so' => 'XFree86-libs',
- 'libc.so.6' => 'glibc',
- 'libgdbm.so' => 'gdbm',
- 'libgpm.so' => 'gpm',
- 'libm.so' => 'glibc',
- 'libncurses.so' => 'ncurses',
- 'libnsl.so' => 'glibc',
- 'libpam.so' => 'pam',
- 'libpthread.so' => 'glibc',
- 'libreadline.so' => 'readline',
- 'libstdc++-libc6.1-2.so' => 'libstdc++',
- 'libstdc++.so' => 'libstdc++-compat',
- 'libutil.so' => 'glibc',
- 'libz.so' => 'zlib',
- 'smtpdaemon' => 'postfix',
- );
-
-sub gendepslist_crypto {
- my ($dir) = @_;
- my %depslist;
-
- #- get information about each rpm.
- local *DIR;
- opendir DIR, $dir or die "cannot open directory: $!\n";
- while ($_ = readdir DIR) {
- my ($key) = /(.*)\..*\.rpm$/ or next;
- my ($name) = /(.*)-[^-]*-[^-]*-/;
-
- my $size = `rpm -qp --queryformat="%{SIZE}" $dir/$_`;
- my @filelist = split "\n", `rpm -qpl $dir/$_`;
- my @requires = split "\n", `rpm -qpR $dir/$_`;
-
- $depslist{$key} = {
- key => $key,
- size => $size,
- filelist => \@filelist,
- requires => \@requires,
- deps => [],
- };
-
- foreach (@filelist) {
- $resolver{$_} = $name;
- m|.*/([^/]*)$| and $resolver{$1} = $name;
- }
- }
- close DIR;
-
- #- resolve the dependancies.
- foreach my $pkg (values %depslist) {
- foreach (@{$pkg->{requires}}) {
- $resolver{$_} and push(@{$pkg->{deps}}, $resolver{$_}), next;
- m|^([^\s\(]*)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next;
- m|^.*/([^/\s\(]*)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next;
- m|^([^\s\(]*\.so)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next;
- m|^.*/([^\s\(]*\.so)| and $resolver{$1} and push(@{$pkg->{deps}}, $resolver{$1}), next;
- m|^([\w-]*)(?:\s+.*)$| and push(@{$pkg->{deps}}, $1); #- last and default to package name.
- }
- }
-
- #- build depslist-crypto file.
- local *F;
- open F, ">$dir/depslist-crypto" or die "cannot open depslist-crypto file for writing: $!\n";
- foreach (values %depslist) {
- my %deps;
- @deps{@{$_->{deps}}} = ();
- print F "$_->{key} $_->{size} ", join(" ", keys %deps), "\n";
- }
- close F;
-}
-
-sub main {
- my ($dir) = @_;
- -d $dir or die "usage: gencryptofiles <crypto_dir>\n";
- -x "/usr/bin/genhdlist_cz2" or die "I need rpmtools to work (ie /usr/bin/genhdlist_cz2)\n";
-
- print `genhdlist_cz2 -o $dir/hdlist-crypto.cz2 $dir`;
- gendepslist_crypto($dir);
-}
-
-main(@ARGV);
diff --git a/tools/hd_grub.cgi b/tools/hd_grub.cgi
index a160d4c57..ac55b6eaf 100755
--- a/tools/hd_grub.cgi
+++ b/tools/hd_grub.cgi
@@ -31,7 +31,7 @@ sub menu_lst {
timeout 0
default 0
-title Mandriva Install
+title Mageia Install
root ($hd,$grub_partition_number)
kernel $directory/isolinux/alt0/vmlinuz $default_append $default_acpi $default_vga automatic=method:disk,partition:$hd_linux$partition_number,directory:$directory
@@ -60,7 +60,7 @@ sub print_form {
print
p(),
start_form(-name => 'form', -action => $cgi_name, -method => 'get'),
- ul("Please choose the partition where Mandrivalinux is copied.",
+ ul("Please choose the partition where %s is copied.",
li(popup_menu(-name => "hd", -default => 'hd0',
-values => [ 'hd0' .. 'hd3' ],
-labels => { hd0 => '1st BIOS hard drive (usually hda or sda)',
@@ -94,7 +94,7 @@ sub print_form {
})),
),
p(),
- ul("Please enter the directory containing the Mandrivalinux Distribution (relative to the partition chosen above)",
+ ul("Please enter the directory containing the %s Distribution (relative to the partition chosen above)",
li(textfield(-name => 'directory', -default => '/cooker/i586', size => 40)),
),
p(submit(-name => 'Go')),
diff --git a/tools/i386/busybox b/tools/i386/busybox
deleted file mode 100755
index cebd84853..000000000
--- a/tools/i386/busybox
+++ /dev/null
Binary files differ
diff --git a/tools/ia64/elilo.efi b/tools/ia64/elilo.efi
deleted file mode 100755
index 39151b8e3..000000000
--- a/tools/ia64/elilo.efi
+++ /dev/null
Binary files differ
diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list
index 5d43ac9eb..64c70b9c6 100755
--- a/tools/install-xml-file-list
+++ b/tools/install-xml-file-list
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+use FileHandle;
use MDK::Common;
use XML::Parser;
use Data::Dumper;
@@ -18,10 +19,12 @@ if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}
+my $verbose;
#$verbose = 1;
my $initial_dir = cwd();
my $ARCH = arch() =~ /i.86/ ? 'i386' : arch();
+$ARCH =~ s/^(arm).*/$1/;
my $LIB = arch() =~ /x86_64/ ? "lib64" : "lib";
my $base_cpio_options = '-pumd --quiet';
@@ -90,7 +93,7 @@ sub valid_cond {
sub add_to_env {
my ($env, $tag, $attr) = @_;
- my %env = map_each { $::a => +{%$::b} } %$env;
+ my %env = map_each { $::a => +{ %$::b } } %$env;
foreach (keys %$attr) {
!$env{$tag}{$_} or die qq(overriding attribute <$tag $_="$env{$tag}{$_}"> with $_="$attr->{$_}"\n);
$env{$tag}{$_} = $attr->{$_};
@@ -147,17 +150,17 @@ sub collect_needed_libraries {
@to_check = ();
}
}
-sub install_needed_libraries {
+sub install_needed_libraries() {
copy_files('', $DEST, [ keys %needed_libraries ], '', '--dereference');
}
sub collect_needed_perl_files {
- my ($local_rep, $dest, @scripts) = @_;
+ my ($local_rep, @scripts) = @_;
my (%local, %global);
foreach my $script (@scripts) {
foreach (`strace -efile perl -cw -I$local_rep $script 2>&1`) {
- my ($f) = /^open\("(.*?)",.*\)\s*=\s*\d+$/ or next;
+ my ($f) = /^open(?:at\([^,]*, |)"(.*?)",.*\)\s*=\s*\d+$/ or next;
if ($f =~ m!^\Q$local_rep\E/(.*)!) {
$local{$1} = 1;
} elsif (begins_with($f, '/dev/')) {
@@ -229,11 +232,11 @@ sub install {
@l = all_files_rec_($l[0]);
}
@l = grep { !m!/(\.svn|CVS)($|/)! } @l;
- if (my $re = $env->{from}{matching}) {
+ if (my $re = expand_macros($env->{from}{matching})) {
@l = grep { eval $re } @l;
}
- collect_needed_libraries(grep { -x $_ } @l);
+ collect_needed_libraries(grep { -f $_ && -x $_ } @l);
chdir $initial_dir;
@l;
@@ -257,7 +260,9 @@ sub install {
} elsif ($expand eq 'binary') {
$disallow_from_dir->();
- my @PATH = qw(/sbin /bin /usr/bin /usr/sbin /usr/X11R6/bin);
+ my @PATH = qw(/usr/sbin /usr/bin /usr/X11R6/bin);
+ unshift(@PATH, "/bin") unless -l "/bin";
+ unshift(@PATH, "/sbin") unless -l "/sbin";
foreach my $name (map { expand_macros($_) } @text_l) {
my @l = grep { -x $_ } map { "$_/$name" } @PATH;
@l or error("can't find binary $name"), next;
@@ -294,20 +299,28 @@ sub install {
push @files, @l;
}
+ } elsif ($expand eq 'perl-bin') {
+ $disallow_from_dir->();
+ $from_dir = '/usr/LIB/perl5/vendor_perl/';
+ @files = @text_l;
} elsif ($expand eq 'perl') {
$disallow_from_dir->();
- $from_dir = '/usr/lib/perl5/vendor_perl/*';
+ $from_dir = '/usr/share/perl5/vendor_perl/';
@files = @text_l;
} elsif ($expand eq 'main-perl') {
$disallow_from_dir->();
$from_dir = $Config{privlib};
@files = @text_l;
+ } elsif ($expand eq 'main-perl-bin') {
+ $disallow_from_dir->();
+ $from_dir = $Config{archlib};
+ @files = @text_l;
} elsif ($expand =~ /collect-perl-files/) {
my (undef, $local, $to) = split(' ', $expand);
@files = @text_l;
warn "collect-perl-files $local $to @files ($env->{filter}{command})\n";
- my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, $to, @files);
+ my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, @files);
warn "collect-perl-files gave: ", join(' ', @$local_perl_files), "\n";
# warn " and: ", join(' ', @$global_perl_files), "\n";
copy_and_filter($local =~ m!/! ? $local : "$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference');
@@ -349,15 +362,16 @@ sub apply_filter {
chdir $to_dir;
foreach (group_by_n(20, $all_files)) {
my @l = $b_flatten ? (map { basename($_) } @$_) : (map { "./$_" } @$_);
- @l = grep { ! -d $_ } @l;
+ @l = grep { ! -d $_ } @l or next;
if (my $subst = $filter->{subst}) {
+ warn "running substition $subst \n" if $verbose;
system('perl', '-pi', '-e', $subst, @l);
}
if (my $command = $filter->{command}) {
$command = $initial_dir . "/$command" if $command =~ m!^..?/!;
if ($command =~ /simplify-drakx-modules/) {
- @l = grep { !/\.so($|\.)/ } @l;
+ @l = grep { !/\.so($|\.)/ } @l or next;
}
my @options = (
if_($command eq 'gzip', '-9f'),
diff --git a/tools/mdkinst_stage2_tool b/tools/mdkinst_stage2_tool
index 8dc029e4e..0019ffc86 100755
--- a/tools/mdkinst_stage2_tool
+++ b/tools/mdkinst_stage2_tool
@@ -36,7 +36,10 @@ if [ $ACTION = "--compress" ]; then
[ -d "$LIVE_DIR" ] || error
echo "Creating $COMPRESSED_IMAGE from $LIVE_DIR"
rm -f $STAGE2_DIR/.room
- mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null
+ if ! mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null; then
+ echo "mksquashfs failed"
+ exit 1
+ fi
chmod 755 $COMPRESSED_IMAGE
echo foo > $STAGE2_DIR/.room
if [ -s $STAGE2_DIR/.room ]; then
@@ -48,23 +51,18 @@ if [ $ACTION = "--compress" ]; then
exit 1
fi
else
+ which unsquashfs >/dev/null 2>/dev/null || { echo "missing command unsquashfs (from squashfs-tools)"; exit 1; }
+
[ -f "$COMPRESSED_IMAGE" ] || error
echo "Creating $LIVE_DIR from $COMPRESSED_IMAGE"
- TMPDIR=${TMPDIR=/tmp}
- MNTPOINT=$TMPDIR/stage2_img
-
if [ $EUID != "0" ]; then
SUDO="sudo"
PATH="/sbin:/usr/sbin:$PATH"
fi
- $SUDO umount $MNTPOINT 2>/dev/null
- mkdir -p $MNTPOINT
- $SUDO mount -o loop -t squashfs $COMPRESSED_IMAGE $MNTPOINT || { echo "can not loopback mount $COMPRESSED_IMAGE"; exit 1; }
- mkdir $LIVE_DIR || { echo "not enough space"; exit 1; }
- cp -a $MNTPOINT/* $LIVE_DIR/ || { rm -rf $LIVE_DIR; exit 1; }
- $SUDO umount $MNTPOINT
+ unsquashfs -dest $LIVE_DIR $COMPRESSED_IMAGE || { rm -rf $LIVE_DIR; exit 1; }
+
[ -n "$CLEAN" ] && rm -f $COMPRESSED_IMAGE
fi
diff --git a/tools/ppc/README b/tools/ppc/README
deleted file mode 100644
index b752395c2..000000000
--- a/tools/ppc/README
+++ /dev/null
@@ -1,52 +0,0 @@
-Mini-Howto on burning Mandrake PPC Bootable CD's for Apple G3/G4 systems
--------------------------------------------------------------------------
-email: John Buswell <johnb@mandrakesoft.com>
-
-To create a disk image simply use the mkINSTALLCD script provided in this
-directory. The path you provide the script should point to the root directory
-for the CD.
-
-For example after you have built the gi install with /export, simply pass
-/export to the script as the distribution path and a name for the image.
-Once the image is built you can use hmount, humount, hdir, hcd and hattrib
-to modify and inspect the image before you commit it to CD-R.
-
-Before you run the script make sure the CD version of iBoot is in the
-iBoot directory below /export (eg. /export/iBoot), if you want to use some
-other directory then simply modify the script. Beware, HFS is not case
-sensitive, so if you already have an INSTALL file you cannot create install.
-
-Currently iBoot sports two trees, one for the install CD and another for
-regular usage. These will be merged shortly and a simply #define can be used
-in the Makefile to implement one or the other from a single binary.
-
-Enjoy!!
-
-
-Addendum: 3/15/2001 Stew Benedict <sbenedict@mandrakesoft.com>
---------------------------------------------------------------------------
-
-A couple of changes.
-
-I've opted to standardize on yaboot, which is user configurable, so the script
-is modified now to use yaboot.
-
-Secondly, since mkhybrid merged with mkisofs, the hybrid images it creates are
-read-only, so one is unable to mount the image and bless the boot directory for
-booting. Consequently, I've included the binary for mkhybrid-1.12b5.4, which
-does work.
-
-
-Addendum: 3/10/2005 Christiaan Welvaart <cjw@daneel.dyndns.org>
--------------------------------------------------------------------------
-
-10.1 and 10.2 ppc isos were generated with mkcd, with the following options
-added to the mkisofs call:
- -T --netatalk -hfs -probe -part -no-desktop \\
- -hfs-volid "$config->{disc}[$i]->{label}" \\
- -map /usr/share/mkcd/hfs_mapping \\
- -magic /usr/share/mkcd/hfs_magic \\
- -hide '*.MacOS' -hide '*.DOS' \\
- -hide-joliet '*.Unix' -hide-joliet '*.MacOS' \\
- -hide-hfs '*.Unix' -hide-hfs '*.DOS' \\
- '-hfs-bless' $builddir/$i/boot \\
diff --git a/tools/ppc/convert b/tools/ppc/convert
deleted file mode 100755
index a2622c630..000000000
--- a/tools/ppc/convert
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-mv $1.orig $1.Unix
-tr "\n" "\r" < $1.Unix > $1.MacOS
-perl -e '@line = <>; $line = join("\r\n", split(/\n/, join("", @line))); print $line; print "\r\n";' < $1.Unix > $1.DOS
diff --git a/tools/ppc/magic b/tools/ppc/magic
deleted file mode 100755
index 91f4193ea..000000000
--- a/tools/ppc/magic
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Example magic file for mkhybrid
-#
-# The "message" for the offset MUST be 4 characters for the CREATOR
-# and 4 characters for the TYPE - white space is optional between them.
-# Any other characters on this line are ignored. Continuation lines (starting
-# with '>') are also ignored i.e. only the initial offset lines are used.
-#
-# The continuation lines are given here, but they do not need to exist.
-
-#
-# James Pearson 20/5/98
-
-# Modified by Christian Walther, 2003/01/17:
-# changed gzip to StuffIt Expander
-# added perl & shell script
-
-# off type test message
-
-# GIF
-0 string GIF8 8BIM GIFf
->4 string 7a \b, version 8%s,
->4 string 9a \b, version 8%s,
->6 leshort >0 %hd x
->8 leshort >0 %hd,
-#>10 byte &0x80 color mapped,
-#>10 byte&0x07 =0x00 2 colors
-#>10 byte&0x07 =0x01 4 colors
-#>10 byte&0x07 =0x02 8 colors
-#>10 byte&0x07 =0x03 16 colors
-#>10 byte&0x07 =0x04 32 colors
-#>10 byte&0x07 =0x05 64 colors
-#>10 byte&0x07 =0x06 128 colors
-#>10 byte&0x07 =0x07 256 colors
-
-# JPEG images
-#
-0 ubeshort 0xffd8 8BIM JPEG image data
-
-# StuffIt
-#
-0 string SIT! SIT!SIT!
-
-# standard unix compress
-0 string \037\235 LZIV ZIVU
->2 byte&0x80 >0 block compressed
->2 byte&0x1f x %d bits
-
-# gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver)
-0 string \037\213 Gzip SITx gzip compressed data
->2 byte <8 \b, reserved method,
->2 byte 8 \b, deflated,
->3 byte &0x01 ASCII,
->3 byte &0x02 continuation,
->3 byte &0x04 extra field,
->3 byte &0x08 original filename,
->3 byte &0x10 comment,
->3 byte &0x20 encrypted,
->4 ledate x last modified: %s,
->8 byte 2 max compression,
->8 byte 4 max speed,
->9 byte =0x00 os: MS-DOS
->9 byte =0x01 os: Amiga
->9 byte =0x02 os: VMS
->9 byte =0x03 os: Unix
->9 byte =0x05 os: Atari
->9 byte =0x06 os: OS/2
->9 byte =0x07 os: MacOS
->9 byte =0x0A os: Tops/20
->9 byte =0x0B os: Win/32
-
-# Postscript
-0 string %! ASPSTEXT
->2 string PS-Adobe- conforming
->>11 string >\0 at level %.3s
->>>15 string EPS - type %s
->>>15 string Query - type %s
->>>15 string ExitServer - type %s
-# Some PCs have the annoying habit of adding a ^D as a document separator
-0 string \004%! ASPS TEXT PostScript document text
->3 string PS-Adobe- conforming
->>12 string >\0 at level %.3s
->>>16 string EPS - type %s
->>>16 string Query - type %s
->>>16 string ExitServer - type %s
-
-# scripts
-0 string #!/usr/bin/perl McPL TEXT
-0 string #!/bin/sh ttxt TEXT
diff --git a/tools/ppc/mapping b/tools/ppc/mapping
deleted file mode 100755
index a84b0019d..000000000
--- a/tools/ppc/mapping
+++ /dev/null
@@ -1,36 +0,0 @@
-# Example filename mapping file
-# Modified by Christian Walther, 2003/01/17
-#
-# EXTN XLate CREATOR TYPE Comment
-COPYING Ascii 'ttxt' 'ttro' "Text File"
-CREDITS Ascii 'ttxt' 'ttro' "Text File"
-README Ascii 'ttxt' 'ttro' "Text File"
-RPM-PGP-KEY Ascii 'ttxt' 'ttro' "Text File"
-VERSION Ascii 'ttxt' 'ttro' "Text File"
-.gz Raw 'SITx' 'Gzip' "GZip Compressed File"
-.sit Raw 'SIT!' 'SITD' "StuffIt Archive"
-.hqx Ascii 'SITx' 'TEXT' "BinHex Encoded File"
-.html Ascii 'MOSS' 'TEXT' "HTML File"
-.htm Ascii 'MOSS' 'TEXT' "HTML File"
-.gif Raw 'ogle' 'GIFf' "GIF Image"
-.jpg Raw 'ogle' 'JPEG' "JPEG Image"
-.tif Raw 'ogle' 'TIFF' "TIFF Image"
-.bz2 Raw 'SITx' 'Bzp2' "BZip2 Compressed File"
-.png Raw 'ogle' 'PNGf' "PNG Image"
-.rpm Raw 'mRPM' 'RPMf' "RPM Software Package"
-.pl Ascii 'McPL' 'TEXT' "Perl Script"
-.pl Ascii 'McPL' 'TEXT' "Perl Module"
-.doc Raw 'MSWD' 'WDBN' "Word file"
-.mov Raw 'TVOD' 'MooV' "QuickTime Movie"
-.txt Ascii 'ttxt' 'TEXT' "Text File"
-.conf Ascii 'ttxt' 'TEXT' "config file"
-.tbxi Raw 'chrp' 'tbxi' "Macintosh Toolbox ROM file"
-.sea Raw 'aust' 'APPL' "Self Expanding Archive"
-.mov Raw 'TVOD' 'MooV' "QuickTime Movie"
-.bin Raw 'ddsk' 'DDim' "Floppy or ramdisk image"
-.img Raw 'ddsk' 'DDim' "Floppy or ramdisk image"
-.b Raw 'UNIX' 'tbxi' "bootstrap"
-yaboot Raw 'UNIX' 'boot' "bootstrap"
-vmlinux Raw 'UNIX' 'boot' "bootstrap"
-.conf Raw 'UNIX' 'conf' "bootstrap"
-* Raw '????' '????' "Unknown"
diff --git a/tools/serial_probe/serial.c b/tools/serial_probe/serial.c
index c84cbcff5..5159c3dae 100644
--- a/tools/serial_probe/serial.c
+++ b/tools/serial_probe/serial.c
@@ -663,7 +663,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
unsigned char *endfield;
unsigned char *temppos;
unsigned char *pnp_string;
- unsigned char end_char;
int no_more_extensions=0;
int stage;
@@ -719,7 +718,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
/* setup end character we are looking for based on the start character */
if (start == p2) {
pnp_id->xlate_6bit = 1;
- end_char = EndPnP2;
/* we need to xlate data in PnP fields */
/* remember to skip the revision fields (bytes 1 and 2 after start) */
temppos=start;
@@ -734,7 +732,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
}
} else {
pnp_id->xlate_6bit = 0;
- end_char = EndPnP1;
}
/* move everything before the start of the PnP block */
@@ -881,7 +878,6 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
int fd;
int temp;
int pnp_strlen;
- int devicetype=-1;
unsigned char pnp_string[100];
char port[20];
struct termios origattr;
@@ -918,19 +914,11 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
maj = major(sb.st_rdev);
if (maj != 4 && (maj < 136 || maj > 143)) {
if (ioctl (fd, TIOCLINUX, &twelve) < 0) {
- #ifdef __powerpc__
- // we could have gotten an error for another reason - like EINVAL
- // skipping ttyS0 on PPC - which is where most modems reside
- if (errno == ENOTTY) {
- #endif
if (ioctl (fd, TIOCGSERIAL, &si) >= 0) {
if (si.line > 0) {
console = 1 << si.line;
} else {
console = 0;
- #ifdef __powerpc__
- }
- #endif
}
} else console = 0;
}
@@ -986,7 +974,6 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
/* try twiddling RS232 control lines and see if it talks to us */
- devicetype=-1;
pnp_strlen = 0;
if (attempt_pnp_retrieve( fd, pnp_string, &pnp_strlen,
sizeof(pnp_string) - 1 ) == PNP_COM_FATAL)
diff --git a/tools/x86_64/busybox b/tools/x86_64/busybox
deleted file mode 100755
index 07df11980..000000000
--- a/tools/x86_64/busybox
+++ /dev/null
Binary files differ