~ubuntu-installer/grub-installer/master

« back to all changes in this revision

Viewing changes to rescue.d/80grub-reinstall

  • Committer: Colin Watson
  • Date: 2006-01-11 10:48:12 UTC
  • Revision ID: git-v1:3635f9f9993bb8638dbcc64c50857eed0e4e0a45
* Add a rescue script to reinstall grub (requires rescue-mode 0.8).

r33933

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
. /usr/share/debconf/confmodule
 
4
 
 
5
. /usr/share/grub-installer/functions.sh
 
6
 
 
7
db_progress START 0 2 grub-installer/progress/title
 
8
db_progress INFO grub-installer/progress/step_bootdev
 
9
 
 
10
db_input critical grub-installer/bootdev
 
11
if ! db_go; then
 
12
        # back up to menu
 
13
        db_progress STOP
 
14
        exit 10
 
15
fi
 
16
 
 
17
db_get grub-installer/bootdev
 
18
bootdev="$RET"
 
19
if echo "$bootdev" | grep -qv '('; then
 
20
        mappedbootdev="$(mapdevfs "$bootdev")" || true
 
21
        if [ "$mappedbootdev" ]; then
 
22
                bootdev="$mappedbootdev"
 
23
        fi
 
24
fi
 
25
 
 
26
db_progress STEP 1
 
27
db_subst grub-installer/progress/step_install_loader BOOTDEV "$bootdev"
 
28
db_progress INFO grub-installer/progress/step_install_loader
 
29
 
 
30
update_mtab
 
31
 
 
32
if ! is_floppy "$bootdev"; then
 
33
        if chroot /target /sbin/grub-install -h 2>&1 | grep -q no-floppy; then
 
34
                floppyparam="--no-floppy"
 
35
        fi
 
36
fi
 
37
 
 
38
if ! log-output -t grub-installer chroot /target /sbin/grub-install --recheck $floppyparam "$bootdev"; then
 
39
        db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
 
40
        db_input critical grub-installer/grub-install-failed BOOTDEV "$bootdev"
 
41
        db_go || true
 
42
        db_progress STOP
 
43
        exit 1
 
44
fi
 
45
 
 
46
db_progress STEP 1
 
47
db_progress STOP