Search
SailfishOS Open Build Service
>
Projects
>
nemo
:
testing:hw
:
x86:x86-common
>
installer-shell
> installer-shell-install-bootloader-or-not.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File installer-shell-install-bootloader-or-not.patch of Package installer-shell
diff -Naur b/installer-shell c/installer-shell --- b/installer-shell 2011-07-12 18:31:33.505149804 +0800 +++ c/installer-shell 2011-07-12 18:23:35.416907745 +0800 @@ -1,5 +1,7 @@ #!/bin/bash +# write MBR or not +WRITE_MBR=1 # expand extended partition to here EXPAND_EXTENDED_END=0 @@ -269,7 +271,7 @@ fi mount_check "mount $tmp_part $TMP_MNT" #FIXME: grub, lilo - if [ -f $TMP_MNT/extlinux/extlinux.conf -o -f $TMP_MNT/bootmgr ]; then + if [ -f $TMP_MNT/extlinux/extlinux.conf -o $TMP_MNT/boot/extlinux/extlinux.conf -o -f $TMP_MNT/bootmgr ]; then tmp_nr=$(echo $tmp_part |grep -o "[1-9]\|[1-9][0-9]") echo -e "label ${tmp_part#/dev/*}" >> $1 if [ -f $TMP_MNT/bootmgr ]; then @@ -600,15 +602,6 @@ fi } -toggle_boot_partition () { - old_bootdev=$(sfdisk -l /dev/$DEV 2>/dev/null |grep "^/dev/" |grep "\*" |awk '{print $1}' |grep -o "[1-9]\|[1-9][0-9]") - if [ "x$old_bootdev" != "x" ]; then - sfdisk_loop "toggle_boot_partition, disable old" ",,,-\ny\n" "-N$old_bootdev --force" - fi - unset old_bootdev - sfdisk_loop "toggle_boot_partition, enable new" ",,,*\ny\n" "-N$LOGICAL_BOOT --force" -} - setup_freespace_device () { SWAP_NR=$(sfdisk -l /dev/$DEV 2>/dev/null |grep "^/dev/.*swap" |awk '{print $1}' |grep -o "[1-9]\|[1-9][0-9]" |head -1) SWAPDEV=/dev/${DEV}${PART_PREFIX}$SWAP_NR @@ -629,7 +622,6 @@ output "Create default partition layout, please wait..." prepare_extended_partition do_partition_freespace - toggle_boot_partition setup_freespace_device } @@ -688,6 +680,14 @@ rollback fi + #write MBR or not, move user interaction here, so user can go away rather than just wait here. + if [ "$IMAGE_TYPE" = "liveimg" ]; then + if [ $SILENT_MODE -eq 0 -a $WHOLE_DISK -eq 0 ]; then + output "\033[32mStep 4 Overwirte MBR or not\033[0m" + wait_user "Do you want to overwrite MBR? " + WRITE_MBR=$USER_ANSWER + fi + fi output "\033[32mAll the works will done by computer in several minutes, you are free now.\033[0m" } @@ -909,9 +909,14 @@ fi dbglg "Install extlinux to /boot/extlinux" dbglg_exec "/sbin/extlinux -i $CONF_DIR" - dbglg "Write MBR to /dev/$DEV" - dbglg_exec "/bin/dd if=/dev/$DEV of=${CONF_DIR}/mbr.bak count=1 bs=512" - dbglg_exec "/bin/dd if=${ROOTMNT}/usr/share/syslinux/mbr.bin of=/dev/$DEV" + if [ $WRITE_MBR -eq 0 ]; then + dbglg "Doesn't write MBR, please work around yourself." + else + dbglg "Write MBR to /dev/$DEV" + dbglg_exec "/bin/dd if=/dev/$DEV of=${CONF_DIR}/mbr.bak count=1 bs=512" + dbglg_exec "/bin/dd if=${ROOTMNT}/usr/share/syslinux/mbr.bin of=/dev/$DEV" + sfdisk_loop "toggle on the new boot partition" "" "-A$LOGICAL_BOOT" + fi # Generate extlinux.conf dbglg "Write extlinux.conf" @@ -961,8 +966,9 @@ echo " menu default" >> $CONF_FILE # update extlinux menu - bootloader_probe $CONF_FILE - + if [ $WRITE_MBR -eq 1 ]; then + bootloader_probe $CONF_FILE + fi dbglg "Copy background picture" if [ -f $ROOTMNT/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg ]; then dbglg_exec "cp ${ROOTMNT}/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg ${CONF_DIR}/splash.jpg" @@ -1083,7 +1089,6 @@ } install_bootloader () { - output "Install bootloader..." if [ "$IMAGE_TYPE" = "liveimg" ]; then install_syslinux else