8a74b9356f67011fac722c2f0cbc4100752544f3
3 # (c) Michael Goetze, 2011, mgoetze@mgoetze.net
4 # (c) Thomas Lange 2014
6 error
=0; trap 'error=$(($?>$error?$?:$error))' ERR
# save maximum error code
8 if [ -r $LOGDIR/disk_var.sh
] ; then
11 echo "disk_var.sh not found!"
16 # CentOS 7 does not have a device.map file, so generate one
17 if [ -d $target/boot
/grub2
-a ! -f $target/boot
/grub
2/device.map
]; then
18 echo "# Generated by FAI" >> $target/boot
/grub
2/device.map
19 centosdisks
=$
(awk '/[sv]d.$/ {print $4}' /proc
/partitions |
sort)
21 for d
in $centosdisks; do
22 echo "(hd$dcount) /dev/$d" >> $target/boot
/grub
2/device.map
23 dcount
=$
((dcount
+ 1))
27 bootdev
=$
(device2grub
$BOOT_DEVICE)
28 bootpart
=$
(device2grub
$BOOT_PARTITION)
29 version
=$
($ROOTCMD rpm
-qv kernel | cut
-d- -f2-)
31 if grep '[[:space:]]/boot[[:space:]]' $LOGDIR/fstab
; then
37 mount
-o bind /dev
$target/dev
41 if [ -f $target/usr
/sbin
/grub2-install
]; then
44 $ROOTCMD grub2-install
--no-floppy "$BOOT_DEVICE"
45 $ROOTCMD grub2-mkconfig
--output=/boot
/grub
2/grub.cfg
48 $ROOTCMD grub-install
--just-copy
50 $ROOTCMD grub
--device-map=/dev
/null
--no-floppy --batch <<-EOF
51 device $bootdev $BOOT_DEVICE
57 ln -s .
/menu.lst
$target/boot
/grub
/grub.conf
59 if [ -f $target/boot
/grub
/splash.xpm.gz
]; then
60 pretty
="splashimage=$bootpart$bootdir/grub/splash.xpm.gz"
62 pretty
="color cyan/blue white/blue"
65 if [ -f $target/sbin
/dracut
-o -f $target/usr
/sbin
/dracut
]; then
72 title
=$
(head -1 $target/etc
/redhat-release
)
74 cat > $target/boot
/grub
/grub.conf
<<-EOF
82 kernel $bootdir/vmlinuz-$version root=$ROOT_PARTITION ro
83 initrd $bootdir/$iname-$version.img
91 echo "Grub installed on $BOOT_DEVICE = $bootdev"
92 echo "Grub boot partition is $BOOT_PARTITION = $bootpart"
93 echo "Root partition is $ROOT_PARTITION"
94 echo "Boot kernel: $version"