diff options
author | Antoine Ginies <aginies@mandriva.com> | 2011-01-19 10:44:49 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2011-01-19 10:44:49 +0000 |
commit | 530a16ec071db0e24e6e949e265a96848864967c (patch) | |
tree | fe40cacd28d67b98186754c551b7fd339ebc7e17 /rescue/make_rescue_img | |
download | drakx-530a16ec071db0e24e6e949e265a96848864967c.tar drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.gz drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.bz2 drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.xz drakx-530a16ec071db0e24e6e949e265a96848864967c.zip |
add mes5-2.6.33 branch
Diffstat (limited to 'rescue/make_rescue_img')
-rwxr-xr-x | rescue/make_rescue_img | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img new file mode 100755 index 000000000..cf8c2f7e9 --- /dev/null +++ b/rescue/make_rescue_img @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use MDK::Common; +use lib "/usr/lib/libDrakX"; +use keyboard; + +my $tmp = "/tmp/rescue_tmp"; +my $rescue = "rescue.sqfs"; + +if ($>) { + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + +BEGIN { undef *_ } +sub __ { print @_, "\n"; system(@_) } +sub _ { __ @_; $? and die } + +_ "rm -rf $tmp" if -e $tmp; +_ "mkdir $tmp"; +_ 'find . -name "*~" | xargs rm -f'; +mkdir_p($tmp . chomp_($_)) foreach cat_("dirs"); +_ "cp -a tree/* $tmp"; +_ "find $tmp -name .svn | xargs rm -rf"; +_ "perl devices.pl $tmp/dev"; +_ "mkfifo $tmp/dev/initctl"; +substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue"; + +_ "../tools/install-xml-file-list list.xml $tmp"; + +my %keytable_conflicts; +my @less_important_keytables = qw(am_old am_phonetic no-dvorak); +foreach (keyboard::loadkeys_files()) { + my ($dir, $fname) = (dirname($_), basename($_)); + my ($name) = $fname =~ /(.*)\.map\.gz/ or next; + next if member($name, @less_important_keytables); + if (my ($short2, $short) = $name =~ m|((.+?)[\W_][^\W_]*)|) { + $keytable_conflicts{$short} && $short2 ne $name and $short = $short2; + $keytable_conflicts{$short} and warn("conflict between $keytable_conflicts{$short} and $name for short name $short (choosing the first)\n"), next; + $keytable_conflicts{$short} = $name; + # create the short name based on the long one + symlinkf($fname, "$tmp$dir/$short.map.gz"); + } +} + +foreach (cat_("aliases")) { + chomp; my ($f, $dest) = split; + symlink $dest, "$tmp$f"; +} + + +if (my ($LANGUAGE) = map { if_(/LANGUAGE_(.*)/, $1) } keys %ENV) { + substInFile { + $_ = "export LANGUAGE=$LANGUAGE\n" . "export LC_ALL=$LANGUAGE\n" if /^#LANGUAGE/; + } "$tmp/etc/rc.sysinit"; +} + +exit 0 if $ARGV[0]; + +_ "mksquashfs $tmp $rescue -all-root -noappend >/dev/null"; +_ "chmod 755 $rescue"; +_ "rm -rf $tmp"; |