wok-stable view dmraid/stuff/grub-dmraid @ rev 8555
imported patch get/firefox-langpack-zh_TW
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sun Feb 13 22:57:56 2011 +0100 (2011-02-13) |
parents | 1a703730ac71 |
children |
line source
1 #!/bin/sh
3 grub_part=0
4 [ -n "$1" ] && case "$1" in
5 [0-9]*) grub_part=$1;;
6 *) cat 1>&2 <<EOT
7 Usage: $0 [partition]
8 Install grub on dmraid device. Default partition is 0.
9 EOT
10 exit 2;;
11 esac
13 # Get raid parameters
14 dev=/dev/mapper/$(dmraid -s 2> /dev/null | grep ^name | awk '{ print $3 }')
15 if [ "$dev" == "/dev/mapper/" ]; then
16 echo "No dmraid device found." 1>&2
17 exit 1
18 fi
20 # Ensure raid is active
21 [ ! -e $dev ] && dmraid-start
23 geometry="$(fdisk -l $dev | grep heads | sed \
24 's|\(.*\) heads, \(.*\) sectors/track, \(.*\) cylinders|\3 \1 \2|')"
26 # Grub bug workaround
27 for i in ${dev}p* ; do
28 n=${i#${dev}p}
29 [ -e $i -a ! -e ${dev}$n ] && ln -s $(basename $dev)p$n ${dev}$n
30 done
32 # Let's go
33 grub --device-map=/dev/null --batch <<EOT
34 device (hd0) $dev
35 geometry (hd0) $geometry
36 root (hd0,$grub_part)
37 setup (hd0)
38 quit
39 EOT