summaryrefslogtreecommitdiffstats
path: root/rescue/make_rescue_img
diff options
context:
space:
mode:
Diffstat (limited to 'rescue/make_rescue_img')
-rwxr-xr-xrescue/make_rescue_img112
1 files changed, 32 insertions, 80 deletions
diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img
index 174dbb8bc..8e3f64334 100755
--- a/rescue/make_rescue_img
+++ b/rescue/make_rescue_img
@@ -1,16 +1,13 @@
#!/usr/bin/perl
use MDK::Common;
-use lib "../perl-install";
+use lib "/usr/lib/libDrakX";
use keyboard;
-my $lib = (arch() =~ /x86_64/ ? "lib64" : "lib");
my $tmp = "/tmp/rescue_tmp";
-my $rescue = "rescue.clp";
+my $rescue = "rescue.sqfs";
-my $sudo = '';
if ($>) {
- $sudo = "sudo";
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}
@@ -18,98 +15,53 @@ BEGIN { undef *_ }
sub __ { print @_, "\n"; system(@_) }
sub _ { __ @_; $? and die }
-sub installown($$) {
- my ($own, $dir) = @_;
- return if -e "$tmp$dir/" . basename($own);
- mkdir_p("$tmp$dir");
- _ "cp -rL $own $tmp$dir";
+my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch();
+_ "rm -rf $tmp" if -e $tmp;
+_ "mkdir -p $tmp";
+_ "cp -a tree/* $tmp";
+_ "find $tmp -name '*~' -delete";
+mkdir_p($tmp . chomp_($_)) foreach cat_("dirs");
+foreach (cat_("aliases")) {
+ chomp; my ($f, $dest) = split;
+ symlink $dest, "$tmp$f";
}
-
-sub install_perl_script {
- my ($script, $dir) = @_;
- my @gi_modules;
- foreach (`../tools/get-needed-drakx-modules ../perl-install /usr/lib/libDrakX $script`) {
- chomp;
- my ($local, $dest) = split "\t";
- installown($local, dirname($dest || $local));
- push @gi_modules, "$tmp$dest" if $dest;
- }
- installown($script, $dir);
- system('../tools/simplify-drakx-modules', @gi_modules, "$tmp$dir/$script");
+if ($arch eq "x86_64") {
+ _ "mkdir $tmp/usr/lib64";
+ _ "ln -s usr/lib64 $tmp/lib64";
}
-
-_ "$sudo 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 'CVS*' | xargs rm -rf";
-_ "perl devices.pl $tmp/dev";
substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue";
-{
- _ "cd ../mdk-stage1 && make rescue-gui dhcp-client";
- -e "../kernel/all.kernels" or die "use ./update_kernel in gi/kernel first\n";
-
- $ENV{MAIN_KERNEL} = chomp_(`cat ../kernel/RPMS/.main`);
+_ "../tools/install-xml-file-list list.xml $tmp";
- _ "../tools/install-xml-file-list list.xml $tmp";
-}
+_ "sed 's/Mageia \\([0-9]*\\)/Mageia Rescue \\1/' /etc/os-release >$tmp/etc/os-release";
+_ "ls -1 $tmp/etc | sed 's,\\(.*\\),/etc/\\1,' >>$tmp/usr/share/symlinks";
+# Loading the floppy module causes this service to fail so lets mask this to
+# prevent a red "FAILED" briefly showing on the screen
+_ "sed -i s/ExecStart=/ExecStart=-/ $tmp/usr/lib/systemd/system/systemd-modules-load.service";
my %keytable_conflicts;
-my @less_important_keytables = qw(am_old am_phonetic no-dvorak fr_CH-latin1);
-foreach (keyboard::loadkeys_files()) {
+my @less_important_keytables = qw(am_old am_phonetic no-dvorak de-latin1);
+foreach (keyboard::loadkeys_files(sub { warn @_ })) {
my ($dir, $fname) = (dirname($_), basename($_));
- my ($name) = $fname =~ /(.*)\.kmap\.gz/ or next;
+ my ($name) = $fname =~ /(.*)\.map\.gz/ or next;
next if member($name, @less_important_keytables);
- if (my ($short) = $name =~ m|(.+?)[\W_]|) {
+ 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.kmap.gz");
+ symlinkf($fname, "$tmp$dir/$short.map.gz");
}
}
-foreach (cat_("aliases")) {
- chomp; my ($f, $dest) = split;
- symlink $dest, "$tmp$f";
-}
-
-if ($ENV{PARTIMAGE_RPM}) {
-
- _ "rpm2cpio $ENV{PARTIMAGE_RPM} | (cd $tmp ; cpio -idu ./usr/sbin/partimage)";
- my $server = 'partimaged';
- $server = 'leia';
-
- my $default_dir = '/data/box';
- my $partimage_dir = $ENV{PARTIMAGE_DIR} || $default_dir;
- my @local_dirs = map { "/tmp/image$_" } split(' ', $partimage_dir);
- my $local_dir = $local_dirs[0];
- my $local_dirs = join(' ', @local_dirs);
-
+if (my ($LANGUAGE) = map { if_(/LANGUAGE_(.*)/, $1) } keys %ENV) {
substInFile {
- $_ = <<EOF if /^\s*rescue-gui/;
- if grep -q save_all /proc/cmdline; then
- drvinst NETWORK ; dhcp-client ; partimage_whole_disk -s $server save_all $default_dir
- echo "Press enter"
- read
- fi
- if grep -q rest_all /proc/cmdline; then
- if [ -d $local_dir ]; then
- partimage_whole_disk rest_all $local_dirs
- else
- drvinst NETWORK ; dhcp-client ; partimage_whole_disk -s $server rest_all $partimage_dir
- fi
- echo "Press enter"
- read
- fi
-EOF
- } "$tmp/etc/rc.sysinit";
+ $_ = "export LANGUAGE=$LANGUAGE\n" . "export LC_ALL=$LANGUAGE\n" if /^#LANGUAGE/;
+ } "$tmp/usr/bin/mageia-rescue";
}
-_ "$sudo chown root.root -R $tmp/*";
-
exit 0 if $ARGV[0];
-_ "mkisofs -quiet -D -R $tmp | create_compressed_fs - 65536 $rescue 200 2>/dev/null";
-#_ "$sudo rm -rf $tmp";
+_ "mksquashfs $tmp $rescue -all-root -noappend >/dev/null";
+_ "chmod 755 $rescue";
+#_ "rm -rf $tmp";