diff options
Diffstat (limited to 'rescue')
41 files changed, 637 insertions, 499 deletions
diff --git a/rescue/.gitignore b/rescue/.gitignore new file mode 100644 index 000000000..7b75a3e33 --- /dev/null +++ b/rescue/.gitignore @@ -0,0 +1 @@ +rescue.sqfs diff --git a/rescue/.perl_checker b/rescue/.perl_checker deleted file mode 100644 index 2b43b49be..000000000 --- a/rescue/.perl_checker +++ /dev/null @@ -1,73 +0,0 @@ -AutoLoader -Carp -Carp::Heavy -Compress::Zlib -Config::IniFiles -Cwd -Data::DumpXML -Data::DumpXML::Parser -Date::Manip -Digest::MD5 -Encode -File::Copy::Recursive -File::Find -File::FnMatch -File::Glob -File::Path -File::Sync -File::Temp -Gtk2::Gdk::Keysyms -Gtk2::Helper -Gtk2::Pango -Gtk2::SimpleList -I18N::Langinfo -IO::Handle -IO::Select -IO::Socket::INET -IPC::Open2 -Image::Magick -Libconf -Libconf::Glueconf::NUT::Ups_conf -Libconf::Glueconf::Samba::Smb_conf -Libconf::Templates::Generic::KeyValueSections -Libconf::Templates::Samba -Locale::gettext -Net::DBus -Net::DBus::Binding::Watch -Net::LDAP -RS::Handy -Scalar::Util -Sys::Syslog -Term::ReadKey -Time::HiRes -Time::ZoneInfo -URI::Escape -XML::LibXML -XML::LibXML::Boolean -XML::LibXML::Common -XML::LibXML::Literal -XML::LibXML::NodeList -XML::LibXML::Number -XML::Parser -base -constant -encoding -feature -handle_configs -move -open -overload -printer::cups -printer::hpoj -printer::main -printer::printerdrake -scanner -urpm::dudf -urpm::ldap -urpm::parallel_ka_run -urpm::parallel_ssh -URPM::Resolve -utf8 -warnings -warnings::register -bytes diff --git a/rescue/Makefile b/rescue/Makefile index ce7db09a6..b9462add0 100644 --- a/rescue/Makefile +++ b/rescue/Makefile @@ -1,6 +1,6 @@ include ../Makefile.config -VERSION=1.34 +VERSION=1.68 PRODUCT=drakx-installer-rescue RESCUE = rescue.sqfs @@ -10,31 +10,15 @@ all: $(RESCUE) install: $(RESCUE) cp -f $< $(STAGE2_DEST) -$(RESCUE): list.xml drvinst guessmounts lsparts rescue-doc make_rescue_img +$(RESCUE): $(wildcard tree/**/*) $(wildcard bin/*) $(wildcard sbin/*) make_rescue_img list.xml aliases + if [[ -n "$$DEBUG_INSTALL_LANG" ]]; then perl -pi -e '$$_ = "loadkeys '$$DEBUG_INSTALL_LANG'\n$$_" if /LANGUAGE/' tree/usr/bin/mageia-rescue; fi DISTRIB_DESCR=$(DISTRIB_DESCR) ./make_rescue_img -dist-svn: - rm -rf $(PRODUCT)*.tar* $(PRODUCT)-$(VERSION) - mkdir -p $(PRODUCT)-$(VERSION)/tools - svn export -q -rBASE . $(PRODUCT)-$(VERSION)/rescue - cp ../Makefile.config $(PRODUCT)-$(VERSION)/ - cp ../tools/install-xml-file-list $(PRODUCT)-$(VERSION)/tools - tar cfa $(PRODUCT)-$(VERSION).tar.xz $(PRODUCT)-$(VERSION) - rm -rf $(PRODUCT)-$(VERSION) - -dist-git: - @cd ..; git archive --prefix=$(PRODUCT)-$(VERSION)/ HEAD rescue tools/install-xml-file-list Makefile.config | xz >$(PRODUCT)-$(VERSION).tar.xz; +dist: tar tar: rm -rf $(PRODUCT)*.tar* $(PRODUCT)-$(VERSION) - @if [ -e "../.svn" ]; then \ - $(MAKE) dist-svn; \ - elif [ -e "../.git" ]; then \ - $(MAKE) dist-git; \ - else \ - echo "Unknown SCM (not SVN nor GIT)";\ - exit 1; \ - fi; + @cd ..; git archive --prefix=$(PRODUCT)-$(VERSION)/ $(PRODUCT)-$(VERSION) rescue tools/install-xml-file-list Makefile.config | xz >$(PRODUCT)-$(VERSION).tar.xz; $(info $(PRODUCT)-$(VERSION).tar.xz is ready) clean: diff --git a/rescue/NEWS b/rescue/NEWS index 1206b45f6..dafe7c222 100644 --- a/rescue/NEWS +++ b/rescue/NEWS @@ -1,3 +1,186 @@ +Version 1.68 - 18 October 2025 by Jani Välimaa +- replace i586 with i686 in files +- fix and sort nedeed systemd files + - add systemd-executor + - remove systemd-cgroups-agent + +Version 1.67 - 28 April 2023 by Martin Whitaker + +- mount efivars in chroot on UEFI systems (mga#31844) + +Version 1.66 - 11 November 2020 by Thierry Vignaud + +- include overload.pm for File::Temp + +Version 1.65 - 16 June 2020 by Thierry Vignaud + +- fix running loadkeys w/o arg if DEBUG_INSTALL_LANG is not set (mga#26782) + +Version 1.64 - 20 March 2020 by Thierry Vignaud + +- debug mode: + o preset keyboard if DEBUG_INSTALL_LANG is set during build +- do not preload all fs modules uselessly +- guessmount: + o enable to repair encrypted LVMs/LUKS (mga#22795) + o fix displaying the version of the distro + o just use the fs reported by blkid instead of doing brute force guessing + +Version 1.63 - 19 March 2020 by Thierry Vignaud + +- add more tools for XFS & btrfs +- include all of /usr/lib/udev/hwdb.d (mga#20327) +- include F2FS tools +- include missing LVM tools symlinks (mga#25466) +- include ntfs3g compression support plugin +- include Encode::Unicode module for reFind + +Version 1.62 - 18 June 2019 by Thomas Backlund + +- start udevd to support lvm2 (mga#24878) + +Version 1.61 - 11 May 2019 by Thomas Backlund + +- update filelist for new systemd + +Version 1.60 - 22 November 2018 by Thierry Vignaud + +- fix collecting needed perl files with glibc-2.26 + +Version 1.59 - 26 August 2018 by Thomas Backlund + +- adapt for btrfs-progs 4.17.1 + +Version 1.58 - 26 August 2018 by Thomas Backlund + +- adapt for perl-5.28 + +Version 1.57 - 10 February 2018 by Thierry Vignaud + +- add more udev rules (syncing with regular stage2) + +Version 1.56 - 19 January 2018 by Thomas Backlund + +- adapt for new systemd + +Version 1.55 - 30 January 2017 by Thierry Vignaud + +- lsparts: fix reporting half sizes (mga#8853) + +Version 1.54 - 20 June 2016 by Thierry Vignaud + +- do not run shells uselessly +- drop (broken) support for Alpha, IA64 & PPC, Sparc +- fix a message when re-installing bootloader + +Version 1.53 - 28 September 2015 by Thierry Vignaud + +- fix build with libified perl + +Version 1.52 - 30 April 2015 by Thierry Vignaud + +- guessmount: mount /dev, /run & /sys too (mga#10865) +- lsparts (mga#8854): + o display label too + o silent run_program + +Version 1.51 - 15 April 2015 by Thierry Vignaud + +- fix reinstalling grub2 on UEFI (mga#15695) + +Version 1.50 - 9 January 2015 by Thomas Backlund + +- add efibootmgr on x86_64 + +Version 1.49 - 18 September 2014 by Thomas Backlund + +- 80-net-name-slot.rules is replaced with 99-default.link + +Version 1.48 - 18 September 2014 by Thomas Backlund + +- killall5 is no more needed + +Version 1.47 - 8 December 2013 by Colin Guthrie + +- use systemd as init in the rescue system +- allowing systemd-nspawn "booting" of a mounted /mnt (after umount /mnt/proc) + +Version 1.46 - 20 October 2013 by Colin Guthrie + +- adapt to a dracut based stage1 + +Version 1.45.1 - 14 October 2013 by Colin Guthrie + +- many btrfs tools no longer exist + +Version 1.45 - 14 October 2013 by Colin Guthrie + +- adapt to latest mdadm +- drop /etc/termcap as it's no longer part of our build +- include network interface name udev rules (mga#10947) + +Version 1.44 - 18 May 2013 by Colin Guthrie + +- ensure /dev is bind mounted before re-installing bootloader (mga#10107) + +Version 1.43 - 15 May 2013 by Colin Guthrie + +- ensure grabjournallogs script is executable (mga#10108) + +Version 1.42 - 30 April 2013 by Thierry Vignaud + +- add a script to simplfy grabbing of journal logs for bug reports +- enable to abort choosing distro to rescue (mga#9765) + +Version 1.41 - 6 April 2013 by Thierry Vignaud + +- really adapt to /usr move (fix lvm2 freezing, mga#5795) +- drop our "use modprobe instead" insmod since we've kmod one for free +- include libdevmapper-event-*.so +- include persistant storage udev rules needed to see new uuids +- offer to pick the distro to rescue when there's more than one +- /var/run/utmp is on tmpfs now +- warn that i586 cannot rescue x86_64 (mga#8696) + +Version 1.40 - 6 March 2013 by Thierry Vignaud + +- preload fuse (mga#5833) +- use kmod's modprobe, thus fixing loading modules (mga#9270) + +Version 1.39 - 3 September 2012 by Thierry Vignaud + +- adapt to latest systemd/udevd +- adapt to perl-5.16.0 +- adapt to /usr move +- default to the higher version when there're several mga roots (mga#6003) +- drop KA support +- fix detecting USB devices with kernel-3.5+ (mga#7248) +- preload load btrfs and nilfs2 too +- rely on stage1 for mounting /dev +- revert to "linux" terminfo +- simplify bringing up local loop interface (pok, mdv) +- stop fixing the raid udev rule now that it has been fixed + +Version 1.38 - 11 May 2012, by Thierry Vignaud + +- include missing modules when SMB appears in fstab (mga#5850) + +Version 1.37 - 18 April 2012, by Thierry Vignaud + +- fix detecting RAID (mga#5048) +- include more udev rules for RAID (mga#5048) + +Version 1.36 - 8 April 2012, by Pascal Terjan + +- fix modprobe to support being called by kernel (mga#5274) + +Version 1.35 - 5 April 2012, by Thierry Vignaud + +- add chrooted rescue system in PATH +- 32bit grub needs 32 bit loader (mga#5191) +- default to "screen" instead of "linux" terminfo (mga#4894) +- include "screen" terminfo (mga#4894) + Version 1.34 - 26 February 2012, by Maarten Vanraes (AL13N) - escape / in generated passwords in startssh diff --git a/rescue/aliases b/rescue/aliases index 59c96a124..ae924a86e 100644 --- a/rescue/aliases +++ b/rescue/aliases @@ -1,2 +1,9 @@ -/bin/vi vim-minimal -/lib/modules /modules +/bin usr/bin +/sbin usr/sbin +/lib usr/lib +/usr/bin/vi vim-minimal +/usr/sbin/init ../lib/systemd/systemd +/usr/lib/modules ../../modules +/usr/lib/systemd/system/default.target rescue.target +/usr/lib/systemd/system/rescue.target.wants/sockets.target ../sockets.target +/usr/lib/systemd/system/dbus-org.freedesktop.machine1.service systemd-machined.service diff --git a/rescue/drvinst b/rescue/bin/drvinst index cc7fb4fa2..4868b42e0 100755 --- a/rescue/drvinst +++ b/rescue/bin/drvinst @@ -19,28 +19,19 @@ use detect_devices; $ARGV[0] =~ /^--?h/ and die "usage: drivers_install [drivertype1 [drivertype2 ...]]\n"; my @types = @ARGV; -sub install_module_raw { - my ($driver, $o_descr) = @_; - print STDERR "Installing driver $driver", $o_descr ? " (for \"$o_descr\")" : '', "\n"; - system("/sbin/modprobe", $driver) and print "\tfailed\n"; -} - -my $already_usb; sub install_module { my ($driver, $descr) = @_; - install_module_raw($driver, $descr); - if (!$already_usb && $driver =~ /usb/) { - $already_usb = 1; - install_module_raw('usbkbd'); - install_module_raw('keybdev'); - } + print STDERR qq(Installing driver $driver (for "$descr")\n); + system("/sbin/modprobe", $driver) and print "\tfailed\n"; } #- start foreach my $card (detect_devices::pci_probe()) { + # ignoring "unknown", "Card:foobar" and the like as well as video cards: $card->{driver} eq 'unknown' || $card->{driver} =~ /:/ and next; $card->{media_type} eq "DISPLAY_VGA" and next; + # load drivers for selected categories or for everything if no args: if (!@ARGV || find { $card->{media_type} =~ /$_/i } @types) { install_module($card->{driver}, $card->{description}); } diff --git a/rescue/guessmounts b/rescue/bin/guessmounts index 78a5c613d..494f98f44 100755 --- a/rescue/guessmounts +++ b/rescue/bin/guessmounts @@ -37,46 +37,95 @@ print STDERR "\nPlease wait, trying to find your root device...\n"; mkdir_p($target); -devices::init_device_mapper(); -lvm::detect_during_install(); +{ + local $::isInstall = 1; # so that detect_during_install() got called by init: + lvm::init(); +} fs::dmcrypt::init; my @parts = map { $_->{device} = delete $_->{dev}; put_in_hash($_, fs::type::type_subpart_from_magic($_)); } fs::proc_partitions::read_raw(); + +# Basically doing fsedit::raids(): my ($raid_parts, $normal_parts) = partition { isRawRAID($_) } @parts; if (@$raid_parts) { require raid; - raid::detect_during_install_once(@$raid_parts); + raid::detect_during_install(@$raid_parts); my $raids = raid::get_existing(@$raid_parts); push @$normal_parts, @$raids; } -my @fstab; -my ($root, $fs, @roots); +# Basically doing fsedit::dmcrypts(): +(my $luks_parts, $normal_parts) = partition { isRawLUKS($_) } @$normal_parts; +if (@$luks_parts) { + use interactive; + use interactive::curses; + require diskdrake::interactive; + my $in = interactive->vnew('su'); + my $all_hds = fsedit::get_hds({}, $in); + # Unlocking them in order to look at their fs (do they hold a Mageia installation): + foreach my $part (@$luks_parts) { + diskdrake::interactive::dmcrypt_open($in, undef, $part, $all_hds); + } + my @dmcrypts = fs::dmcrypt::get_existing(@$luks_parts); + push @$normal_parts, @dmcrypts; +} + +my @roots; +my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch(); foreach (@$normal_parts) { my $dev = devices::make($_->{device}); - my $fs = find { - system("mount -t $_ $dev $target 2>/dev/null") == 0; - } fs::type::true_local_fs_types() or next; + my $fs = $_->{fs_type}; + member($fs, fs::type::true_local_fs_types()) or next; + system("mount -t $fs $dev $target 2>/dev/null"); if (my $release_file = common::release_file($target)) { - my $release = chomp_(cat_("$target$release_file")); - print STDERR "=> found a $release root partition on $dev\n=> type $fs, version `\n"; my @fstab = fs::read_fstab($target, '/etc/fstab'); - push @roots, { dev => $dev, release => $release, fs => $fs, fstab => \@fstab }; + my $h = common::parse_release_file($target, $release_file, $_); + add2hash($h, { dev => $dev, fs => $fs, fstab => \@fstab, + pretty_name => "$h->{release} $h->{version} $h->{arch} on $dev" }); + my $release = chomp_(cat_("$target$release_file")); + printf STDERR "=> found a %s root partition on $dev\n=> type $fs, version `$release'\n", $h->{release}; + # Offer to rescue only same arch: + $h->{pretty_name} .= " (cannot be rescued: $h->{arch} ne $arch;)" if $h->{arch} ne $arch; + push @roots, $h; } system('umount', $target) == 0 or die "error unmounting $target\n"; } +my ($root, $fs, @fstab); + # Try Mageia first: if (@roots) { + # Order by release number: + @roots = sort { $b->{version} cmp $a->{version} } @roots; + # Then pick mga over mdv: @roots = map { @$_ } partition { $_->{release} =~ /Mageia/ } @roots; - my $selected = first(@roots); + + my $selected; + if (@roots == 1) { + $selected = first(@roots); + } else { + print "\n\nWhich system do you want to rescue?\n0: Abort\n"; + each_index { print $::i + 1, ": $_->{pretty_name}\n" } @roots; + my $res; + while ($res < 1 || $res > @roots) { + print "what is your choice (type the number of your selection or C^c to abort)?\n"; + $res = <>; + chomp($res); + if ($res eq "0") { + print "Aborting\n"; + exit(1); + } + } + $selected = $roots[$res-1]; + } + $root = $selected->{dev}; $fs = $selected->{fs}; @fstab = @{$selected->{fstab}}; @@ -104,9 +153,14 @@ if ($root) { my $dev = fs::wild_device::from_part('', $_); mkdir_p($where); print STDERR "\t$dev on $where type $_->{fs_type} options $_->{options}\n"; - system("mount -t $_->{fs_type} $dev $where -o $_->{options}"); + system('mount', '-t', $_->{fs_type}, $dev, $where, '-o', $_->{options}); + } + system(qw(mount -t proc proc), "$target/proc"); + foreach (qw(/dev /run)) { + system('mount', '--bind', $_, "$target/$_"); } - system("mount -t proc proc $target/proc"); + system(qw(mount -t sysfs sysfs), "$target/sys"); + system(qw(mount -t efivarfs efivarfs), "$target/sys/firmware/efi/efivars") if is_uefi(); print STDERR "\nYour system is ready on $target.\n\n"; } else { die "Could not find your root device :-(.\n"; diff --git a/rescue/install_bootloader b/rescue/bin/install_bootloader index 5c7f9012f..3eeb7a65e 100755 --- a/rescue/install_bootloader +++ b/rescue/bin/install_bootloader @@ -17,6 +17,7 @@ use common; use bootloader; use fs; +my $auto; if ($ARGV[0] eq '--auto') { $auto = shift @ARGV; } @@ -59,7 +60,7 @@ if (@main_methods == 0) { my $install = $bootloader::{'install_raw_' . $main_method} or die "unknown bootloader method install_raw_$main_method\n"; -print "About to re-install Boot Loader $main_method of following %s distribution:\n\t", +print "About to re-install Boot Loader $main_method of following Mageia distribution:\n\t", $release, "\n"; if (!$auto) { print "=> ok? <press Enter to continue, 'n' and Enter to cancel> "; diff --git a/rescue/lsparts b/rescue/bin/lsparts index 8d36a02f4..a1855a21e 100755 --- a/rescue/lsparts +++ b/rescue/bin/lsparts @@ -38,8 +38,9 @@ foreach (fs::proc_partitions::read_raw()) { print STDERR "$err\n" if $verbose; } else { $_->{device} = $_->{dev}; + local $::isStandalone = 1; # silent run_program if (my $type = fs::type::type_subpart_from_magic($_)) { - printf "$_->{dev}: %6s, fs %s (%s)\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type); + printf "$_->{dev}: %6s, fs %s (%s) [%s]\n", formatXiB($_->{size} * 1024), $type->{fs_type}, fs::type::part2type_name($type), $type->{device_LABEL}; } } } diff --git a/rescue/rescue-doc b/rescue/bin/rescue-doc index c324ac9e1..e6514b462 100755 --- a/rescue/rescue-doc +++ b/rescue/bin/rescue-doc @@ -1,6 +1,7 @@ #!/usr/bin/perl -sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f failed: $!\n"; print F foreach @_; } +# From MDK::Common: +sub output { my $f = shift; open(my $F, ">$f") or die "output in file $f failed: $!\n"; print $F $_ foreach @_ } output('/tmp/rescue-doc-contents', q( Information regarding problems not directly addressed diff --git a/rescue/restore_ms_boot b/rescue/bin/restore_ms_boot index 1f8cc2907..1f8cc2907 100755 --- a/rescue/restore_ms_boot +++ b/rescue/bin/restore_ms_boot diff --git a/rescue/devices.pl b/rescue/devices.pl deleted file mode 100644 index 0d0c6af9d..000000000 --- a/rescue/devices.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl - -@ARGV == 1 && chdir $ARGV[0] or die "usage: devices.pl <dir>\n"; - -foreach (<DATA>) { - chomp; - my ($typ, $maj, $min, @l) = split; - foreach (@l) { - my @l2 = do { - if (my ($prefix, $ini, $end) = /(.*)(\d+)-(\d+)$/) { - map { "$prefix$_" } $ini .. $end; - } else { - $_; - } - }; - foreach (@l2) { - my $cmd = "mknod -m 600 $_ $typ $maj " . $min++; - system($cmd) == 0 or die "$cmd failed\n"; - } - } -} - -__DATA__ -c 5 1 console -b 2 0 fd0-1 -c 1 2 kmem -b 7 0 loop0-15 -c 1 1 mem -c 1 3 null -c 1 4 port -b 1 1 ram -b 1 0 ram0-19 -b 1 0 ramdisk -c 1 8 random -b 11 0 scd0-7 -c 0 0 stderr -c 0 0 stdin -c 0 0 stdout -c 5 0 tty -c 4 0 tty0-9 -c 4 64 ttyS0-3 -c 1 9 urandom -c 1 5 zero -b 3 0 hda hda1-16 -b 3 64 hdb hdb1-16 -b 22 0 hdc hdc1-16 -b 22 64 hdd hdd1-16 -b 33 0 hde hde1-16 -b 33 64 hdf hdf1-16 -b 34 0 hdg hdg1-16 -b 34 64 hdh hdh1-16 -b 8 0 sda sda1-15 sdb sdb1-15 sdc sdc1-15 sdd sdd1-15 sde sde1-15 sdf sdf1-15 sdg sdg1-15 sdh sdh1-15 -b 9 0 md0-15 -c 10 144 nvram -c 9 0 st0-15 diff --git a/rescue/dirs b/rescue/dirs index 6b6d88a6f..1b1153926 100644 --- a/rescue/dirs +++ b/rescue/dirs @@ -1,4 +1,9 @@ -/lib +/dev +/proc +/run +/sys /tmp +/usr/bin +/usr/sbin +/usr/lib/systemd/system/rescue.target.wants /modules -/proc diff --git a/rescue/list.xml b/rescue/list.xml index 0b50d80eb..50656352e 100644 --- a/rescue/list.xml +++ b/rescue/list.xml @@ -45,7 +45,7 @@ ldconfig mingetty agetty reboot halt shutdown - kill killall5 ps strace + kill ps strace sed tr strings @@ -60,12 +60,15 @@ dumpe2fs tune2fs resize2fs debugfs mkfs.reiserfs resize_reiserfs reiserfstune reiserfsck - mkfs.xfs xfs_admin xfs_repair fsck.xfs + mkfs.xfs xfs_admin xfs_growfs xfs_repair fsck.xfs + xfs_freeze xfs_io <!-- needed for setup grub on XFS formated / --> + xfs_db <!-- needed by xfs_admin for setting UUID --> mkfs.ntfs mkdosfs dosfslabel mkntfs ntfsresize ntfslabel mkfs.nilfs2 nilfs-tune - btrfs btrfsck btrfs-convert btrfsctl btrfs-debug-tree - btrfs-map-logical btrfs-show btrfs-vol mkfs.btrfs fsck.btrfs + mkfs.btrfs btrfs btrfsck fsck.btrfs btrfstune + btrfs-map-logical btrfs-convert + mkfs.f2fs fsck.f2fs resize.f2fs dropbear dropbearkey screen @@ -78,38 +81,33 @@ quotacheck cryptsetup dmsetup - <if ARCH="ppc"> - hformat - </if> - - <if-not ARCH="ppc"> fdisk gpart testdisk photorec - </if-not> - <if-not ARCH="ppc|sparc"> sfdisk - </if-not> - <if ARCH="ppc"> - pdisk - </if> dump dump.ext2 restore restore.ext2 dump.ext3 restore.ext3 dump.xfs restore.xfs parted partimage partprobe udevadm mdadm lvm2 + <!-- symlinks --> + lvconvert lvcreate lvchange lvdisplay lvextend lvmconfig lvmdiskscan lvmsadc lvmsar lvreduce lvremove lvrename lvresize lvs lvscan + pvck pvcreate pvchange pvdisplay pvmove pvremove pvresize pvs pvscan + vgcfgbackup vgcfgrestore vgck vgconvert vgcreate vgchange vgdisplay vgexport vgextend vgimport vgimportclone vgmerge vgmknodes vgreduce vgremove vgrename vgs vgscan vgsplit + mdmon kpartx dmevent_tool dmeventd - <if ARCH="i.86|x86_64|ia64"> + <if ARCH="i.86|x86_64"> dmraid </if> lsmod insmod rmmod + modprobe setserial mt stinit @@ -129,30 +127,16 @@ awk clear dialog wc setterm - <if ARCH="i.86|x86_64|ia64"> + <if ARCH="i.86|x86_64"> dmidecode </if> <if ARCH="i.86|x86_64"> grub grub-install </if> - <if ARCH="ia64"> + <if ARCH="x86_64"> efibootmgr </if> - <if ARCH="ppc"> - ybin - mkofboot ofpath - nvsetenv - </if> - <if ARCH="sparc"> - silo - </if> -</from> - -<from dir="/usr/LIB/drakx-installer-sysvinit/" expand="glob"> - <to dir="/sbin"> - init - </to> </from> <from> @@ -163,8 +147,12 @@ </if> /usr/share/misc/magic.mgc /usr/share/terminfo/l/linux + /usr/share/terminfo/s/screen /usr/share/pci.ids - /var/run/utmp + + <from expand="glob"> + /usr/LIB/ntfs-3g/* + </from> <if ARCH="i.86|x86_64"> <from dir="/lib/grub/ARCH-mageia" expand="glob"> @@ -175,11 +163,6 @@ /usr/lib/extipl/aldebaran.bin </if> - <if ARCH="ppc"> - /usr/lib/yaboot/ofboot - /usr/lib/yaboot/yaboot - </if> - <from expand="command"> perl -Mkeyboard -I/usr/lib/libDrakX -le 'print foreach keyboard::loadkeys_files()' </from> @@ -206,6 +189,13 @@ /sbin/blkid </from> + +<from dir="/usr/LIB/device-mapper"> + <from expand="glob"> + *.so + </from> +</from> + <from dir="/usr/lib/rpm" expand="glob"> <mode copy="keep-links"> rpmrc @@ -217,6 +207,7 @@ <filter subst="/^__END__/ and $_ = '', close ARGV"> <from expand="main-perl"> AutoLoader.pm + overload.pm <!-- required by File::Temp --> strict.pm vars.pm warnings/register.pm @@ -225,66 +216,202 @@ Exporter.pm File/Path.pm File/Basename.pm - ARCH-linux-thread-multi/re.pm - ARCH-linux-thread-multi/Cwd.pm - ARCH-linux-thread-multi/auto/Cwd/Cwd.so - ARCH-linux-thread-multi/CORE/libperl.so - ARCH-linux-thread-multi/auto/POSIX/autosplit.ix - ARCH-linux-thread-multi/auto/POSIX/load_imports.al - ARCH-linux-thread-multi/auto/POSIX/POSIX.so - ARCH-linux-thread-multi/POSIX.pm + File/Temp.pm <!-- required by diskdrake::interactive --> XSLoader.pm - ARCH-linux-thread-multi/lib.pm - ARCH-linux-thread-multi/Socket.pm - ARCH-linux-thread-multi/IO/Socket.pm - ARCH-linux-thread-multi/IO.pm - ARCH-linux-thread-multi/IO/Handle.pm - ARCH-linux-thread-multi/Encode/Symbol.pm Symbol.pm SelectSaver.pm - ARCH-linux-thread-multi/DynaLoader.pm - ARCH-linux-thread-multi/auto/IO/IO.so - ARCH-linux-thread-multi/auto/Socket/Socket.so - ARCH-linux-thread-multi/Errno.pm - ARCH-linux-thread-multi/IO/Socket/INET.pm - ARCH-linux-thread-multi/IO/Socket/UNIX.pm </from> + +<from expand="main-perl-bin"> + re.pm + Cwd.pm + auto/Cwd/Cwd.so + auto/POSIX/POSIX.so + POSIX.pm + lib.pm + Socket.pm + IO/Socket.pm + IO.pm + IO/Handle.pm + Encode/Symbol.pm + Encode/Unicode.pm + auto/Encode/Unicode/Unicode.so + DynaLoader.pm + File/Spec.pm <!-- required by File::Temp --> + File/Spec/Unix.pm <!-- required by File::Spec --> + auto/IO/IO.so + auto/Socket/Socket.so + Errno.pm + IO/Socket/INET.pm + IO/Socket/UNIX.pm + List/Util.pm <!-- required by Scalar::Util --> + auto/List/Util/Util.so + Scalar/Util.pm <!-- required by File::Temp --> +</from> + <from expand="perl"> packdrake.pm MDV/Packdrakeng.pm </from> </filter> +<from expand="rpm" matching="m!^/usr/(share|LIB)/perl5! and !/\.pod$/"> + perl-Curses <!-- required by Curses::UI --> + perl-Curses-UI <!-- required by interactive::curses --> +</from> + <from dir="/etc"> mke2fs.conf netconfig inputrc - termcap protocols services shells ssh/ssh_config </from> -<from dir="/lib/udev"> - udevd +<from dir="/usr/lib/systemd"> + systemd + systemd-executor + systemd-fsck + systemd-journald + systemd-machined + systemd-modules-load + systemd-reply-password + systemd-shutdown + systemd-sysctl + systemd-udevd + systemd-vconsole-setup + system-generators/systemd-fstab-generator +</from> + +<from dir="/usr/lib/systemd/network"> + 99-default.link +</from> + +<from dir="/usr/lib/systemd/system"> + cryptsetup.target + dbus.service + dbus.socket + emergency.target + sysinit.target + basic.target + halt.target + kexec.target + local-fs.target + local-fs-pre.target + remote-fs.target + remote-fs-pre.target + network.target + nss-lookup.target + nss-user-lookup.target + poweroff.target + reboot.target + rescue.target + rpcbind.target + shutdown.target + final.target + sigpwr.target + sockets.target + swap.target + timers.target + paths.target + umount.target + kmod-static-nodes.service + systemd-tmpfiles-setup-dev.service + systemd-ask-password-console.path + systemd-udevd-control.socket + systemd-udevd-kernel.socket + systemd-ask-password-plymouth.path + systemd-journald.socket + systemd-ask-password-console.service + systemd-modules-load.service + systemd-halt.service + systemd-poweroff.service + systemd-reboot.service + systemd-kexec.service + systemd-fsck@.service + systemd-udevd.service + systemd-udev-trigger.service + systemd-udev-settle.service + systemd-ask-password-plymouth.service + systemd-journald.service + systemd-machined.service + systemd-vconsole-setup.service + + sysinit.target.wants/systemd-modules-load.service + sysinit.target.wants/systemd-ask-password-console.path + sysinit.target.wants/systemd-journald.service + sockets.target.wants/dbus.socket + sockets.target.wants/systemd-udevd-control.socket + sockets.target.wants/systemd-udevd-kernel.socket + sockets.target.wants/systemd-journald.socket + sysinit.target.wants/systemd-udevd.service + sysinit.target.wants/systemd-udev-trigger.service + sysinit.target.wants/kmod-static-nodes.service + sysinit.target.wants/systemd-tmpfiles-setup-dev.service + + ctrl-alt-del.target + syslog.socket + + slices.target </from> -<from dir="/lib/udev/rules.d"> +<from expand="binary"> + journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles systemd-nspawn dbus-daemon machinectl +</from> + +<from> + /etc/dbus-1/system.conf + /usr/share/dbus-1/system.d/org.freedesktop.systemd1.conf + /usr/share/dbus-1/system.d/org.freedesktop.machine1.conf + /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service + /usr/share/dbus-1/system-services/org.freedesktop.machine1.service +</from> + +<from dir="/usr/lib/udev"> + ata_id + scsi_id +</from> + +<from dir="/usr/lib/udev/hwdb.d"> + <from expand="glob"> + *.hwdb + </from> +</from> + +<from dir="/usr/lib/udev/rules.d"> 10-dm.rules - 13-dm-disk.rules 11-dm-lvm.rules + 13-dm-disk.rules + 50-udev-default.rules + 60-persistent-storage.rules + 63-md-raid-arrays.rules + 64-md-raid-assembly.rules + 75-net-description.rules + 80-drivers.rules + 80-net-setup-link.rules 95-dm-notify.rules </from> <filter command="strip"> + <!-- 32bit grub needs 32 bit loader --> + <if ARCH="x86_64"> + <from dir="/lib"> + ld-linux*.so.2 + </from> + </if> <from dir="/LIB"> libnss_files.so.2 libnss_dns.so.2 libresolv.so.2 ld-linux*.so.2 + <!-- needed for mount.ntfs-3g --> libfuse.so.2 + + <!-- needed by dmraid --> + libdmraid-events-isw.so </from> </filter> @@ -299,21 +426,31 @@ <filter command="../tools/simplify-drakx-modules"> <from dir="." expand="collect-perl-files /usr/lib/libDrakX /usr/lib/libDrakX"> - <to dir="/usr/bin"> - rescue-doc drvinst lsparts - guessmounts install_bootloader + <to dir="/usr"> + bin/rescue-doc + bin/drvinst + bin/lsparts + bin/guessmounts + bin/install_bootloader <if ARCH="i.86|x86_64"> - restore_ms_boot + bin/restore_ms_boot </if> </to> - <to dir="/usr/sbin"> - partimage_whole_disk + <to dir="/usr"> + sbin/partimage_whole_disk </to> </from> + <!-- Those are listed b/c collect-perl-files failed to detect them: --> <from dir="/usr/lib/libDrakX" expand="glob"> - raid.pm <!-- required when needed in guessmounts --> + interactive.pm <!-- required by diskdrake::interactive --> + interactive/curses.pm <!-- required by interactive --> + diskdrake/interactive.pm <!-- required by guessmount --> fs/dmraid.pm <!-- required by fsedit --> + fs/remote.pm <!-- required by fs::remote::* --> + fs/remote/davfs.pm <!-- required by fs --> + fs/remote/smb.pm <!-- required by fs --> partition_table/*.pm <!-- required by partimage_whole_disk --> + raid.pm <!-- required when needed in guessmounts --> </from> </filter> @@ -325,42 +462,6 @@ dhcp-client </to> </from> -<from dir="/usr/bin"> - <to dir="/ka"> - bootable_flag.sh - fdisk_to_desc - gen_modprobe_conf.pl - ka-d-client - ka-d-server - ka-d.sh - ka_replication.sh - make_initrd_grub - make_initrd_lilo - prepare_node.sh - send_status.pl - status_node.pl - store_log.sh - udev_creation.sh - </to> -</from> -<from dir="/etc/ka"> - <to dir="/ka"> - replication.conf - </to> -</from> -<from dir="."> - <to dir="/usr/sbin"> - diskdrake-resize - genpasswd - startssh - </to> - <to dir="/usr/sbin"> - restore-image.sh - </to> - <to dir="/usr/lib"> - restore-image-lib.sh - </to> -</from> <if set="RESCUE_FLASH"> <from expand="binary"> dirname diff --git a/rescue/make_flash_rescue b/rescue/make_flash_rescue Binary files differindex b439b9adc..2f7ce8584 100755 --- a/rescue/make_flash_rescue +++ b/rescue/make_flash_rescue diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img index 59b0f7073..8e3f64334 100755 --- a/rescue/make_rescue_img +++ b/rescue/make_rescue_img @@ -15,19 +15,33 @@ BEGIN { undef *_ } sub __ { print @_, "\n"; system(@_) } sub _ { __ @_; $? and die } +my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch(); _ "rm -rf $tmp" if -e $tmp; -_ "mkdir $tmp"; -_ 'find . -name "*~" | xargs rm -f'; -mkdir_p($tmp . chomp_($_)) foreach cat_("dirs"); +_ "mkdir -p $tmp"; _ "cp -a tree/* $tmp"; -_ "find $tmp -name .svn | xargs rm -rf"; +_ "find $tmp -name '*~' -delete"; +mkdir_p($tmp . chomp_($_)) foreach cat_("dirs"); +foreach (cat_("aliases")) { + chomp; my ($f, $dest) = split; + symlink $dest, "$tmp$f"; +} +if ($arch eq "x86_64") { + _ "mkdir $tmp/usr/lib64"; + _ "ln -s usr/lib64 $tmp/lib64"; +} substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue"; _ "../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 de-latin1); -foreach (keyboard::loadkeys_files()) { +foreach (keyboard::loadkeys_files(sub { warn @_ })) { my ($dir, $fname) = (dirname($_), basename($_)); my ($name) = $fname =~ /(.*)\.map\.gz/ or next; next if member($name, @less_important_keytables); @@ -40,20 +54,14 @@ foreach (keyboard::loadkeys_files()) { } } -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"; + } "$tmp/usr/bin/mageia-rescue"; } exit 0 if $ARGV[0]; _ "mksquashfs $tmp $rescue -all-root -noappend >/dev/null"; _ "chmod 755 $rescue"; -_ "rm -rf $tmp"; +#_ "rm -rf $tmp"; diff --git a/rescue/partimage_whole_disk b/rescue/sbin/partimage_whole_disk index ed0653a95..ed0653a95 100755 --- a/rescue/partimage_whole_disk +++ b/rescue/sbin/partimage_whole_disk diff --git a/rescue/tree/bin/insmod b/rescue/tree/bin/insmod deleted file mode 100755 index 49b298142..000000000 --- a/rescue/tree/bin/insmod +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "Use modprobe instead" diff --git a/rescue/tree/etc/fstab b/rescue/tree/etc/fstab index 9280d8ee0..fbafb7801 100644 --- a/rescue/tree/etc/fstab +++ b/rescue/tree/etc/fstab @@ -1,6 +1,4 @@ /dev/ram3 / ext2 defaults 1 1 /dev/fd0 /mnt/floppy auto defaults,noauto 0 0 none /proc proc defaults,noauto,ro 0 0 -devpts /dev/pts devpts gid=5,mode=620,noauto 0 0 -tmpfs /dev/shm tmpfs defaults,noauto 0 0 /dev/cdrom /mnt/cdrom auto defaults,noauto 0 0 diff --git a/rescue/tree/etc/hostname b/rescue/tree/etc/hostname new file mode 100644 index 000000000..344f71bc8 --- /dev/null +++ b/rescue/tree/etc/hostname @@ -0,0 +1 @@ +rescue diff --git a/rescue/tree/etc/inittab b/rescue/tree/etc/inittab deleted file mode 100644 index 6a30c0360..000000000 --- a/rescue/tree/etc/inittab +++ /dev/null @@ -1,16 +0,0 @@ -#Inittab for Mageia Rescue Disk -#Author: Daouda Lo -id:3:initdefault: - -si::sysinit:/etc/rc.sysinit -re:6:wait:/etc/rc.reboot -ca:12345:ctrlaltdel:/sbin/fakeshutdown - -1:12345:respawn:/sbin/mingetty --autologin root tty1 -2:23:respawn:/sbin/mingetty --autologin root tty2 -3:23:respawn:/sbin/mingetty --autologin root tty3 -4:23:respawn:/sbin/mingetty --autologin root tty4 -5:23:respawn:/sbin/mingetty --autologin root tty5 -6:23:respawn:/sbin/mingetty --autologin root tty6 -s0:2345:respawn:/sbin/agetty -h -t 60 ttyS0 9600 ansi -#s1:2345:respawn:/sbin/agetty -h -t 60 ttyS1 115200,9600 linux diff --git a/rescue/tree/etc/issue b/rescue/tree/etc/issue index c5a4c7fb8..11f9f3102 100644 --- a/rescue/tree/etc/issue +++ b/rescue/tree/etc/issue @@ -26,4 +26,5 @@ Use [1;33;40mdrvinst[0m to install drivers according to detected devices Use [1;33;40mlsparts[0m to list your partitions with types Use [1;33;40mstartssh[0m to start an ssh daemon Use [1;33;40mrescue-gui[0m to go back to the rescue menu +Use [1;33;40mgrabjournallogs[0m to grab the last 24 hours of journal logs diff --git a/rescue/tree/etc/passwd b/rescue/tree/etc/passwd index 3a1254f77..c0274a116 100644 --- a/rescue/tree/etc/passwd +++ b/rescue/tree/etc/passwd @@ -1,3 +1,2 @@ root::0:0::/root:/bin/bash -shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown -halt:*:7:0:halt:/sbin:/sbin/halt +messagebus:x:1:1::/:/sbin/nologin diff --git a/rescue/tree/etc/profile b/rescue/tree/etc/profile index 3478e2971..17f0700dc 100644 --- a/rescue/tree/etc/profile +++ b/rescue/tree/etc/profile @@ -6,7 +6,7 @@ PROFILE_LOADED=1 -export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin +PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sbin:/mnt/bin:/mnt/usr/sbin:/mnt/usr/bin PS1="[root@rescue \w]\\$ " ls () { /bin/ls --color=auto -F "$@";} diff --git a/rescue/tree/etc/rc.reboot b/rescue/tree/etc/rc.reboot deleted file mode 100755 index 0b67416f1..000000000 --- a/rescue/tree/etc/rc.reboot +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -sleep 1 -/sbin/killall5 -9 - -umount -a -f -t noproc - -reboot -i -d diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit deleted file mode 100755 index 96d2f7d88..000000000 --- a/rescue/tree/etc/rc.sysinit +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh - -action() { echo $1; shift; $*; } -DATE=`date +%Y%m%d-%Hh%M` -KADIR="/ka2" - -export PATH=/bin:/sbin:/usr/bin:/usr/sbin - -echo -e "\t\t\tWelcome to \\033[1;36mMageia\\033[0;39m Linux" - -action "Remounting root filesystem in read-write mode" mount -n -o remount,rw / - -echo "Starting udev" -mkdir /run -mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run -mkdir -p /run/udev/rules.d -export UDEVRULESD=/run/udev/rules.d -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev -mkdir /dev/pts -mkdir /dev/shm -mount /dev/pts -mount /dev/shm - -/lib/udev/udevd --daemon --resolve-names=never -udevadm trigger --type=subsystems --action=add -udevadm trigger --type=devices --action=add - -ln -s /tmp/stage2/etc/* /etc 2>/dev/null -# make passwd changable -rm -f /etc/passwd -cp /tmp/stage2/etc/passwd /etc/ - -mkdir -p /mnt /var/log - ->/etc/mtab -mount -f / -mount -f /proc - -# Set the hostname. -action "Setting hostname rescue" hostname rescue -echo rescue > /etc/HOSTNAME - -# Loads common modules ( no kerneld :( ) -echo "Loading additional modules..." -load() { modprobe $* 2>/dev/null; } -load ide-gd_mod -load ide-cd_mod -load floppy -load af_packet -load isofs -load vfat -load ext3 -load ext4 -load reiserfs -load xfs -load jfs -load loop -load sd_mod -load sr_mod - -echo "Setting local loop" -/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 -/sbin/route add 127.0.0.1 lo - -# disable the weird echoprt in cooked mode for user interaction: -stty sane - -#LANGUAGE (filled by make_rescue_img) - -grep -q noauto /proc/cmdline || drvinst SERIAL_USB - -partimage_default_dir=/data/box -partimage_dir=`perl -lne 'print $1 if /BOX=(\S+)/' /proc/cmdline` -[ -z "$partimage_dir" ] && partimage_dir=$partimage_default_dir -partimage_server=`perl -lne 'print $1 if /\bpserver=(\S+)/' /proc/cmdline` - -if grep -q save_all /proc/cmdline; then - partimage_whole_disk -s $partimage_server save_all $partimage_default_dir -elif grep -q rest_all /proc/cmdline; then - if [ -d /tmp/image$partimage_dir ]; then - partimage_whole_disk rest_all /tmp/image$partimage_dir - else - partimage_whole_disk -s $partimage_server rest_all $partimage_dir - fi -elif grep -q oem /proc/cmdline; then - /tmp/image/oem-rescue.sh -elif grep -q restore /proc/cmdline; then - /usr/sbin/restore-image.sh -elif grep -q kamethod /proc/cmdline; then - echo "Welcome to Ka" - drvinst - ln -sf /tmp/stage2/ka $KADIR - ln -sf /tmp/stage2/disk /disk - cd $KADIR - echo "-------- Starting LOG server -------------" - perl send_status.pl > /tmp/kacmd & - exec ./ka_replication.sh > /tmp/ka_log-$HOSTNAME-$DATE 2>&1 -elif ! grep -q expert /proc/cmdline; then - echo "starting GUI" - rescue-gui -fi diff --git a/rescue/tree/sbin/fakeshutdown b/rescue/tree/sbin/fakeshutdown deleted file mode 100755 index fa4d2acc9..000000000 --- a/rescue/tree/sbin/fakeshutdown +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl - -# -# Guillaume Cottenceau (gc) -# -# Copyright 2001 Mandrakesoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } - -print "\n"; - - -#- try to umount as much as possible; uses Pixel's ultra optimized algo (let you guess how it works..) -print "Umounting:\n"; -my @mounts = cat_('/proc/mounts'); -my $something_moved; -do { - $something_moved = 0; - foreach (@mounts) { - my $where = (split)[1]; - next if $where eq '/'; #- ouch! umounting the ramdisk on / always succeeds, and makes it becoming ro :-( - if (!system("umount $where 2>/dev/null")) { - print "\t$where\n"; - $something_moved++; - } - } -} while $something_moved; - - -#- shutdown with init -exec '/sbin/init', 6; diff --git a/rescue/tree/sbin/modprobe b/rescue/tree/sbin/modprobe deleted file mode 100755 index a9cd91a89..000000000 --- a/rescue/tree/sbin/modprobe +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl - -use lib qw(/usr/lib/libDrakX); -use list_modules; -use modules; - -# based on install::commands -sub modprobe { - !@_ || $_[0] =~ /^-?-h/ and die "usage: modprobe <module> [<options...>]\n"; - my $name = shift; - list_modules::load_default_moddeps(); - modules::load_with_options([ $name ], { $name => join(' ', @_) }); -} - -$::isInstall = 1; -modprobe(@ARGV); diff --git a/rescue/tree/bin/login b/rescue/tree/usr/bin/login index 4b2816926..4b2816926 100755 --- a/rescue/tree/bin/login +++ b/rescue/tree/usr/bin/login diff --git a/rescue/tree/usr/bin/mageia-rescue b/rescue/tree/usr/bin/mageia-rescue new file mode 100755 index 000000000..7d8bb5135 --- /dev/null +++ b/rescue/tree/usr/bin/mageia-rescue @@ -0,0 +1,42 @@ +#!/bin/sh + +# Uncomment for debugging: +# set -x + +systemctl start systemd-udevd +udevadm trigger --type=subsystems --action=add +udevadm trigger --type=devices --action=add + +# disable the weird echoprt in cooked mode for user interaction: +stty sane + +#LANGUAGE (filled by make_rescue_img) + +grep -q noauto /proc/cmdline || drvinst SERIAL_USB + +partimage_default_dir=/data/box +partimage_dir=`perl -lne 'print $1 if /BOX=(\S+)/' /proc/cmdline` +[ -z "$partimage_dir" ] && partimage_dir=$partimage_default_dir +partimage_server=`perl -lne 'print $1 if /\bpserver=(\S+)/' /proc/cmdline` + +LOOP="" +if grep -q save_all /proc/cmdline; then + partimage_whole_disk -s $partimage_server save_all $partimage_default_dir +elif grep -q rest_all /proc/cmdline; then + if [ -d /tmp/image$partimage_dir ]; then + partimage_whole_disk rest_all /tmp/image$partimage_dir + else + partimage_whole_disk -s $partimage_server rest_all $partimage_dir + fi +elif grep -q oem /proc/cmdline; then + /tmp/image/oem-rescue.sh +elif grep -q restore /proc/cmdline; then + /usr/sbin/restore-image.sh +elif ! grep -q expert /proc/cmdline; then + rescue-gui && LOOP=y +fi + +while [ "$LOOP" ]; do + bash --login + rescue-gui +done diff --git a/rescue/tree/usr/lib/CVS. b/rescue/tree/usr/lib/CVS. deleted file mode 100644 index e69de29bb..000000000 --- a/rescue/tree/usr/lib/CVS. +++ /dev/null diff --git a/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf b/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf new file mode 100644 index 000000000..9d9850baf --- /dev/null +++ b/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf @@ -0,0 +1,8 @@ +ide-gd_mod +ide-cd_mod +floppy +af_packet +loop +fuse +sd_mod +sr_mod diff --git a/rescue/restore-image-lib.sh b/rescue/tree/usr/lib/restore-image-lib.sh index 3451f7be5..3451f7be5 100755 --- a/rescue/restore-image-lib.sh +++ b/rescue/tree/usr/lib/restore-image-lib.sh diff --git a/rescue/tree/usr/lib/systemd/system/rescue.service b/rescue/tree/usr/lib/systemd/system/rescue.service new file mode 100644 index 000000000..336e06c22 --- /dev/null +++ b/rescue/tree/usr/lib/systemd/system/rescue.service @@ -0,0 +1,20 @@ +[Unit] +Description=Mageia Rescue +DefaultDependencies=no +Conflicts=shutdown.target +After=sysinit.target plymouth-start.service +Before=shutdown.target + +[Service] +Environment=HOME=/ +WorkingDirectory=/ +ExecStartPre=-/bin/plymouth quit +ExecStart=/usr/bin/mageia-rescue +ExecStopPost=-/usr/bin/systemctl --fail --no-block reboot +Type=idle +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit +KillMode=process +IgnoreSIGPIPE=no +SendSIGHUP=yes diff --git a/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf b/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf new file mode 100644 index 000000000..b75df2e4e --- /dev/null +++ b/rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf @@ -0,0 +1 @@ +ExecStartPre=-/usr/bin/rm -f /etc/udev/rules.d/10-console.rules diff --git a/rescue/diskdrake-resize b/rescue/tree/usr/sbin/diskdrake-resize index 88372aac7..88372aac7 100755 --- a/rescue/diskdrake-resize +++ b/rescue/tree/usr/sbin/diskdrake-resize diff --git a/rescue/genpasswd b/rescue/tree/usr/sbin/genpasswd index 2f129673d..2f129673d 100755 --- a/rescue/genpasswd +++ b/rescue/tree/usr/sbin/genpasswd diff --git a/rescue/tree/usr/sbin/grabjournallogs b/rescue/tree/usr/sbin/grabjournallogs new file mode 100755 index 000000000..ef2ea4a1d --- /dev/null +++ b/rescue/tree/usr/sbin/grabjournallogs @@ -0,0 +1,51 @@ +#!/bin/bash + +if ! mountpoint -q /mnt ; then + echo "I do not seem to see a Mageia install mounted on /mnt. You need to mount it first!" >&2 + exit 1 +fi + +if [ ! -f /mnt/etc/machine-id ]; then + echo "Cannot find machine-id file (/mnt/etc/machine-id)" >&2 + exit 1 +fi + +MID=$(cat /mnt/etc/machine-id) +echo +echo "Found machine-id: $MID" +if [ ! -d /mnt/var/log/journal/$MID ]; then + echo "Cannot find journal log directory (/mnt/var/log/journal/<machine-id>)" >&2 + exit 1 +fi + +TIMEFRAME=24 +if [ -n "$1" ]; then + NEWTIMEFRAME=$(( 0 + $1 )) + if [ $NEWTIMEFRAME -gt 0 ]; then + TIMEFRAME=$NEWTIMEFRAME + fi +fi +SINCE="$(LC_ALL=c date --date=$TIMEFRAME' hours ago' +'%F %T')" +echo "Will collect logs from the last $TIMEFRAME hour(s)" +echo " NB give numeric argument to override capture period" + +TEMPFILE=$(mktemp /tmp/grabjournallogs.XXXXXX) +echo -n "Extracting logs... " +journalctl -D /mnt/var/log/journal/$MID --since "$SINCE" -o short >$TEMPFILE +echo "done" + +if [ $(cat $TEMPFILE | wc -l) -lt 2 ]; then + rm -f $TEMPFILE + echo >&2 + echo "Cannot find any logs. Consider increasing the capture period by passing a" >&2 + echo "numeric argument larger than $TIMEFRAME." >&2 + exit 1 +fi + +echo -n "Compressing logs... " +cat $TEMPFILE | xz >/journallogs.xz +rm -f $TEMPFILE +echo "done" + +echo +echo "Your logs have been extracted to the file 'journallogs.xz'" diff --git a/rescue/restore-image.sh b/rescue/tree/usr/sbin/restore-image.sh index 32eec242d..f4f904f3f 100755 --- a/rescue/restore-image.sh +++ b/rescue/tree/usr/sbin/restore-image.sh @@ -389,7 +389,6 @@ EOF if [ -n "$MKINITRD" ]; then mount -t sysfs none "$mnt_dir/sys" mount -t proc none "$mnt_dir/proc" - echo > /proc/sys/kernel/modprobe # rescue's modprobe does not handle modprobe -q and aliases chroot $mnt_dir bootloader-config --action rebuild-initrds umount "$mnt_dir/sys" umount "$mnt_dir/proc" diff --git a/rescue/startssh b/rescue/tree/usr/sbin/startssh index e14bb10e8..e14bb10e8 100755 --- a/rescue/startssh +++ b/rescue/tree/usr/sbin/startssh diff --git a/rescue/tree/usr/share/symlinks b/rescue/tree/usr/share/symlinks deleted file mode 100644 index 659a42c8c..000000000 --- a/rescue/tree/usr/share/symlinks +++ /dev/null @@ -1,9 +0,0 @@ -/bin -/boot -/etc/fstab -/etc/inittab -/etc/rc.sysinit -/lib -/lib64 -/sbin -/usr |