summaryrefslogtreecommitdiffstats
path: root/rescue/install_bootloader
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
committerAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
commit530a16ec071db0e24e6e949e265a96848864967c (patch)
treefe40cacd28d67b98186754c551b7fd339ebc7e17 /rescue/install_bootloader
downloaddrakx-530a16ec071db0e24e6e949e265a96848864967c.tar
drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.gz
drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.bz2
drakx-530a16ec071db0e24e6e949e265a96848864967c.tar.xz
drakx-530a16ec071db0e24e6e949e265a96848864967c.zip
add mes5-2.6.33 branch
Diffstat (limited to 'rescue/install_bootloader')
-rwxr-xr-xrescue/install_bootloader69
1 files changed, 69 insertions, 0 deletions
diff --git a/rescue/install_bootloader b/rescue/install_bootloader
new file mode 100755
index 000000000..e8bc04ad8
--- /dev/null
+++ b/rescue/install_bootloader
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+#
+# Guillaume Cottenceau
+#
+# Copyright 2001-2005 Mandriva
+#
+# 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.
+#
+
+use lib qw(/usr/lib/libDrakX);
+use common;
+use bootloader;
+use fs;
+
+if ($ARGV[0] eq '--auto') {
+ $auto = shift @ARGV;
+}
+
+$::prefix = '/mnt';
+
+my $release = common::mandrake_release($::prefix) ||
+ do {
+ system('guessmounts') == 0 or die 'guessmounts failed';
+ common::mandrake_release($::prefix);
+ };
+
+if ($release) {
+ $release =~ /Mandrake|Mandriva/ or die "release file doesn't contain 'Mandriva', exiting.\n";
+} elsif (fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ])) {
+ die "unknown distribution mounted in $::prefix\n";
+} else {
+ die "Your root device isn't mounted on $::prefix\n";
+}
+
+my @main_methods = bootloader::configured_main_methods();
+
+my $main_method;
+if (@main_methods == 0) {
+ die "Cannot find a configured boot loader\n";
+} elsif (@main_methods == 1) {
+ ($main_method) = @main_methods;
+} else {
+ while (1) {
+ print "Configuration files for Boot Loaders ", join(' and ', @main_methods), " were found.\n";
+ print "Which one one should be installed? ";
+ chomp($main_method = <STDIN>);
+ if (member($main_method, @main_methods)) {
+ last;
+ } else {
+ print "bad choice\n";
+ }
+ }
+}
+
+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 Mandriva Linux distribution:\n\t",
+ $release, "\n";
+if (!$auto) {
+ print "=> ok? <press Enter to continue, 'n' and Enter to cancel> ";
+ <STDIN> =~ /^n/i and exit 0;
+}
+
+$install->();