1 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/installer/include/prepare_bootloader.sh,v 1.3 2008-09-24 11:21:07 niro Exp $ |
#!/bin/bash |
2 |
|
# $Id$ |
3 |
|
|
4 |
source include/hwdetection.sh |
source /etc/installer.conf |
5 |
|
source ${INSTALLER_DIR}/include/hwdetection.sh |
6 |
|
|
7 |
: ${INSTALL_ROOT="/mnt/magellan"} |
: ${INSTALL_ROOT="/mnt/magellan"} |
8 |
|
|
13 |
[[ ! -z ${INSTALL_ROOT} ]] && chroot=chrooted |
[[ ! -z ${INSTALL_ROOT} ]] && chroot=chrooted |
14 |
|
|
15 |
# create device.map |
# create device.map |
16 |
${chroot} grub --batch --no-floppy --no-config-file --device-map=/boot/grub/device.map </dev/null &>/dev/null |
${chroot} grub --batch --no-floppy --no-config-file --device-map=/boot/grub/device.map </dev/null |
17 |
} |
} |
18 |
|
|
19 |
install_grub() |
install_grub() |
20 |
{ |
{ |
21 |
local chroot |
local chroot |
22 |
|
local grub_disk |
23 |
|
|
24 |
|
if [[ -z ${PARTITION_DISK_BOOT} ]] |
25 |
|
then |
26 |
|
grub_disk="${PARTITION_DISK_ROOT}" |
27 |
|
else |
28 |
|
grub_disk="${PARTITION_DISK_BOOT}" |
29 |
|
fi |
30 |
|
|
31 |
[[ ! -z ${INSTALL_ROOT} ]] && chroot=chrooted |
[[ ! -z ${INSTALL_ROOT} ]] && chroot=chrooted |
32 |
|
|
33 |
# update grub |
# update grub |
34 |
${chroot} grub --batch --no-floppy << EOF 1> /dev/null 2> /dev/null |
${chroot} grub --batch --no-floppy << EOF |
35 |
root $(convert_device ${PARTITION_DISK_BOOT}) |
root $(convert_device ${grub_disk}) |
36 |
setup $(convert_device ${PARTITION_DISK_BOOT} | sed "s:,[0-9]::") |
setup $(convert_device ${grub_disk} | sed "s:,[0-9]::") |
37 |
quit |
quit |
38 |
EOF |
EOF |
39 |
|
|
75 |
create_grub_conf() |
create_grub_conf() |
76 |
{ |
{ |
77 |
local splashimage |
local splashimage |
78 |
|
local grub_disk |
79 |
|
|
80 |
if [[ -z ${PARTITION_DISK_BOOT} ]] |
if [[ -z ${PARTITION_DISK_BOOT} ]] |
81 |
then |
then |
82 |
export PARTITION_DISK_BOOT="${PARTITION_DISK_ROOT}" |
grub_disk="${PARTITION_DISK_ROOT}" |
83 |
|
else |
84 |
|
grub_disk="${PARTITION_DISK_BOOT}" |
85 |
fi |
fi |
86 |
|
|
87 |
# create an empty one |
# create an empty one |
95 |
splashimage="magellan.xpm.gz" |
splashimage="magellan.xpm.gz" |
96 |
|
|
97 |
# forcefully use gfxsplash |
# forcefully use gfxsplash |
98 |
[[ ! -f ${INSTALL_ROOT}/boot/${splashimage} ]] && cp data/magellan-black2.xpm.gz ${INSTALL_ROOT}/boot/${splashimage} |
[[ ! -f ${INSTALL_ROOT}/boot/${splashimage} ]] && cp ${INSTALLER_DIR}/data/magellan-black2.xpm.gz ${INSTALL_ROOT}/boot/${splashimage} |
99 |
|
|
100 |
if [[ -f ${INSTALL_ROOT}/boot/${splashimage} ]] |
if [[ -f ${INSTALL_ROOT}/boot/${splashimage} ]] |
101 |
then |
then |
102 |
add_grub_conf "# splash image" |
add_grub_conf "# splash image" |
103 |
# old logo |
add_grub_conf "splashimage $(convert_device ${grub_disk})/boot/${splashimage}" |
|
#add_grub_conf "splashimage /boot/magellan.xpm.gz" |
|
|
#add_grub_conf "foreground FFFFFF" |
|
|
#add_grub_conf "background 1B456B" |
|
|
|
|
|
# the new one |
|
|
add_grub_conf "splashimage $(convert_device ${PARTITION_DISK_BOOT})/boot/${splashimage}" |
|
104 |
add_grub_conf "foreground FFFFFF" |
add_grub_conf "foreground FFFFFF" |
105 |
add_grub_conf "background 253861" |
add_grub_conf "background 253861" |
106 |
|
|
112 |
fi |
fi |
113 |
|
|
114 |
add_grub_conf "title Magellan-Linux $(< ${INSTALL_ROOT}/etc/mageversion) ($(readlink ${INSTALL_ROOT}/boot/vmlinuz | sed s:kernel-::))" |
add_grub_conf "title Magellan-Linux $(< ${INSTALL_ROOT}/etc/mageversion) ($(readlink ${INSTALL_ROOT}/boot/vmlinuz | sed s:kernel-::))" |
115 |
add_grub_conf "root $(convert_device ${PARTITION_DISK_BOOT})" |
add_grub_conf "root $(convert_device ${grub_disk})" |
116 |
add_grub_conf "kernel /boot/$(readlink ${INSTALL_ROOT}/boot/vmlinuz) root=${PARTITION_DISK_ROOT}" |
add_grub_conf "kernel /boot/$(readlink ${INSTALL_ROOT}/boot/vmlinuz) root=UUID=$(get_uuid ${PARTITION_DISK_ROOT})" |
117 |
add_grub_conf "initrd /boot/$(readlink ${INSTALL_ROOT}/boot/initrd)" |
add_grub_conf "initrd /boot/$(readlink ${INSTALL_ROOT}/boot/initrd)" |
118 |
|
|
119 |
# add an empty line as spacer between other boot entries |
# add an empty line as spacer between other boot entries |
122 |
|
|
123 |
install_bootloader() |
install_bootloader() |
124 |
{ |
{ |
125 |
create_device_map >&2 |
create_device_map &>> ${INSTALLER_LOG} |
126 |
echo 25 |
echo 25 |
127 |
create_grub_conf >&2 |
create_grub_conf &>> ${INSTALLER_LOG} |
128 |
echo 50 |
echo 50 |
129 |
create_initrd >&2 |
install_grub &>> ${INSTALLER_LOG} |
|
echo 75 |
|
|
install_grub >&2 |
|
130 |
echo 100 |
echo 100 |
131 |
} |
} |
|
|
|
|
install_bootloader |
|