summaryrefslogtreecommitdiffstats
path: root/rescue/tree/usr
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-12-01 22:29:20 +0000
committerColin Guthrie <colin@mageia.org>2013-12-07 18:32:06 +0000
commitc4634f60b5c6d67eedfedc02166499884e4d6625 (patch)
tree844fb25572edbf617eaeccc7633d0031e7df1ec6 /rescue/tree/usr
parent645e6932216fddd154865a9bebb0fd0e3beed301 (diff)
downloaddrakx-c4634f60b5c6d67eedfedc02166499884e4d6625.tar
drakx-c4634f60b5c6d67eedfedc02166499884e4d6625.tar.gz
drakx-c4634f60b5c6d67eedfedc02166499884e4d6625.tar.bz2
drakx-c4634f60b5c6d67eedfedc02166499884e4d6625.tar.xz
drakx-c4634f60b5c6d67eedfedc02166499884e4d6625.zip
rescue: Use systemd as initsystem.
This commit converts the rescue system to systemd rather than the legacy sysvinit. Besides being faster, one primary advantage of running systemd here is that we can "boot" the system we're inspecting via systemd-nspawn to properly test it. Note: Bits that don't work: * nspawn * old dracut initqueue udev rules in /etc/ are not cleaned out (drop in support error?) * the gui may loop differently now
Diffstat (limited to 'rescue/tree/usr')
-rwxr-xr-xrescue/tree/usr/bin/mageia-rescue35
-rw-r--r--rescue/tree/usr/lib/CVS.0
-rw-r--r--rescue/tree/usr/lib/modules-load.d/mageia-rescue.conf17
-rw-r--r--rescue/tree/usr/lib/systemd/system/rescue.service20
-rw-r--r--rescue/tree/usr/lib/systemd/system/systemd-udevd.service.d/dracut-rules.conf1
-rwxr-xr-xrescue/tree/usr/sbin/fakeshutdown39
-rw-r--r--rescue/tree/usr/share/symlinks4
7 files changed, 73 insertions, 43 deletions
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/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/tree/usr/sbin/fakeshutdown b/rescue/tree/usr/sbin/fakeshutdown
deleted file mode 100755
index 309f26c6c..000000000
--- a/rescue/tree/usr/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/usr/share/symlinks b/rescue/tree/usr/share/symlinks
deleted file mode 100644
index 091153872..000000000
--- a/rescue/tree/usr/share/symlinks
+++ /dev/null
@@ -1,4 +0,0 @@
-/boot
-/etc/fstab
-/etc/inittab
-/etc/rc.sysinit