diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-12-12 21:01:03 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-12-12 21:01:03 +0000 |
commit | 9cd385d3256ba63e6cf6e7c5802647b443642922 (patch) | |
tree | d2d8eef1b85985fedc5d8b23758bb347d3d145f9 | |
parent | 7686b403bdc5b3de0a00decccecf28af0e7c1b54 (diff) | |
download | drakx-backup-do-not-use-9cd385d3256ba63e6cf6e7c5802647b443642922.tar drakx-backup-do-not-use-9cd385d3256ba63e6cf6e7c5802647b443642922.tar.gz drakx-backup-do-not-use-9cd385d3256ba63e6cf6e7c5802647b443642922.tar.bz2 drakx-backup-do-not-use-9cd385d3256ba63e6cf6e7c5802647b443642922.tar.xz drakx-backup-do-not-use-9cd385d3256ba63e6cf6e7c5802647b443642922.zip |
externalize patch_pcmcia_config (from make_boot_img)
because we need it in perl-install/Makefile also
-rwxr-xr-x | make_boot_img | 28 | ||||
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rwxr-xr-x | tools/patch_pcmcia_config.pl | 28 |
3 files changed, 32 insertions, 26 deletions
diff --git a/make_boot_img b/make_boot_img index 64bcfe013..dbc62f4b2 100755 --- a/make_boot_img +++ b/make_boot_img @@ -69,30 +69,6 @@ if ($arch =~ /i.86/ && $img =~ /all/) { sub install_stripped { _ "strip $_[0]"; _ "$sudo install $_[0] $_[1]" } -sub patch_pcmcia_config { - my ($pcmcia_root) = @_; - my @ignore_modules_in_deps = qw(pcmcia_core ds); - - my @conf_contents = cat_("$pcmcia_root/pcmcia/config"); - die "$pcmcia_root/pcmcia/config seems short\n" if listlength(@conf_contents) < 10; - - #- adjust deps - foreach (cat_("all.modules/$main/modules.dep")) { - /^(\S+): (.*)/ and $deps{$1} = [ split ' ', $2 ] or die "could not understand `$_' in all.modules/$main/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("/tmp/make_boot_image_pcmcia_config", @conf_contents); - _ "$sudo mv /tmp/make_boot_image_pcmcia_config $pcmcia_root/pcmcia/config"; -} - sub initrd { my ($mnt, $img) = @_; my ($ltype, $I) = $type =~ /(.*?)(64)/; $ltype ||= $type; @@ -118,7 +94,9 @@ sub initrd { if (member($type, qw(pcmcia all network)) && $arch !~ /ppc/ && $arch !~ /ia64/) { _ "$sudo cp -a /etc/pcmcia $mnt/etc"; - patch_pcmcia_config("$mnt/etc"); + _ "cp $mnt/etc/pcmcia/config /tmp/pcmcia_config_tmp"; + _ "tools/patch_pcmcia_config.pl /tmp/pcmcia_config_tmp all.modules/$main/modules.dep"; + _ "sudo mv /tmp/pcmcia_config_tmp $mnt/etc/pcmcia/config"; } my ($ext) = $img =~ /rdz-(.*)/ or die "bad initrd name ($img)"; $modz = "all.modules$I/$ext"; diff --git a/perl-install/Makefile b/perl-install/Makefile index 4a7c0daf1..bbbcad83e 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -159,7 +159,7 @@ endif ifeq (i386,$(ARCH)) cp -a /etc/pcmcia $(DEST)/etc - patch --no-backup-if-mismatch -p0 -d $(DEST)/etc < ../tools/pcmcia_config.patch + ../tools/patch_pcmcia_config.pl $(DEST)/etc/pcmcia/config ../all.modules/`cat ../all.kernels/.main`/modules.dep endif find $(DEST) -name CVS | xargs rm -rf diff --git a/tools/patch_pcmcia_config.pl b/tools/patch_pcmcia_config.pl new file mode 100755 index 000000000..109cfcba7 --- /dev/null +++ b/tools/patch_pcmcia_config.pl @@ -0,0 +1,28 @@ +#!/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 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); |