diff options
Diffstat (limited to 'rescue')
33 files changed, 229 insertions, 209 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/Makefile b/rescue/Makefile index 9e6b80637..a53703d0f 100644 --- a/rescue/Makefile +++ b/rescue/Makefile @@ -1,6 +1,6 @@ include ../Makefile.config -VERSION=1.45.1 +VERSION=1.47 PRODUCT=drakx-installer-rescue RESCUE = rescue.sqfs @@ -10,7 +10,7 @@ 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 DISTRIB_DESCR=$(DISTRIB_DESCR) ./make_rescue_img dist: tar diff --git a/rescue/NEWS b/rescue/NEWS index 57cf609ae..c2a820493 100644 --- a/rescue/NEWS +++ b/rescue/NEWS @@ -1,3 +1,12 @@ +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 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 4868b42e0..4868b42e0 100755 --- a/rescue/drvinst +++ b/rescue/bin/drvinst diff --git a/rescue/guessmounts b/rescue/bin/guessmounts index 27b920c9d..27b920c9d 100755 --- a/rescue/guessmounts +++ b/rescue/bin/guessmounts diff --git a/rescue/install_bootloader b/rescue/bin/install_bootloader index 7328de1d2..7328de1d2 100755 --- a/rescue/install_bootloader +++ b/rescue/bin/install_bootloader diff --git a/rescue/lsparts b/rescue/bin/lsparts index 8d36a02f4..8d36a02f4 100755 --- a/rescue/lsparts +++ b/rescue/bin/lsparts diff --git a/rescue/rescue-doc b/rescue/bin/rescue-doc index e6514b462..e6514b462 100755 --- a/rescue/rescue-doc +++ b/rescue/bin/rescue-doc 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/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 fb73f4df4..d4c0adcb4 100644 --- a/rescue/list.xml +++ b/rescue/list.xml @@ -150,12 +150,6 @@ </if> </from> -<from dir="/usr/LIB/drakx-installer-sysvinit/" expand="glob"> - <to dir="/sbin"> - init - </to> -</from> - <from> /usr/lib/kbd/keymaps/include <if ARCH="i.86|x86_64"> @@ -272,10 +266,107 @@ </from> <from dir="/usr/lib/systemd"> + systemd + systemd-cgroups-agent + systemd-shutdown + systemd-reply-password + systemd-fsck systemd-udevd + systemd-journald + systemd-machined + systemd-sysctl + systemd-modules-load + systemd-vconsole-setup + system-generators/systemd-fstab-generator +</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 + system.slice +</from> + +<from expand="binary"> + journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles systemd-nspawn dbus-daemon machinectl +</from> + +<from> + /etc/dbus-1/system.conf + /etc/dbus-1/system.d/org.freedesktop.systemd1.conf + /etc/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="/lib/udev/rules.d"> +<from dir="/usr/lib/udev"> + ata_id + scsi_id +</from> + +<from dir="/usr/lib/udev/rules.d"> 10-dm.rules 11-dm-lvm.rules 13-dm-disk.rules @@ -319,15 +410,18 @@ <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> <from dir="/usr/lib/libDrakX" expand="glob"> @@ -348,20 +442,6 @@ dhcp-client </to> </from> -<from dir="."> - <to dir="/usr/sbin"> - diskdrake-resize - genpasswd - startssh - grabjournallogs - </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_rescue_img b/rescue/make_rescue_img index 18c045acb..8e3f64334 100755 --- a/rescue/make_rescue_img +++ b/rescue/make_rescue_img @@ -15,19 +15,29 @@ 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"; -# / -> /usr move -_ "mkdir -p $tmp/usr/{,s}bin"; -_ "/usr/lib/dracut/modules.d/30convertfs/convertfs.sh $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); @@ -44,20 +54,14 @@ foreach (keyboard::loadkeys_files(sub { warn @_ })) { } } -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/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/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/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 551a4bc76..000000000 --- a/rescue/tree/etc/rc.sysinit +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -action() { echo $1; shift; $*; } -DATE=`date +%Y%m%d-%Hh%M` - -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 - -/usr/lib/systemd/systemd-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 nilfs2 -load btrfs -load xfs -load jfs -load loop -load fuse -load sd_mod -load sr_mod - -action "Bringing up local loop interface" ifconfig lo up - -# 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 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 309f26c6c..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. -# - -# From MDK::Common: -sub cat_ { open(my $F, '<', $_[0]) or die "cat of file $_[0] failed: $!\n"; 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/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..c9dd35661 --- /dev/null +++ b/rescue/tree/usr/bin/mageia-rescue @@ -0,0 +1,35 @@ +#!/bin/sh + +# 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..4111c0484 --- /dev/null +++ b/rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf @@ -0,0 +1,17 @@ +ide-gd_mod +ide-cd_mod +floppy +af_packet +isofs +vfat +ext3 +ext4 +reiserfs +nilfs2 +btrfs +xfs +jfs +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/grabjournallogs b/rescue/tree/usr/sbin/grabjournallogs index ef2ea4a1d..ef2ea4a1d 100755 --- a/rescue/grabjournallogs +++ b/rescue/tree/usr/sbin/grabjournallogs diff --git a/rescue/restore-image.sh b/rescue/tree/usr/sbin/restore-image.sh index f4f904f3f..f4f904f3f 100755 --- a/rescue/restore-image.sh +++ b/rescue/tree/usr/sbin/restore-image.sh 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 |