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">
<string>Bootloader configuration</string>
</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">
<property name="name">
<cstring>Layout5_2</cstring>
@ -739,7 +758,7 @@ function get_udisks_key() {
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<y>60</y>
<width>530</width>
<height>26</height>
</rect>
@ -811,75 +830,6 @@ function get_udisks_key() {
</widget>
</hbox>
</widget>
<widget class="Label">
<property name="name">
<cstring>Label3_2_2_2</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>290</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>Please select the boot menu options:</string>
</property>
</widget>
<widget class="Label">
<property name="name">
<cstring>Label28</cstring>
</property>
<property name="geometry">
<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">
@ -890,15 +840,17 @@ function get_udisks_key() {
</property>
<property name="geometry">
<rect>
<x>520</x>
<y>70</y>
<x>530</x>
<y>0</y>
<width>32</width>
<height>32</height>
</rect>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@execBegin
<string>@BackBox.setChecked(true)
@NextBox.setChecked(true)
@execBegin
mbrdevice=@String.section(@mbrbox.item(@mbrbox.currentItem)," ",0)
mbrpart=${mbrdevice:3:2}
if [ "$mbrpart" ]; then
@ -917,77 +869,6 @@ fi
</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>
</property>
</widget>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>endinstall</cstring>
@ -1185,12 +1066,6 @@ _EOF
<receiver>setBootableCheckbox</receiver>
<slot>execute()</slot>
</connection>
<connection>
<sender>bootableBox</sender>
<signal>widgetOpened()</signal>
<receiver>scanbootloader</receiver>
<slot>execute()</slot>
</connection>
<connection>
<sender>NextBox</sender>
<signal>widgetOpened()</signal>

View File

@ -146,7 +146,7 @@ if [ "$INSTALL_BOOTLOADER_DEVICE" ]; then
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 --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:8:2}" ] && {