Magellan Linux

Diff of /trunk/installer/include/prepare_bootloader.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 773 by niro, Wed Sep 24 10:54:00 2008 UTC revision 1157 by niro, Tue Sep 14 20:07:38 2010 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/magellan-cvs/magellan-src/installer/include/prepare_bootloader.sh,v 1.1 2008-09-24 10:54:00 niro Exp $  #!/bin/bash
2    # $Id$
3    
4  source hwdetection.sh  source /etc/installer.conf
5    source ${INSTALLER_DIR}/include/hwdetection.sh
6    
7  : ${INSTALL_ROOT="/mnt/magellan"}  : ${INSTALL_ROOT="/mnt/magellan"}
8    
# Line 11  create_device_map() Line 13  create_device_map()
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    
# Line 65  add_grub_conf() Line 75  add_grub_conf()
75  create_grub_conf()  create_grub_conf()
76  {  {
77   local splashimage   local splashimage
78     local grub_disk
79     local grub_prefix
80    
81   if [[ -z ${PARTITION_DISK_BOOT} ]]   if [[ -z ${PARTITION_DISK_BOOT} ]]
82   then   then
83   export PARTITION_DISK_BOOT="${PARTITION_DISK_ROOT}"   grub_disk="${PARTITION_DISK_ROOT}"
84     # if no extra partition for grub was defined, we need the bootprefix set to /boot
85     grub_prefix="/boot"
86     else
87     grub_disk="${PARTITION_DISK_BOOT}"
88     # got a extra boot partition, no bootprefix needed
89     grub_prefix=""
90   fi   fi
91    
92   # create an empty one   # create an empty one
# Line 82  create_grub_conf() Line 100  create_grub_conf()
100   splashimage="magellan.xpm.gz"   splashimage="magellan.xpm.gz"
101    
102   # forcefully use gfxsplash   # forcefully use gfxsplash
103   [[ ! -f ${INSTALL_ROOT}/boot/${splashimage} ]] && cp 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}
104    
105   if [[ -f ${INSTALL_ROOT}/boot/${splashimage} ]]   if [[ -f ${INSTALL_ROOT}/boot/${splashimage} ]]
106   then   then
107   add_grub_conf "# splash image"   add_grub_conf "# splash image"
108   # old logo   add_grub_conf "splashimage $(convert_device ${grub_disk})${grub_prefix}/${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}"  
109   add_grub_conf "foreground FFFFFF"   add_grub_conf "foreground FFFFFF"
110   add_grub_conf "background 253861"   add_grub_conf "background 253861"
111    
# Line 105  create_grub_conf() Line 117  create_grub_conf()
117   fi   fi
118    
119   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-::))"
120   add_grub_conf "root $(convert_device ${PARTITION_DISK_BOOT})"   add_grub_conf "root $(convert_device ${grub_disk})"
121   add_grub_conf "kernel /boot/$(readlink ${INSTALL_ROOT}/boot/vmlinuz) root=${PARTITION_DISK_ROOT}"   add_grub_conf "kernel ${grub_prefix}/$(readlink ${INSTALL_ROOT}/boot/vmlinuz) root=UUID=$(get_uuid ${PARTITION_DISK_ROOT})"
122   add_grub_conf "initrd /boot/$(readlink ${INSTALL_ROOT}/boot/initrd)"   add_grub_conf "initrd ${grub_prefix}/$(readlink ${INSTALL_ROOT}/boot/initrd)"
123    
124   # add an empty line as spacer between other boot entries   # add an empty line as spacer between other boot entries
125   add_grub_conf ""   add_grub_conf ""
# Line 115  create_grub_conf() Line 127  create_grub_conf()
127    
128  install_bootloader()  install_bootloader()
129  {  {
130   create_device_map >&2   create_device_map >> ${INSTALLER_LOG} 2>&1
131   echo 25   echo 25
132   create_grub_conf >&2   create_grub_conf >> ${INSTALLER_LOG} 2>&1
133   echo 50   echo 50
134   create_initrd >&2   install_grub >> ${INSTALLER_LOG} 2>&1
  echo 75  
  install_grub >&2  
135   echo 100   echo 100
136  }  }
137    

Legend:
Removed from v.773  
changed lines
  Added in v.1157