Magellan Linux

Contents of /trunk/installer-simple/functions/grub.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2446 - (show annotations) (download) (as text)
Tue Jan 7 14:56:12 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 2117 byte(s)
-disable old mkinitrd and bootloader functions (will get removed soon) and add includes to support grub1, grub2, mkinitrd and dracut
1 bootloader_config()
2 {
3 local grubconf="/boot/grub/grub.conf"
4
5 if [ -e ${INSTALLROOT}/boot/kernelversion ]
6 then
7 source ${INSTALLROOT}/boot/kernelversion
8 else
9 die $"${INSTALLROOT}/boot/kernelversion is missing"
10 fi
11
12 if [ -e ${INSTALLROOT}/etc/alx_version ]
13 then
14 OLD_ALXVER="${ALXVER}"
15 source ${INSTALLROOT}/etc/alx_version
16 KRNVER="ALX-${ALXVER}"
17 ALXVER="${OLD_ALXVER}"
18 fi
19
20 [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX"
21 [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd"
22 [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz"
23
24 # uuid support
25 if is_uuid_supported
26 then
27 my_roothdd="UUID=$(get_uuid ${ROOTHDD})"
28 else
29 my_roothdd="${ROOTHDD}"
30 fi
31
32 CONFIG="${INSTALLROOT}/${grubconf}"
33 clearconfig
34 addconfig "default 0"
35 addconfig "timeout 3"
36 # using current root password
37 addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)"
38
39 addconfig
40 addconfig "# normal boot"
41 addconfig "title ${KRNVER}"
42 addconfig "root (hd0,0)"
43 addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}"
44 if is_initrd_supported
45 then
46 addconfig "initrd /boot/${KRNINITRD}"
47 fi
48
49 addconfig
50 addconfig "# admin boot"
51 addconfig "title ${KRNVER} - Re-run hardware-detection"
52 addconfig "lock"
53 addconfig "root (hd0,0)"
54 addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection"
55 if is_initrd_supported
56 then
57 addconfig "initrd /boot/${KRNINITRD}"
58 fi
59
60 addconfig
61 addconfig "title ${KRNVER} - Reset *all* local settings"
62 addconfig "lock"
63 addconfig "root (hd0,0)"
64 addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings"
65 if is_initrd_supported
66 then
67 addconfig "initrd /boot/${KRNINITRD}"
68 fi
69 }
70
71 bootloader_install()
72 {
73 local CONFIG
74
75 CONFIG="${INSTALLROOT}/root/.installrc"
76 clearconfig
77 addconfig '/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null'
78 addconfig 'root (hd0,0)'
79 addconfig 'setup (hd0)'
80 addconfig 'quit'
81 addconfig 'EOF'
82 addconfig 'exit 0'
83
84 # run installrc
85 chrooted /bin/bash --rcfile /root/.installrc -i
86 rm ${INSTALLROOT}/root/.installrc
87 }