From 126777bc019a54afb4ec51299f2cf9d2841698aa Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 25 Apr 2007 12:26:16 +0000 Subject: re-sync after the big svn loss --- tools/.cvsignore | 4 -- tools/Makefile | 18 +----- tools/addchangelog.pl | 18 ------ tools/cvslog2changelog.pl | 139 ------------------------------------------ tools/drakx-in-chroot | 111 +++++++++++++++++++++------------ tools/install-xml-file-list | 71 +++++++++++++-------- tools/mailchangelog.pl | 14 ----- tools/mdkinst_stage2_tool | 59 +++++++++++++----- tools/patch_pcmcia_config.pl | 28 --------- tools/serial_probe/.cvsignore | 1 - tools/update_images | 52 ---------------- 11 files changed, 164 insertions(+), 351 deletions(-) delete mode 100644 tools/.cvsignore delete mode 100755 tools/addchangelog.pl delete mode 100755 tools/cvslog2changelog.pl delete mode 100755 tools/mailchangelog.pl delete mode 100755 tools/patch_pcmcia_config.pl delete mode 100644 tools/serial_probe/.cvsignore delete mode 100755 tools/update_images (limited to 'tools') diff --git a/tools/.cvsignore b/tools/.cvsignore deleted file mode 100644 index 88754bc8b..000000000 --- a/tools/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -rpm2header -gendepslist -xhost+ -rpcinfo-flushed diff --git a/tools/Makefile b/tools/Makefile index 44d15cb30..669b6f987 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,6 +1,3 @@ -include ../Makefile.config - -RPMS = $(wildcard $(MAIN_RPMS_DIR)/*.rpm) DIRS = serial_probe CFLAGS = -Wall @@ -13,23 +10,14 @@ endif .PHONY: clean install $(DIRS) -all: $(DIRS) xhost+ rpcinfo-flushed install +all: $(DIRS) xhost+ rpcinfo-flushed $(DIRS): make -C $@ install: - @install -d $(MISC_DEST)/auto $(MISC_DEST)/Distribconf - @install mdkinst_stage2_tool drakx-in-chroot $(MISC_DEST) - cp -rf `perldoc -l packdrake` $(MISC_DEST) || { echo "install packdrake first!" ; exit 1; } - cp -rf `perldoc -l Packdrakeng` $(MISC_DEST) || { echo "install packdrake first!" ; exit 1; } - cp -rf `perldoc -l Distribconf` $(MISC_DEST) || { echo "install rpmtools first!" ; exit 1; } - cp -rf `perldoc -l Distribconf::Build` $(MISC_DEST)/Distribconf || { echo "install rpmtools first!" ; exit 1; } - @cp -rf `perldoc -l URPM | sed s/URPM.pm//`URPM* $(MISC_DEST) || { echo "install perl-URPM first!" ; exit 1; } - @cp -rf `perldoc -l URPM | sed s/URPM.pm//`auto/URPM $(MISC_DEST)/auto || { echo "install perl-URPM first!" ; exit 1; } - @cd /usr/bin ; install packdrake $(MISC_DEST) || { echo "packdrake is missing"; exit 1; } - @cd /usr/bin ; install gendistrib rpm2header $(MISC_DEST) || { echo "install rpmtools first!" ; exit 1; } - @mkdir -p $(STAGE2_LIVE)/usr/bin + install -d $(ROOTDEST)/misc + install mdkinst_stage2_tool drakx-in-chroot $(ROOTDEST)/misc xhost+: %: %.c $(CC) $(CFLAGS) $< -L/usr/X11R6/$(LIB_NAME) -lX11 -o $@ diff --git a/tools/addchangelog.pl b/tools/addchangelog.pl deleted file mode 100755 index 8e39802a6..000000000 --- a/tools/addchangelog.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl - -@ARGV == 1 or die "usage $0: \n"; - -($script) = @ARGV; - -$date = (split('/', `grep ChangeLog perl-install/CVS/Entries`))[3]; - -@changelog = `(cvs log -d ">$date" docs mdk-stage1 rescue tools ; cd perl-install; cvs log -d ">$date") | $script`; -@before = `cat perl-install/ChangeLog`; - -open F, ">perl-install/ChangeLog"; -print F foreach @changelog, @before; - -`cvs commit -m '' perl-install/ChangeLog` =~ /new revision: (.*?);/; - -print "$1\n"; -print foreach @changelog; diff --git a/tools/cvslog2changelog.pl b/tools/cvslog2changelog.pl deleted file mode 100755 index cecebe87f..000000000 --- a/tools/cvslog2changelog.pl +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/perl - -my %l; -{ -my ($date, $user, $file); -local $_; -while (<>) { - if (my $e = /^description:/ .. /^={77}/) { - next if $e == 1 || $e =~ /E0/; - if (/^-{28}/ .. /^date: /) { - if (/^date: (\S+)\s.*author: (\S+);/) { - ($date, $user) = ($1, $2); - } - } elsif (!/^branches: / && !/file .* was initially added on branch/ && !/empty log message/ && !/no_comment/) { - $l{$date}{$user}{$file} .= $_; - } - } elsif (/Working file: (.*)/) { - $file = $1; - } -} -} - - -my %users; -foreach my $date (reverse sort keys %l) { - foreach my $user (sort keys %{$l{$date}}) { - next if $ENV{AUTHOR} && $ENV{AUTHOR} ne $user; - - my $fuser = $users{$user} || $user; - print "$date $fuser\n\n"; - my %inv; - while (my ($file, $log) = each %{$l{$date}{$user}}) { - $log =~ s/^\s+( \*)?//ms; - $log =~ s/\s+$//ms; - $log = "\n$log" if $log =~ /^-/; - push @{$inv{$log}}, $file; - } - foreach my $log (keys %inv) { - my $line = join(', ', @{$inv{$log}}) . ($log !~ /^\(/ && ':') . " $log"; - print "\t* ", join("\n\t", auto_fill($line, 72)), "\n\n"; - } - } -} - -1; - -sub auto_fill { - my ($line, $col) = @_; - map { - my @l; - my $l = ''; - $_ = " $_" if /^-/; - while ($_) { - s/^(\s*)(\S*)//; - my $m = "$l$1$2"; - if (length $m > $col) { - push @l, $l; - $l = $2; - } else { - $l = $m - } - } - @l, $l; - } split("\n", $line); -} - -BEGIN { - %users = ( - 'abiro' => 'Arpad Biro ', - 'adelorbeau' => 'Arnaud de Lorbeau ', - 'adesmons' => 'Arnaud Desmons', - 'aginies' => 'Antoine Ginies ', - 'alafox' => 'Alice Lafox ', - 'alemaire' => 'Aurélien Lemaire', - 'alus' => 'Arkadiusz Lipiec ', - 'amaury' => 'Amaury Amblard-Ladurantie', - 'baudens' => 'David Baudens ', - 'camille' => 'Camille Bégnis ', - 'cbelisle' => 'Christian Belisle', - 'chmou' => 'Chmouel Boudjnah', - 'chmouel' => 'Chmouel Boudjnah', - 'croy' => 'Christian Roy ', - 'damien' => 'dam\'s ', - 'daouda' => 'Daouda Lo ', - 'dchaumette' => 'Damien Chaumette ', - 'dindinx' => 'David odin', - 'drdrake' => 'Dovix ', - 'erwan' => 'Erwan Velu ', - 'fabman' => 'Fabian Mandelbaum ', - 'fcrozat' => 'Frederic Crozat ', - 'flepied' => 'Frederic Lepied ', - 'florin' => 'Florin Grad ', - 'fpons' => 'Fançois Pons', - 'fred' => 'Frederic Bastok', - 'fwang' => 'Funda Wang ', - 'gb' => 'Gwenole Beauchesne ', - 'gbeauchesne' => 'Gwenole Beauchesne ', - 'gc' => 'Guillaume Cottenceau ', - 'hilbert' => '(Hilbert) ', - 'install' => 'DrakX ', - 'jdanjou' => 'Julien Danjou', - 'jjorge' => 'José JORGE ', - 'jpomerleau' => 'Joel Pomerleau', - 'keld' => 'Keld Jørn Simonsen ', - 'lmontel' => 'Laurent Montel ', - 'mscherer' => 'Michael Scherer ', - 'nplanel' => 'Nicolas Planel ', - 'oblin' => 'Olivier Blin ', - 'othauvin' => 'Olivier Thauvin ', - 'pablo' => 'Pablo Saratxaga ', - 'peroyvind' => 'Per Øyvind Karlsen ', - 'phetroy' => 'Philippe Libat', - 'philippe' => 'Philippe Libat', - 'prigaux' => 'Pixel ', - 'quintela' => 'Juan Quintela ', - 'rchaillat' => 'Renaud Chaillat', - 'rdalverny' => 'Romain d\'Alverny ', - 'redhog' => 'RedHog', - 'reinouts' => 'Reinout van Schouwen ', - 'rgarciasuarez' => 'Rafael Garcia-Suarez ', - 'rvojta' => 'Robert Vojta ', - 'sbenedict' => 'Stew Benedict ', - 'sdetilly' => 'Sylvain de Tilly', - 'siegel' => 'Stefan Siegel ', - 'tbacklund' => 'Thomas Backlund ', - 'tkamppeter' => 'Till Kamppeter ', - 'tpittich' => 'Tibor Pittich ', - 'tsdgeos ' => 'Albert Astals Cid ', - 'tv' => 'Thierry Vignaud ', - 'tvignaud' => 'Thierry Vignaud ', - 'uid524' => 'Chmouel Boudjnah', - 'vdanen' => 'Vincent Danen ', - 'vguardiola' => 'Vincent Guardiola ', - 'warly' => 'Warly ', - 'yduret' => 'Yves Duret', - 'yoann' => 'Yoann Vandoorselaere', - 'yrahal' => 'Youcef Rabah Rahal ', - ); -} diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot index 822076ed9..da1a45eca 100644 --- a/tools/drakx-in-chroot +++ b/tools/drakx-in-chroot @@ -7,14 +7,16 @@ my $SLASH_LOCATION = '/tmp/drakx-in-chroot'; my $verbose = 0; my $prefix_ROOTED = '/mnt'; my $IMAGE_LOCATION_ROOTED = '/tmp/image'; +my $MEDIA_LOCATION_ROOTED = '/tmp/media'; my $STAGE2_LOCATION_ROOTED = '/tmp/stage2'; my $LIVE_LOCATION_REL = 'install/stage2/live/'; -my $CLP_LOCATION_REL = 'install/stage2/'; -my $CLP_FILE_REL = $CLP_LOCATION_REL . 'mdkinst.clp'; -my $AUTO_INSTALL_ROOTED = '/tmp/drakx-in-chroot.cfg.pl'; +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'; -@ARGV >= 2 or die "usage: drakx-in-chroot [options]\n"; +@ARGV >= 2 or die "usage: drakx-in-chroot [options]\n"; (my $repository, my $dir, @ARGV) = @ARGV; my $STAGE2_LOCATION = $SLASH_LOCATION . $STAGE2_LOCATION_ROOTED; @@ -28,41 +30,55 @@ if ($>) { undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files if (-d $SLASH_LOCATION) { - umount_all() == 0 or die "$SLASH_LOCATION is busy\n"; + umount_all() == 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', $STAGE2_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED, $prefix_ROOTED; +mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/dev/usb', '/etc', '/var', '/proc', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED; sys("$sudo rm -rf $dir") if $ENV{CLEAN}; -e $dir or sys("$sudo mkdir -p $dir"); copy_auto_install_files(); -if (-d "$repository/$LIVE_LOCATION_REL") { +my $remote_repository = $repository =~ m!^(ftp|http)://! && $1; +if ($remote_repository) { + my $local_mdkinst = "$SLASH_LOCATION/tmp/mdkinst.sqfs"; + 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"); -} elsif (-e "$repository/$CLP_FILE_REL") { - my $dev = find_free_loop(); - sys("$sudo modprobe gzloop"); - sys("$sudo losetup -r -e gz $dev $repository/$CLP_FILE_REL"); - sys("$sudo mount -r $dev $STAGE2_LOCATION"); +} 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$IMAGE_LOCATION_ROOTED"); +sys("$sudo mount -o bind $repository $SLASH_LOCATION$MEDIA_LOCATION_ROOTED") if !$remote_repository; sys("$sudo mount -t proc none $SLASH_LOCATION/proc"); +symlinkf('media', "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); create_initial_symlinks(); create_initial_devices(); +apply_stage2_updates(); + output("$SLASH_LOCATION/etc/hosts", "127.0.0.1 localhost\n") if ! -e "$SLASH_LOCATION/etc/hosts"; +#- in the chroot, we have no way to know which device corresponds to the "/" partition. +#- so helping it by giving the device which provide major/minor information +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); + my $Xnest_pid; -if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && whereis_binary('Xnest')) { +my $Xnest_bin = find { whereis_binary($_) } 'Xnest', 'Xephyr'; +if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && $Xnest_bin) { my $DISPLAY = ':8'; $Xnest_pid = fork(); if (!$Xnest_pid) { - exec 'Xnest', $DISPLAY, '-ac', '-geometry', '800x600' or die "Xnest failed\n"; + exec $Xnest_bin, $DISPLAY, '-ac', ($Xnest_bin eq 'Xephyr' ? '-screen' : '-geometry'), '800x600' or die "Xnest failed\n"; } $ENV{DISPLAY} = 'localhost' . $DISPLAY; } @@ -72,26 +88,26 @@ if (my $pid = fork()) { umount_all() == 0 or warn "umounting failed\n"; $Xnest_pid and kill 15, $Xnest_pid; } 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'; - my $cmd = join(' ', "/usr/bin/runinstall2 --local_install", @ARGV); + if ($remote_repository) { + $ENV{URLPREFIX} = $repository; + } + my $cmd = join(' ', "/usr/bin/runinstall2 --local_install", + if_($remote_repository, "--method $remote_repository"), + @ARGV); exec "$sudo chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n"; } sub system_verbose { warn join(' ', @_), "\n" if $verbose; system(@_) } sub sys { &system_verbose; $? and die qq(running "@_" failed: $?\n) } -sub find_free_loop() { - foreach (0..255) { - my $dev = "/dev/loop$_"; - system("$sudo losetup $dev >/dev/null 2>&1") != 0 or next; - warn "found free loop $dev\n"; - return $dev; - } - die "no free loop found"; +sub mount_mdkinst { + my ($mdkinst) = @_; + sys("$sudo mount -t squashfs -o loop,ro $mdkinst $STAGE2_LOCATION"); } - sub create_initial_symlinks() { foreach (cat_or_die("$STAGE2_LOCATION/usr/share/symlinks")) { my ($from, $to_) = split; @@ -104,16 +120,14 @@ sub create_initial_symlinks() { } sub create_initial_devices() { - foreach (cat_or_die("$STAGE2_LOCATION/usr/share/devices")) { - my ($node, $type, $major, $minor) = split; - sys("$sudo mknod $SLASH_LOCATION$node $type $major $minor") if ! -e "$SLASH_LOCATION$node"; - } + sys("$sudo cp -a /dev/{mem,null} $SLASH_LOCATION/dev"); } sub umount_all() { my $err; + clean_stage2_updates(); my @procs = ('/proc/bus/usb', '/proc', '/sys'); - foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) { + foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) { my $dir = "$SLASH_LOCATION$_"; rmdir $dir; if (-d $dir) { @@ -121,9 +135,7 @@ sub umount_all() { system_verbose "$sudo umount $dir 2>/dev/null"; next; } - my ($loop) = cat_('/proc/mounts') =~ m!^(/dev/loop\d+) .*\Q$dir\E !m; system_verbose "$sudo umount $dir"; - sys("$sudo losetup -d $loop") if $loop; } rmdir $dir; if (-d $dir) { @@ -131,26 +143,47 @@ sub umount_all() { $err++; } } + if (my @remaining = cat_('/proc/mounts') =~ m!($SLASH_LOCATION/mnt/\S+)!g) { + warn "umount those mount points first: ", join(' ', @remaining), "\n"; + $err++; + } $err; } sub copy_auto_install_files() { my ($opt); - my ($auto_install, $defcfg); each_index { if ($opt eq 'auto_install' && -f $_) { - $auto_install = $_; + cp_f($_, $SLASH_LOCATION . $AUTO_INSTALL_ROOTED); $_ = $AUTO_INSTALL_ROOTED; } elsif ($opt eq 'defcfg' && -f $_) { - $defcfg = $_; - $ARGV[$::i-1] = $ARGV[$::i] = undef; + cp_f($_, $SLASH_LOCATION . $DEFCFG_ROOTED); + $_ = $DEFCFG_ROOTED; } elsif ($opt eq 'rpmsrate' && -f $_) { cp_f($_, $SLASH_LOCATION . $RPMSRATE_ROOTED); } undef $opt; /^--?(.*)/ and $opt = $1; } @ARGV; - #- contatenate auto_install and defcfg files into a new auto_install file in install root - my @auto_inst = grep { -f $_ } $auto_install, $defcfg; - output($SLASH_LOCATION . $AUTO_INSTALL_ROOTED, map { cat_($_) } @auto_inst) if @auto_inst; +} + +my @stage2_updates; +sub apply_stage2_updates() { + each_index { + if ($_ eq '--stage2-update') { + my $file = $ARGV[$::i+1]; + my $dest = $ARGV[$::i+2]; + if (-f $file && $dest) { + undef $_; + undef $ARGV[$::i+1]; + undef $ARGV[$::i+2]; + push @stage2_updates, $dest; + sys("$sudo mount --bind $file $STAGE2_LOCATION/$dest"); + } + } + } @ARGV; +} + +sub clean_stage2_updates() { + sys("$sudo umount $STAGE2_LOCATION/$_") foreach @stage2_updates; } diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list index 388e03ee5..5d43ac9eb 100755 --- a/tools/install-xml-file-list +++ b/tools/install-xml-file-list @@ -3,6 +3,7 @@ use MDK::Common; use XML::Parser; use Data::Dumper; +use File::Glob; use Config; use Cwd 'cwd'; @@ -25,6 +26,7 @@ my $LIB = arch() =~ /x86_64/ ? "lib64" : "lib"; my $base_cpio_options = '-pumd --quiet'; +my $problem; my $tree = XML::Parser->new(Style => 'Tree')->parsefile($xml_file_list); my $main_node = decompose($tree); @@ -33,13 +35,21 @@ $main_node->{tag} eq 'list' or die "bad file $xml_file_list (main tag should be handle_nodes({}, $main_node); +$problem and exit 1; + install_needed_libraries(); final_cleanup(); +sub error { + my ($err) = @_; + warn "FATAL: $err\n"; + $problem = 1; +} + sub final_cleanup() { #- cpio creates directory 700, that's not nice - system("find $DEST -type d | xargs $sudo chmod 755"); + system("find $DEST -type d -print0 | xargs -0 $sudo chmod 755"); } sub handle_nodes { @@ -130,7 +140,7 @@ sub collect_needed_libraries { foreach (@l) { if ($main_node->{attr}{'no-arch-libraries'}) { #- replace /lib/tls or /lib/i686 with /lib - s!^(/lib(64)?/).*?/!$1!; + s!^(/lib(64)?/).*?/!$1! if arch() !~ /x86_64/; } } @to_check = grep { !$needed_libraries{$_}++ } @l; @@ -155,7 +165,7 @@ sub collect_needed_perl_files { } elsif (begins_with($f, '/')) { if ($main_node->{attr}{'no-arch-libraries'}) { #- replace /lib/tls or /lib/i686 with /lib - $f =~ s!^(/lib(64)?/).*?/!$1!; + $f =~ s!^(/lib(64)?/).*?/!$1! if arch() !~ /x86_64/; } $global{$f} = 1; } @@ -176,7 +186,7 @@ sub copy_files { } } else { my $options = join(' ', $base_cpio_options, @options); - warn "cpio $options to_dir $to_dir from $working_dir: @$files\n" if $verbose; + warn "cpio $options to_dir=$to_dir from=$working_dir: @$files\n" if $verbose; open(my $F, "| cd $working_dir ; $sudo cpio $options $to_dir"); print $F "$_\n" foreach @$files; close($F) or die "cpio $to_dir failed\n"; @@ -203,16 +213,22 @@ sub install { my @l = $f; chdir $working_dir; if ($f =~ /\*/ || $b_full_glob) { - @l = glob($f) or die "no match for $f\n"; - - @l == 1 || $b_full_glob or die "multiple match for $f\n"; - } else { - -e $f or die "missing file $f ($rel) in $working_dir\n"; + @l = File::Glob::bsd_glob($f); #- using bsd_glob because CORE::glob() splits on whitespace and we don't want this + if (@l == 0) { + error("no match for $f"); + } elsif (@l == 1 || $b_full_glob) { + } else { + error("multiple match for $f"); + @l = (); + } + } elsif (! -e $f) { + error("missing file $f ($rel) in $working_dir"); + @l = (); } if (@l == 1 && -d $l[0] && $b_recursive_dirs) { @l = all_files_rec_($l[0]); } - @l = grep { !m!/CVS($|/)! } @l; + @l = grep { !m!/(\.svn|CVS)($|/)! } @l; if (my $re = $env->{from}{matching}) { @l = grep { eval $re } @l; } @@ -223,10 +239,12 @@ sub install { @l; }; + my @text_l = $env->{from}{spaces_in_filename} ? $text =~ /^\s*(.*?)\s*$/ : split(' ', $text); my @files; if ($expand eq 'tar') { - foreach (split(' ', $text)) { - system('tar', 'xfj', $from_file->($_), '-C', $to_dir); + foreach (@text_l) { + my ($tarball) = $from_file->($_) or next; + system('tar', 'xfj', $tarball, '-C', $to_dir); } # not filling @files, things are already done @@ -235,14 +253,14 @@ sub install { } elsif ($expand eq 'glob') { #- glob done in $from_file - @files = split(' ', $text); + @files = @text_l; } elsif ($expand eq 'binary') { $disallow_from_dir->(); my @PATH = qw(/sbin /bin /usr/bin /usr/sbin /usr/X11R6/bin); - foreach my $name (map { expand_macros($_) } split(' ', $text)) { + foreach my $name (map { expand_macros($_) } @text_l) { my @l = grep { -x $_ } map { "$_/$name" } @PATH; - @l or die "can't find binary $name\n"; + @l or error("can't find binary $name"), next; if (@l > 1) { my @m = grep { ! -l $_ } @l; if (@m == 1) { @@ -257,6 +275,7 @@ sub install { my $f = $l[0]; while (1) { push @files, $f; + $copy_mode ne 'dereference' or last; my $l = readlink($f) or last; if ($l =~ m!/! && $l !~ m!^\.\..*/s?bin/[^/]+$!) { warn "keeping symlink $f -> $l as is\n"; @@ -264,40 +283,40 @@ sub install { } $f = dirname($f) . '/' . $l; } - } - $copy_mode = 'keep-links'; + } + $copy_mode ||= 'keep-links'; $env->{filter}{command} ||= 'strip'; } elsif ($expand eq 'rpm') { $disallow_from_dir->(); - foreach my $rpm (split(' ', $text)) { - my @l = chomp_(`rpm -ql $rpm`) or die "rpm $rpm must be installed\n"; + foreach my $rpm (@text_l) { + my @l = chomp_(`rpm -ql $rpm`) or error("rpm $rpm must be installed"); push @files, @l; } } elsif ($expand eq 'perl') { $disallow_from_dir->(); $from_dir = '/usr/lib/perl5/vendor_perl/*'; - @files = split(' ', $text); + @files = @text_l; } elsif ($expand eq 'main-perl') { $disallow_from_dir->(); $from_dir = $Config{privlib}; - @files = split(' ', $text); + @files = @text_l; } elsif ($expand =~ /collect-perl-files/) { my (undef, $local, $to) = split(' ', $expand); - @files = split(' ', $text); + @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); warn "collect-perl-files gave: ", join(' ', @$local_perl_files), "\n"; # warn " and: ", join(' ', @$global_perl_files), "\n"; - copy_and_filter("$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference'); + copy_and_filter($local =~ m!/! ? $local : "$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference'); copy_and_filter('', $DEST, $global_perl_files, $env->{filter}, '', '--dereference'); } elsif ($expand) { die "unknown expand method $expand\n"; } else { - @files = split(' ', $text); + @files = @text_l; $env->{filter}{command} ||= 'strip' if $to_dir =~ m!/bin$!; } @@ -312,7 +331,9 @@ sub install { my @options = ( if_($copy_mode ne 'keep-links', '--dereference'), ); - copy_and_filter($working_dir, $to_dir, \@all_files, $env->{filter}, $env->{to}{flatten}, @options); + if (@all_files) { + copy_and_filter($working_dir, $to_dir, \@all_files, $env->{filter}, $env->{to}{flatten}, @options); + } } sub copy_and_filter { diff --git a/tools/mailchangelog.pl b/tools/mailchangelog.pl deleted file mode 100755 index de130bd69..000000000 --- a/tools/mailchangelog.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -open F, '|/usr/sbin/sendmail -oi -t'; - -chomp($ver = ); - -print F -q(Subject: [DrakX] DrakX snapshot #), $ver, q( uploaded -From: DrakX Builder Robot -To: changelog@mandrivalinux.org -Reply-To: install@mandriva.com - -); -print F foreach ; diff --git a/tools/mdkinst_stage2_tool b/tools/mdkinst_stage2_tool index f383cdf1c..8dc029e4e 100755 --- a/tools/mdkinst_stage2_tool +++ b/tools/mdkinst_stage2_tool @@ -1,29 +1,55 @@ #!/bin/sh -[ $# != 1 ] && { - echo "usage: mdkinst_stage2_tool " ; - echo " example: misc/mdkinst_stage2_tool install/stage2" - exit +error() { + cat < [] +EOF + exit 1 } -STAGE2_DIR="$1" -LIVE_DIR="$STAGE2_DIR/live" -CLP="$STAGE2_DIR/mdkinst.clp" +if [ "$1" = "--clean" ]; then + CLEAN=1 + shift +fi + +[ $# = 2 -o $# = 3 ] || error -if [ -d $LIVE_DIR ]; then - echo "Creating $CLP from $LIVE_DIR" +if [ "$1" = "--compress" -o "$1" == "--uncompress" ]; then + ACTION=$1 + shift + STAGE2_DIR="$1" + shift + LIVE_DIR="$STAGE2_DIR/live" + if [ -n "$1" ]; then + COMPRESSED_IMAGE=$1 + shift + else + COMPRESSED_IMAGE="$STAGE2_DIR/mdkinst.sqfs" + fi +else + error +fi + +if [ $ACTION = "--compress" ]; then + which mksquashfs >/dev/null 2>/dev/null || { echo "missing command mksquashfs (from squashfs-tools)"; exit 1; } + + [ -d "$LIVE_DIR" ] || error + echo "Creating $COMPRESSED_IMAGE from $LIVE_DIR" rm -f $STAGE2_DIR/.room - mkisofs -quiet -D -R $LIVE_DIR | create_compressed_fs - 65536 $CLP 200 2>/dev/null + mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null + chmod 755 $COMPRESSED_IMAGE echo foo > $STAGE2_DIR/.room if [ -s $STAGE2_DIR/.room ]; then - rm -rf $LIVE_DIR $STAGE2_DIR/.room + rm -f $STAGE2_DIR/.room + [ -n "$CLEAN" ] && rm -rf $LIVE_DIR else echo "not enough space" - rm -f $CLP + rm -f $COMPRESSED_IMAGE exit 1 fi else - echo "Creating $LIVE_DIR from $CLP" + [ -f "$COMPRESSED_IMAGE" ] || error + echo "Creating $LIVE_DIR from $COMPRESSED_IMAGE" TMPDIR=${TMPDIR=/tmp} MNTPOINT=$TMPDIR/stage2_img @@ -35,10 +61,11 @@ else $SUDO umount $MNTPOINT 2>/dev/null mkdir -p $MNTPOINT - extract_compressed_fs $CLP > $CLP.iso 2>/dev/null + $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; } - $SUDO mount -o loop $CLP.iso $MNTPOINT || { echo "can not loopback mount $CLP"; exit 1; } cp -a $MNTPOINT/* $LIVE_DIR/ || { rm -rf $LIVE_DIR; exit 1; } $SUDO umount $MNTPOINT - rm -f $CLP.iso $CLP + [ -n "$CLEAN" ] && rm -f $COMPRESSED_IMAGE fi + +exit 0 diff --git a/tools/patch_pcmcia_config.pl b/tools/patch_pcmcia_config.pl deleted file mode 100755 index 6e8614cc0..000000000 --- a/tools/patch_pcmcia_config.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl - -use MDK::Common; - -listlength(@ARGV) == 2 or die "usage: $0 /path/to/etc/pcmcia/config /path/to/modules.dep\n"; - -my ($pcmcia_config, $modules_dep) = @ARGV; - - -my @ignore_modules_in_deps = qw(pcmcia_core pcmcia ds); - -my @conf_contents = cat_($pcmcia_config); -die "uhm, problem, <$pcmcia_config> seems short in lines\n" if listlength(@conf_contents) < 10; - -foreach (cat_($modules_dep)) { - /^(\S+): (.*)/ and $deps{$1} = [ split ' ', $2 ] or die "could not understand `$_' in <$modules_dep>\n"; -} - -foreach my $confline (@conf_contents) { - $confline =~ /class.*\s+module\s+(.*)/ or next; - my @modules = map { /"([^"]+)"(.*)/ && [ $1, $2 ] } split ',', $1; - $_->[0] =~ s|.*/([^/]+)$|$1|g foreach @modules; #- remove directories since we don't support that during install - my @deps = grep { !member($_, @ignore_modules_in_deps, map { $_->[0] } @modules) } map { @{$deps{$_->[0]}} } @modules; - my $new_modz = join ', ', (map { "\"$_\"" } @deps), (map { "\"$_->[0]\"$_->[1]" } @modules); - $confline =~ s/(class.*\s+module\s+).*/$1$new_modz/; -} - -output($pcmcia_config, @conf_contents); diff --git a/tools/serial_probe/.cvsignore b/tools/serial_probe/.cvsignore deleted file mode 100644 index e8e3e2d94..000000000 --- a/tools/serial_probe/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -serial_probe diff --git a/tools/update_images b/tools/update_images deleted file mode 100755 index 1cc5ea533..000000000 --- a/tools/update_images +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl - -@ARGV == 3 or die "Usage: $0 filename.img imagetype path_to_mar_bin\n ex. $0 cdrom-changedisk.img cdrom\n\nPut the old images (*.img), new vmlinuz, new modules.dep and new *.mar files in a fresh directory, and update each image file one by one."; - -$file = $ARGV[0]; -$img = $ARGV[1]; -$marbin = $ARGV[2]; - -sub __ { print @_, "\n"; system(@_); } -sub _ { __ @_; $? and die; } - -$topdir = '/tmp/updimg'; - -print "Updating boot image file $file of type $img\n"; - -_ "rm -rf $topdir"; -_ "mkdir $topdir"; - -_ "mkdir $topdir/img"; -_ "mount -o loop $file $topdir/img"; - -$rdz = glob("$topdir/img/*.rdz"); -$rdz or die "Could not glob rdz file in $topdir/img/*.rdz\n"; - -_ "zcat $rdz > /tmp/meuh"; -_ "mkdir $topdir/initrd"; -_ "mount -o loop /tmp/meuh $topdir/initrd"; - -print "\n\tOld sizes:\n"; -print `ls -l $topdir/img/vmlinuz`; -print `ls -l $topdir/initrd/modules/modules.mar`; -system("df $topdir/img"); -print "\n"; - -_ "cp -f vmlinuz $topdir/img/vmlinuz"; -system("$marbin -l $topdir/initrd/modules/modules.mar | sort > $topdir/oldmar"); -system("$marbin -l ${img}_modules.mar | sort > $topdir/newmar"); -_ "cp -f ${img}_modules.mar $topdir/initrd/modules/modules.mar"; -_ "cp -f modules.dep $topdir/initrd/modules/modules.dep"; - -_ "umount $topdir/initrd"; -_ "gzip -c /tmp/meuh > $rdz"; - -print "\n\tNew sizes:\n"; -print `ls -l vmlinuz`; -print `ls -l ${img}_modules.mar`; -system("df $topdir/img"); -print "\nDiff from old to new marfiles:\n"; -print `diff -u $topdir/oldmar $topdir/newmar`; -print "\n"; - -_ "umount $topdir/img"; -- cgit v1.2.1