bootrecover: remove other O.S. partiton selection, rely on grub-install + os-prober for automatic configuration

This commit is contained in:
Silvan Calarco 2013-06-11 15:50:40 +02:00
parent 04f0aaaf5c
commit deb176ea16
2 changed files with 42 additions and 167 deletions

View File

@ -732,6 +732,25 @@ function get_udisks_key() {
<property name="title"> <property name="title">
<string>Bootloader configuration</string> <string>Bootloader configuration</string>
</property> </property>
<widget class="Label">
<property name="name">
<cstring>Label29_2</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>531</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Please select where you want to install the boot manager.</string>
</property>
<property name="alignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>Layout5_2</cstring> <cstring>Layout5_2</cstring>
@ -739,7 +758,7 @@ function get_udisks_key() {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>330</y> <y>60</y>
<width>530</width> <width>530</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -811,94 +830,27 @@ function get_udisks_key() {
</widget> </widget>
</hbox> </hbox>
</widget> </widget>
<widget class="Label"> </widget>
<property name="name"> <widget class="ScriptObject">
<cstring>Label3_2_2_2</cstring> <property name="name">
</property> <cstring>setBootableCheckbox</cstring>
<property name="geometry"> </property>
<rect> <property name="enabled">
<x>10</x> <bool>false</bool>
<y>70</y> </property>
<width>290</width> <property name="geometry">
<height>24</height> <rect>
</rect> <x>530</x>
</property> <y>0</y>
<property name="text"> <width>32</width>
<string>Please select the boot menu options:</string> <height>32</height>
</property> </rect>
</widget> </property>
<widget class="Label"> <property name="associations" stdset="0">
<property name="name"> <stringlist>
<cstring>Label28</cstring> <string>@BackBox.setChecked(true)
</property> @NextBox.setChecked(true)
<property name="geometry"> @execBegin
<rect>
<x>10</x>
<y>30</y>
<width>540</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Below is a list of other operating systems found on this computer, you may configure them to appear as a choice when the computer starts.</string>
</property>
<property name="alignment">
<set>WordBreak|AlignTop</set>
</property>
</widget>
<widget class="ListBox">
<property name="name">
<cstring>chainloadbox</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>540</width>
<height>170</height>
</rect>
</property>
<property name="selectionMode">
<enum>Multi</enum>
</property>
</widget>
<widget class="Label">
<property name="name">
<cstring>Label29_2</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>531</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Please select where you want to install the boot manager.</string>
</property>
<property name="alignment">
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
<widget class="ScriptObject">
<property name="name">
<cstring>setBootableCheckbox</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>520</x>
<y>70</y>
<width>32</width>
<height>32</height>
</rect>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@execBegin
mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0) mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
mbrpart=${mbrdevice:3:2} mbrpart=${mbrdevice:3:2}
if [ "$mbrpart" ]; then if [ "$mbrpart" ]; then
@ -913,77 +865,6 @@ else
fi fi
@execEnd @execEnd
</string> </string>
</stringlist>
</property>
</widget>
</widget>
<widget class="ScriptObject">
<property name="name">
<cstring>scanbootloader</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>32</width>
<height>32</height>
</rect>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@BackBox.setChecked(true)
@NextBox.setChecked(true)
@chainloadbox.clear
@setBootableCheckbox.execute()
@execBegin
function get_udisks_key() {
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
}
installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
partlabel=
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"`
volsize=`get_udisks_key $device size`
volsize=`expr $volsize / 1024 / 1024`
[ $volsize = 0 ] &amp;&amp; continue
volname=`get_udisks_key $device label`
[ "$volname" ] || volname="unnamed"
parttype=`get_udisks_key $device usage`
[ "$parttype" ] || parttype="unknown"
partscheme=`get_udisks_key $device scheme`
[ "$partscheme" ] || partscheme="unknown"
fstype=`get_udisks_key $device type`
[ "$fstype" ] || fstype="unformatted"
add_info=""
[ "$is_system_internal" = "1" ] || {
add_info=",removable"
[ @removablebox.checked == 1 ] || continue
}
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
partlabel="$partlabel&lt;br&gt;${device:5:5} $fstype $volname $volsize MB"
case "$fstype" in
swap|iso9660|unformatted) ;;
ext2|ext3|ext4|reiserfs|reiser4|unformatted) ;;
*) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0
dcop @dcopid KommanderIf "setSelection" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})"
;;
esac
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
case "$fstype" in
swap|iso9660|unformatted) ;;
ext2|ext3|ext4|reiserfs|reiser4) ;;
*) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0
dcop @dcopid KommanderIf "setSelection" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})"
;;
esac
fi
done
@execEnd</string>
</stringlist> </stringlist>
</property> </property>
</widget> </widget>
@ -1185,12 +1066,6 @@ _EOF
<receiver>setBootableCheckbox</receiver> <receiver>setBootableCheckbox</receiver>
<slot>execute()</slot> <slot>execute()</slot>
</connection> </connection>
<connection>
<sender>bootableBox</sender>
<signal>widgetOpened()</signal>
<receiver>scanbootloader</receiver>
<slot>execute()</slot>
</connection>
<connection> <connection>
<sender>NextBox</sender> <sender>NextBox</sender>
<signal>widgetOpened()</signal> <signal>widgetOpened()</signal>

View File

@ -146,7 +146,7 @@ if [ "$INSTALL_BOOTLOADER_DEVICE" ]; then
dcop_write $"Installing bootloader on $INSTALL_BOOTLOADER_DEVICE..." 90 dcop_write $"Installing bootloader on $INSTALL_BOOTLOADER_DEVICE..." 90
echo $"Installing grub bootloader on $INSTALL_BOOTLOADER_DEVICE" | tee -a $LOG_FILE echo $"Installing grub bootloader on $INSTALL_BOOTLOADER_DEVICE" | tee -a $LOG_FILE
grub-install $INSTALL_BOOTLOADER_DEVICE --root-directory=$MOUNTPOINT --recheck --no-floppy grub-install $INSTALL_BOOTLOADER_DEVICE --root-directory=$MOUNTPOINT --target=i386-pc --recheck --no-floppy
[ "$INSTALL_BOOTLOADER_DEVICE_SETBOOTABLE" = "1" -a \ [ "$INSTALL_BOOTLOADER_DEVICE_SETBOOTABLE" = "1" -a \
"${INSTALL_BOOTLOADER_DEVICE:8:2}" ] && { "${INSTALL_BOOTLOADER_DEVICE:8:2}" ] && {