diff --git a/bootrecover/bootrecover.kmdr b/bootrecover/bootrecover.kmdr
index d806752..a2330fe 100755
--- a/bootrecover/bootrecover.kmdr
+++ b/bootrecover/bootrecover.kmdr
@@ -457,28 +457,6 @@ This tool is also useful before the installation of a third party boot manager i
-
-
- Label24
-
-
-
- 10
- 30
- 540
- 40
-
-
-
- Please, select the openmamba system partition where you want the boot loader to be installed from.
-
-
- RichText
-
-
- WordBreak|AlignTop
-
-
Label3
@@ -503,27 +481,6 @@ This tool is also useful before the installation of a third party boot manager i
AlignVCenter|AlignLeft
-
-
- devicesbox
-
-
-
- 10
- 90
- 540
- 230
-
-
-
-
-
-
-
-
-
-
-
showdevice
@@ -545,6 +502,49 @@ This tool is also useful before the installation of a third party boot manager i
+
+
+ Label24
+
+
+
+ 10
+ 30
+ 540
+ 40
+
+
+
+ Please, select the openmamba system partition where you want the boot loader to be installed from.
+
+
+ RichText
+
+
+ WordBreak|AlignTop
+
+
+
+
+ devicesbox
+
+
+
+ 10
+ 90
+ 540
+ 230
+
+
+
+
+
+
+
+
+
+
+
@@ -646,6 +646,9 @@ done
function get_udisks_key() {
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
}
+function get_udisks_key_last() {
+ LANG=C udisks --show-info $1 | grep " $2:" | tail -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
+}
@if (@devicesbox.currentItem >= 0)
currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
@showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
@@ -661,12 +664,18 @@ function get_udisks_key() {
for device in $devices; do
native_path=`get_udisks_key $device native-path`
- [ -e $native_path/partition ] && continue
- is_system_internal=`get_udisks_key $device "system internal"`
- partscheme=`get_udisks_key $device scheme`
- if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
- [ "$partscheme" == "mbr" ] && \
- dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
+ if [ -e $native_path/partition ]; then
+ partition_label=`get_udisks_key_last $device label`
+ if [ "${partition_label:0:3}" = "EFI" ]; then
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (@i18n("EFI system partition"))" 0
+ fi
+ else
+ is_system_internal=`get_udisks_key $device "system internal"`
+ partscheme=`get_udisks_key $device scheme`
+ if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
+ [ "$partscheme" == "mbr" ] && \
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
+ fi
fi
done
dcop @dcopid KommanderIf "setCurrentItem(int)" 0
@@ -709,6 +718,44 @@ function get_udisks_key() {
AlignCenter
+
+
+ setBootableCheckbox
+
+
+ false
+
+
+
+ 530
+ 0
+ 32
+ 32
+
+
+
+
+ @BackBox.setChecked(true)
+@NextBox.setChecked(true)
+@execBegin
+mbrstring=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",1)
+mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
+mbrpart=${mbrdevice:3:2}
+if [ "$mbrpart" -a "${mbrstring/EFI}" = "${mbrstring}" ]; then
+ if [ $mbrpart -le 4 ]; then
+ dcop @dcopid KommanderIf setEnabled bootableBox true
+ else
+ dcop @dcopid KommanderIf setEnabled bootableBox false
+ dcop @dcopid KommanderIf setChecked bootableBox false
+ fi
+else
+ dcop @dcopid KommanderIf setEnabled bootableBox false
+fi
+@execEnd
+
+
+
+
BootloaderBox
@@ -831,43 +878,6 @@ function get_udisks_key() {
-
-
- setBootableCheckbox
-
-
- false
-
-
-
- 530
- 0
- 32
- 32
-
-
-
-
- @BackBox.setChecked(true)
-@NextBox.setChecked(true)
-@execBegin
-mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
-mbrpart=${mbrdevice:3:2}
-if [ "$mbrpart" ]; then
- if [ $mbrpart -le 4 ]; then
- dcop @dcopid KommanderIf setEnabled bootableBox true
- else
- dcop @dcopid KommanderIf setEnabled bootableBox false
- dcop @dcopid KommanderIf setChecked bootableBox false
- fi
-else
- dcop @dcopid KommanderIf setEnabled bootableBox false
-fi
-@execEnd
-
-
-
-
@@ -943,6 +953,25 @@ fi
+
+
+ ScriptObject7
+
+
+
+ 540
+ 20
+ 32
+ 32
+
+
+
+
+ dcop @dcopid KommanderIf setText installlog "`cat ~/.bootrecover.log`"
+
+
+
+
launchinstall
@@ -967,11 +996,17 @@ cat > $conffile << _EOF
# created by openmamba bootrecover wizard
#
_EOF
+
@dcop(@dcopid, KommanderIf, enableWidget(QString,bool), back,false)
installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
mountpoint=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",1)
-mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
+mbrstring="@mbrbox.item(@mbrbox.currentItem)"
+if [ "${mbrstring/EFI}" != "${mbrstring}" ]; then
+ efidevice=/dev/@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
+else
+ mbrdevice=/dev/@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
+fi
IFS=$'\n'
CHAINLOAD_SELECTED=(`dcop @dcopid KommanderIf selection chainloadbox`)
@@ -983,7 +1018,8 @@ IFS=$' \t\n'
cat >>$conffile << _EOF
INSTALL_DEVICE='/dev/$installdevice'
INSTALL_MOUNTPOINT='$mountpoint'
-INSTALL_BOOTLOADER_DEVICE='/dev/$mbrdevice'
+INSTALL_BOOTLOADER_DEVICE='$mbrdevice'
+INSTALL_BOOTLOADER_DEVICE_EFI='$efidevice'
INSTALL_BOOTLOADER_DEVICE_SETBOOTABLE=@bootableBox.checked
INSTALL_BOOTLOADER_CHAINLOAD=($chainloaddevices)
_EOF
@@ -1008,25 +1044,6 @@ _EOF
@endif
@BackBox.setChecked(false)
-
-
-
-
-
-
- ScriptObject7
-
-
-
- 540
- 20
- 32
- 32
-
-
-
-
- dcop @dcopid KommanderIf setText installlog "`cat ~/.bootrecover.log`"
diff --git a/bootrecover/bootrecover.sh b/bootrecover/bootrecover.sh
index b652980..41198f4 100755
--- a/bootrecover/bootrecover.sh
+++ b/bootrecover/bootrecover.sh
@@ -134,7 +134,8 @@ mount -o bind /proc $MOUNTPOINT/proc || {
abort
}
-if [ "$INSTALL_BOOTLOADER_DEVICE" ]; then
+
+if [ "$INSTALL_BOOTLOADER_DEVICE" -o "$INSTALL_BOOTLOADER_DEVICE_EFI" ]; then
for k in $MOUNTPOINT/boot/vmlinuz-*; do
KVER=${k/*\/boot\/vmlinuz-}
@@ -143,17 +144,53 @@ if [ "$INSTALL_BOOTLOADER_DEVICE" ]; then
chroot $MOUNTPOINT mkinitrd -f /boot/initramfs-${KVER}.img ${KVER}
done
- dcop_write $"Installing bootloader on $INSTALL_BOOTLOADER_DEVICE..." 90
- echo $"Installing grub bootloader on $INSTALL_BOOTLOADER_DEVICE" | tee -a $LOG_FILE
+ if [ "$INSTALL_BOOTLOADER_DEVICE_EFI" ]; then
+ # EFI
+ dcop_write $"Installing bootloader on ""$INSTALL_BOOTLOADER_DEVICE_EFI (EFI)..." 90
+ echo $"Installing grub bootloader on ""$INSTALL_BOOTLOADER_DEVICE_EFI (EFI)" | tee -a $LOG_FILE
+ [ -e $MOUNTPOINT/boot/efi ] || mkdir -p $MOUNTPOINT/boot/efi
+ mount $INSTALL_BOOTLOADER_DEVICE_EFI $MOUNTPOINT/boot/efi
+ grub-install --root-directory=$MOUNTPOINT --efi-directory=$MOUNTPOINT/boot/efi --target=x86_64-efi \
+ --bootloader-id="openmamba Boot Manager" --recheck --no-floppy
+ umount $MOUNTPOINT/boot/efi
- grub-install $INSTALL_BOOTLOADER_DEVICE --root-directory=$MOUNTPOINT --target=i386-pc --recheck --no-floppy
+ INSTALL_BOOTLOADER_DEVICE_EFI_BYID=$INSTALL_BOOTLOADER_DEVICE_EFI
+ for f in `ls /dev/disk/by-id/*`; do
+ if [ "$INSTALL_BOOTLOADER_DEVICE_EFI" = "`readlink -f $f`" ]; then
+ INSTALL_BOOTLOADER_DEVICE_EFI_BYID=$f
+ break
+ fi
+ done
+ sed -i "/^GRUB_INSTALL_DEVICE.*/d" $MOUNTPOINT/etc/sysconfig/grub
+ cat >> $MOUNTPOINT/etc/sysconfig/grub << _EOF
+GRUB_INSTALL_DEVICE_EFI=$INSTALL_BOOTLOADER_DEVICE_EFI_BYID
+_EOF
- [ "$INSTALL_BOOTLOADER_DEVICE_SETBOOTABLE" = "1" -a \
- "${INSTALL_BOOTLOADER_DEVICE:8:2}" ] && {
- parted ${INSTALL_BOOTLOADER_DEVICE:0:8} \
- set ${INSTALL_BOOTLOADER_DEVICE:8:2} boot on || \
- echo $"Warning: there was an error setting bootloader partition as bootable." >&2
- }
+ else
+ # BIOS
+ dcop_write $"Installing bootloader on $INSTALL_BOOTLOADER_DEVICE..." 90
+ echo $"Installing grub bootloader on $INSTALL_BOOTLOADER_DEVICE" | tee -a $LOG_FILE
+ grub-install $INSTALL_BOOTLOADER_DEVICE --root-directory=$MOUNTPOINT --target=i386-pc --recheck --no-floppy
+
+ INSTALL_BOOTLOADER_DEVICE_BYID=$INSTALL_BOOTLOADER_DEVICE
+ for f in `ls /dev/disk/by-id/*`; do
+ if [ "$INSTALL_BOOTLOADER_DEVICE" = "`readlink -f $f`" ]; then
+ INSTALL_BOOTLOADER_DEVICE_BYID=$f
+ break
+ fi
+ done
+ sed -i "/^GRUB_INSTALL_DEVICE.*/d" $MOUNTPOINT/etc/sysconfig/grub
+ cat >> $MOUNTPOINT/etc/sysconfig/grub << _EOF
+GRUB_INSTALL_DEVICE=$INSTALL_BOOTLOADER_DEVICE_EFI_BYID
+_EOF
+
+ [ "$INSTALL_BOOTLOADER_DEVICE_SETBOOTABLE" = "1" -a \
+ "${INSTALL_BOOTLOADER_DEVICE:8:2}" ] && {
+ parted ${INSTALL_BOOTLOADER_DEVICE:0:8} \
+ set ${INSTALL_BOOTLOADER_DEVICE:8:2} boot on || \
+ echo $"Warning: there was an error setting bootloader partition as bootable." >&2
+ }
+ fi
[ "$INSTALL_BOOTLOADER_CHAINLOAD" ] && {
# configure boot chainloader for e.g. windows
@@ -188,6 +225,7 @@ if [ "$INSTALL_BOOTLOADER_DEVICE" ]; then
GRUB_OTHER_TITLES=(${GRUB_OTHER_TITLES[*]} "\"Windows on $GRUB_OTHER_DEV\"")
fi
done
+ sed -i "/^GRUB_OTHER_.*/d" $MOUNTPOINT/etc/sysconfig/grub
cat >> $MOUNTPOINT/etc/sysconfig/grub << _EOF
GRUB_OTHER_DEVICES=(${GRUB_OTHER_DEVICES[*]})
GRUB_OTHER_TITLES=(${GRUB_OTHER_TITLES[*]})
@@ -207,7 +245,7 @@ fi
umount $MOUNTPOINT/dev
umount $MOUNTPOINT/sys
umount $MOUNTPOINT/proc
-umount $MOUNTPOINT
+sync
finished
echo $"Installation done. You can now reboot to start the freshly installed system." | tee -a $LOG_FILE