summaryrefslogtreecommitdiffstats
path: root/rescue/bin/install_bootloader
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-12-02 23:40:22 +0000
committerColin Guthrie <colin@mageia.org>2013-12-07 18:32:06 +0000
commite7aedc3aa7e08f3337c86085c6da10ca83445024 (patch)
tree4005be196198d60c655e345d43fef926bbac6702 /rescue/bin/install_bootloader
parent2ad4c4fc0b990dd0db23cdee815ac2a13c60929d (diff)
downloaddrakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.gz
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.bz2
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.tar.xz
drakx-e7aedc3aa7e08f3337c86085c6da10ca83445024.zip
rescue: Move files around and introduce proper dep tracking.
This moves any perl files into bin and sbin folders which will be directly installed in /usr/bin and /usr/sbin. This is done such that the extract modes in list.xml still work and the files end up in the right places. All other files have been moved into the tree folder in their final destination.
Diffstat (limited to 'rescue/bin/install_bootloader')
-rwxr-xr-xrescue/bin/install_bootloader72
1 files changed, 72 insertions, 0 deletions
diff --git a/rescue/bin/install_bootloader b/rescue/bin/install_bootloader
new file mode 100755
index 000000000..7328de1d2
--- /dev/null
+++ b/rescue/bin/install_bootloader
@@ -0,0 +1,72 @@
+#!/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;
+
+my $auto;
+if ($ARGV[0] eq '--auto') {
+ $auto = shift @ARGV;
+}
+
+$::prefix = '/mnt';
+
+my $release = common::mageia_release($::prefix) ||
+ do {
+ system('guessmounts') == 0 or die 'guessmounts failed';
+ common::mageia_release($::prefix);
+ };
+
+if ($release) {
+ $release =~ /Mageia|Mandriva/ or die "release file doesn't contain '%s', 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 %s distribution:\n\t",
+ $release, "\n";
+if (!$auto) {
+ print "=> ok? <press Enter to continue, 'n' and Enter to cancel> ";
+ <STDIN> =~ /^n/i and exit 0;
+}
+
+run_program::run('mount', '--bind', '/dev', "$::prefix/dev");
+$install->();
+run_program::run('umount', "$::prefix/dev");