|
|
- # create grub legacy conf
- grub_config()
- {
- # backup an existing conf
- [ -e "$TARGET_ROOT/boot/grub/menu.lst" ] && \
- cp $TARGET_ROOT/boot/grub/menu.lst \
- $TARGET_ROOT/boot/grub/menu.bak
- # create the target GRUB configuration.
- mkdir -p $TARGET_ROOT/boot/grub || error8
- cat > $TARGET_ROOT/boot/grub/menu.lst <<_EOF_
- # /boot/grub/menu.lst: GRUB boot loader configuration.
- #
- # By default, boot the first entry.
- default 0
- # Boot automatically after 8 secs.
- timeout 8
- # Graphical splash image.
- splashimage=/boot/grub/splash.xpm.gz
- # Change the colors.
- #color yellow/brown light-green/black
- # For booting SliTaz from : $ROOT_UUID
- #
- title SliTaz GNU/Linux $(cat $TARGET_ROOT/etc/slitaz-release) (Kernel $KERNEL)
- root (hd$(disknum $ROOT_UUID),$(partnum $ROOT_UUID))
- kernel /boot/$KERNEL root=$(rootdev $ROOT_UUID) video=-32 quiet $(rootdelay)
- _EOF_
- local winpart="$(winboot_uuid)"
- if [ -n "$winpart" ]; then
- log "$(_ 'Enabling Windows dual-boot')"
- cat >> $TARGET_ROOT/boot/grub/menu.lst <<_EOF_
- # For booting Windows :
- #
- title Microsoft Windows
- rootnoverify (hd$(disknum $winpart),$(partnum $winpart))
- chainloader +1
- _EOF_
- fi
- # log
- printf "%s\n" "/boot/grub/menu.lst:" >> "$LOG"
- printf "%s\n" "--- menu.lst -------------" >> "$LOG"
- cat $TARGET_ROOT/boot/grub/menu.lst >> "$LOG"
- printf "%s\n\n" "--- menu.lst -------------" >> "$LOG"
- }
- # GRUB info with disk name used for grub
- grub_install()
- {
- # install grub
- local target_disk="$(uuid2disk $ROOT_UUID)"
- log "$(_ 'Installing GRUB on: %s' "$target_disk")"
- /usr/sbin/grub-install --version >> "$LOG" || error 5 "$(_ 'GRUB not found')"
- /usr/sbin/grub-install --no-floppy \
- --root-directory=$TARGET_ROOT $target_disk >>"$LOG" 2>>"$LOG"
- # set boot flag
- log "$(_ 'Setting the boot flag')"
- /usr/sbin/parted "$(uuid2disk $ROOT_UUID)" \
- set "$(($(partnum $ROOT_UUID)+1))" boot on 2>> "$LOG"
- # splash image
- if [ -f "$SOURCE_ROOT/boot/grub/splash.xpm.gz" ]; then
- log "$(_ 'Copying splash image')"
- mkdir -p $TARGET_ROOT/boot/grub
- cp $SOURCE_ROOT/boot/grub/splash.xpm.gz \
- $TARGET_ROOT/boot/grub
- fi
- }
复制代码
它好像是被安装啦,/usr/sbin/grub-install --no-floppy \
--root-directory=$TARGET_ROOT $target_disk >>"$LOG" 2>>"$LOG" |
|