summaryrefslogtreecommitdiffstats
path: root/rescue/tree/usr
diff options
context:
space:
mode:
Diffstat (limited to 'rescue/tree/usr')
-rwxr-xr-xrescue/tree/usr/bin/login2
-rwxr-xr-xrescue/tree/usr/sbin/fakeshutdown39
2 files changed, 41 insertions, 0 deletions
diff --git a/rescue/tree/usr/bin/login b/rescue/tree/usr/bin/login
new file mode 100755
index 000000000..4b2816926
--- /dev/null
+++ b/rescue/tree/usr/bin/login
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /bin/bash --login
diff --git a/rescue/tree/usr/sbin/fakeshutdown b/rescue/tree/usr/sbin/fakeshutdown
new file mode 100755
index 000000000..309f26c6c
--- /dev/null
+++ b/rescue/tree/usr/sbin/fakeshutdown
@@ -0,0 +1,39 @@
+#!/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;