From 645e6932216fddd154865a9bebb0fd0e3beed301 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 1 Dec 2013 20:57:39 +0000 Subject: rescue: Avoid having to run dracut convertfs script by setting up the tree. We can easily avoid post processing the tree simply by moving the tree around and ensuring we set it up correctly (with the compat symlinks) early in the process. --- rescue/make_rescue_img | 15 +++++++++------ rescue/tree/bin/login | 2 -- rescue/tree/sbin/fakeshutdown | 39 --------------------------------------- rescue/tree/usr/bin/login | 2 ++ rescue/tree/usr/sbin/fakeshutdown | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 47 deletions(-) delete mode 100755 rescue/tree/bin/login delete mode 100755 rescue/tree/sbin/fakeshutdown create mode 100755 rescue/tree/usr/bin/login create mode 100755 rescue/tree/usr/sbin/fakeshutdown (limited to 'rescue') diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img index 18c045acb..432a6cf94 100755 --- a/rescue/make_rescue_img +++ b/rescue/make_rescue_img @@ -15,20 +15,23 @@ 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"; +_ "mkdir -p $tmp/usr/{bin,sbin,lib}"; +_ "ln -s usr/bin $tmp/bin"; +_ "ln -s usr/sbin $tmp/sbin"; +_ "ln -s usr/lib $tmp/lib"; +if ($arch eq "x86_64") { + _ "mkdir $tmp/usr/lib64"; + _ "ln -s usr/lib64 $tmp/lib64"; +} _ 'find . -name "*~" | xargs rm -f'; mkdir_p($tmp . chomp_($_)) foreach cat_("dirs"); _ "cp -a tree/* $tmp"; -_ "find $tmp -name .svn | xargs rm -rf"; 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"; - my %keytable_conflicts; my @less_important_keytables = qw(am_old am_phonetic no-dvorak de-latin1); foreach (keyboard::loadkeys_files(sub { warn @_ })) { diff --git a/rescue/tree/bin/login b/rescue/tree/bin/login deleted file mode 100755 index 4b2816926..000000000 --- a/rescue/tree/bin/login +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /bin/bash --login 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/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; -- cgit v1.2.1