diff --git a/bootrecover/bootrecover.kmdr b/bootrecover/bootrecover.kmdr
index 68ad886..40d8b82 100755
--- a/bootrecover/bootrecover.kmdr
+++ b/bootrecover/bootrecover.kmdr
@@ -426,128 +426,6 @@ This tool is also useful before the installation of a third party boot manager i
AlignCenter
-
-
- setlabel
-
-
-
- 540
- 40
- 32
- 32
-
-
-
-
-
-
-
- @execBegin
-@if (@devicesbox.currentItem >= 0)
- currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
- @showdevice.setText(@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0))
- @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
- @BackBox.setChecked(true)
-
- parent_udi=`hal-find-by-property --key block.device --string /dev/$currdev`
- #
- # set MBR combo box
- #
- dcop @dcopid KommanderIf "clear(QString)" mbrbox
- storages=`hal-find-by-capability --capability storage`
- dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "$currdev (@i18n("System partition"))" 0
- for udi in $storages; do
- device=`hal-get-property --udi $udi --key block.device`
- hotpluggable=`hal-get-property --udi $udi --key storage.hotpluggable` || hotpluggable="false"
- partscheme=`hal-get-property --udi $udi --key storage.partitioning_scheme`
- if [ "$partscheme" == "mbr" -a "$hotpluggable" != "true" ]; then
- dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
- fi
- done
- dcop @dcopid KommanderIf "setCurrentItem(int)" 0
-@endif
-@execEnd
-@setBootableCheckbox.execute()
-
-
-
-
-
- scanDevices
-
-
-
- 540
- 0
- 32
- 32
-
-
-
-
- @devicesbox.clear
-@BackBox.setChecked(false)
-@NextBox.setChecked(false)
-@execBegin
-volumes=`hal-find-by-capability --capability volume`
-partlabel=
-
-for udi in $volumes; do
- device=`hal-get-property --udi $udi --key block.device`
- parent_udi=`hal-get-property --udi $udi --key block.storage_device`
- hotpluggable=`hal-get-property --udi $parent_udi --key storage.hotpluggable` || hotpluggable="false"
- blocksize=`hal-get-property --udi $udi --key volume.block_size`
- numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
- volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
- volname=`hal-get-property --udi $udi --key volume.label`
- [ "$volname" ] || volname="unnamed"
- parttype=`hal-get-property --udi $udi --key volume.partition.type`
- [ "$parttype" ] || parttype="unknown"
- partscheme=`hal-get-property --udi $udi --key volume.partition.scheme`
- [ "$partscheme" ] || partscheme="unknown"
- fstype=`hal-get-property --udi $udi --key volume.fstype`
- [ "$fstype" ] || fstype="unformatted"
- is_mounted=`hal-get-property --udi $udi --key volume.is_mounted`
- [ "$is_mounted" = "true" ] || {
- mkdir /mnt/${device:5:5} && mount $device /mnt/${device:5:5}
- }
- mount_point=`hal-get-property --udi $udi --key volume.mount_point`
- add_info=""
- [ "$hotpluggable" = "true" ] && {
- add_info=",removable"
- [ @removablebox.checked == 1 ] || continue
- }
- if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
- partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
- case "$parttype" in
- 0x82) ;;
- 0x83)
- [ "$mount_point" -a -e $mount_point/etc/openmamba-release ] && {
- release=`cat $mount_point/etc/openmamba-release`
- dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} $mount_point ($fstype,$volname,$volsize MB${add_info})" 0
- }
- ;;
- *) ;;
- esac
- elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
- case "$fstype" in
- swap|iso9660) ;;
- ext2|ext3|reiserfs|unformatted)
- [ "$mount_point" -a -e $mount_point/etc/openmamba-release ] && {
- release=`cat $mount_point/etc/openmamba-release`
- dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} $mount_point $volsize MB ($release)" 0
- }
- ;;
- *) ;;
- esac
- fi
-done
-@execEnd
-
-
-
-
PartitionBox
@@ -601,27 +479,6 @@ done
WordBreak|AlignTop
-
-
- showdevice
-
-
-
- 230
- 340
- 280
- 20
-
-
-
-
-
-
-
-
-
-
-
Label3
@@ -667,6 +524,157 @@ done
+
+
+ showdevice
+
+
+
+ 180
+ 340
+ 350
+ 20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ scanDevices
+
+
+
+ 540
+ 0
+ 32
+ 32
+
+
+
+
+ @devicesbox.clear
+@BackBox.setChecked(false)
+@NextBox.setChecked(false)
+@execBegin
+function get_udisks_key() {
+ LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
+}
+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`
+ 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_mounted=`get_udisks_key $device "is mounted"`
+ [ "$is_mounted" = "1" ] || {
+ mkdir /mnt/${device:5:5} && mount $device /mnt/${device:5:5}
+ }
+ mount_point=`get_udisks_key $device "mount paths"`
+ add_info=""
+ [ "$is_system_internal" == "1" ] || {
+ add_info=",removable"
+ [ @removablebox.checked == 1 ] || continue
+ }
+
+ if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
+ partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
+ case "$fstype" in
+ ext2|ext3|ext4|reiserfs|reiser4)
+ [ "$mount_point" -a -e $mount_point/etc/openmamba-release ] && {
+ release=`cat $mount_point/etc/openmamba-release`
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} $mount_point ($fstype,$volname,$volsize MB${add_info})" 0
+ }
+ ;;
+ *) ;;
+ esac
+ elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
+ case "$fstype" in
+ swap|iso9660) ;;
+ ext2|ext3|ext4|reiserfs|reiser4)
+ [ "$mount_point" -a -e $mount_point/etc/openmamba-release ] && {
+ release=`cat $mount_point/etc/openmamba-release`
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} $mount_point $volsize MB ($release)" 0
+ }
+ ;;
+ *) ;;
+ esac
+ fi
+done
+@execEnd
+
+
+
+
+
+
+ setlabel
+
+
+
+ 540
+ 40
+ 32
+ 32
+
+
+
+
+
+
+
+ @execBegin
+function get_udisks_key() {
+ LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
+}
+@if (@devicesbox.currentItem >= 0)
+ currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
+ @showdevice.setText(@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0))
+ @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
+ @BackBox.setChecked(true)
+
+ #
+ # set MBR combo box
+ #
+ dcop @dcopid KommanderIf "clear(QString)" mbrbox
+ devices=`udisks --enumerate-device-files | grep -v /dev/disk`
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "$currdev (@i18n("System partition"))" 0
+
+ for device in $devices; do
+ native_path=`get_udisks_key $d native-path`
+ [ ! -e $native_path/partition ] || continue
+ is_system_internal=`get_udisks_key $d "system internal"`
+ partscheme=`get_udisks_key $d scheme`
+ if [ "$is_system_internal" == "1" -o @removablebox.checked == 1 ]; then if [ "$partscheme" == "mbr" ]; then
+ dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
+ fi
+ done
+ dcop @dcopid KommanderIf "setCurrentItem(int)" 0
+@endif
+@execEnd
+@setBootableCheckbox.execute()
+
+
+
@@ -837,41 +845,6 @@ done
WordBreak|AlignTop
-
-
- setBootableCheckbox
-
-
- false
-
-
-
- 520
- 70
- 32
- 32
-
-
-
-
- @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
-
-
-
-
chainloadbox
@@ -907,6 +880,41 @@ fi
WordBreak|AlignVCenter
+
+
+ setBootableCheckbox
+
+
+ false
+
+
+
+ 520
+ 70
+ 32
+ 32
+
+
+
+
+ @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
+
+
+
+
@@ -927,38 +935,39 @@ fi
@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)
-volumes=`hal-find-by-capability --capability volume`
+devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
partlabel=
-for udi in $volumes; do
- device=`hal-get-property --udi $udi --key block.device`
- [ "${device:5:5}" = "$installdevice" ] && continue
- parent_udi=`hal-get-property --udi $udi --key block.storage_device`
- hotpluggable=`hal-get-property --udi $parent_udi --key storage.hotpluggable` || hotpluggable="false"
- blocksize=`hal-get-property --udi $udi --key volume.block_size`
- numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
- volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
+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 ] && continue
- volname=`hal-get-property --udi $udi --key volume.label`
- mount_point=`hal-get-property --udi $udi --key volume.mount_point`
+ volname=`get_udisks_key $device label`
[ "$volname" ] || volname="unnamed"
- parttype=`hal-get-property --udi $udi --key volume.partition.type`
+ parttype=`get_udisks_key $device usage`
[ "$parttype" ] || parttype="unknown"
- partscheme=`hal-get-property --udi $udi --key volume.partition.scheme`
+ partscheme=`get_udisks_key $device scheme`
[ "$partscheme" ] || partscheme="unknown"
- fstype=`hal-get-property --udi $udi --key volume.fstype`
+ fstype=`get_udisks_key $device type`
[ "$fstype" ] || fstype="unformatted"
add_info=""
- [ "$hotpluggable" = "true" ] && {
+ [ "$is_system_internal" = "1" ] || {
add_info=",removable"
[ @removablebox.checked == 1 ] || continue
}
+
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
- case "$parttype" in
- 0x82) ;;
- 0x83) ;;
+ 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})"
;;
@@ -966,7 +975,7 @@ for udi in $volumes; do
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
case "$fstype" in
swap|iso9660|unformatted) ;;
- ext2|ext3|reiserfs) ;;
+ 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})"
;;
@@ -1025,6 +1034,33 @@ done
AlignCenter
+
+
+ installlog
+
+
+
+ 20
+ 60
+ 540
+ 360
+
+
+
+ AlwaysOn
+
+
+ LogText
+
+
+
+
+
+
+
+
+
+
launchinstall
@@ -1113,33 +1149,6 @@ _EOF
-
-
- installlog
-
-
-
- 20
- 60
- 540
- 360
-
-
-
- AlwaysOn
-
-
- LogText
-
-
-
-
-
-
-
-
-
-
diff --git a/bootrecover/bootrecover.sh b/bootrecover/bootrecover.sh
index cff7f81..dc19db2 100755
--- a/bootrecover/bootrecover.sh
+++ b/bootrecover/bootrecover.sh
@@ -1,5 +1,5 @@
# openmamba boot loader recovery script
-# Copyright (c) 2007-2010 by Silvan Calarco
+# Copyright (c) 2007-2011 by Silvan Calarco
#
# Released under the terms of the GNU GPLv3 License
@@ -72,61 +72,6 @@ Installation time: $TIME_ELAPSED minutes"
done
}
-function find_driver_for_udi() {
- local found_driver parent_udi
-
- parent_udi=$1
- while [ ! "$found_driver" -a "$parent_udi" != "/org/freedesktop/Hal/devices/computer" ]; do
- parent_udi=`hal-get-property --udi $parent_udi --key info.parent 2>/dev/null`
- [ "`hal-get-property --udi $parent_udi --key info.bus 2>/dev/null`" = "pci" ] &&
- found_driver=`hal-get-property --udi $parent_udi --key info.linux.driver 2>/dev/null`
- done
- if [ "$found_driver" ]; then
- echo $found_driver
- return 0
- else
- return 1
- fi
-}
-
-function find_remapped_device() {
-
- local REMAPPED_INSTALL_DEVICE
-
- tempfile=`tempfile 2>/dev/null`
- mapfile=`tempfile 2>/dev/null`
-
- # generate current volumes sorted list with driver information
- storages=`hal-find-by-capability --capability storage`
- for s in $storages; do
- device=`hal-get-property --udi $s --key block.device`
- linux_driver=`find_driver_for_udi $s`
- [ "${device:5:2}" = "sd" ] && \
- echo "${device:0:8} $linux_driver" >> $tempfile
- done
- # sort
- cat $tempfile|sort > $mapfile
- rm -f $tempfile
-
- LETTERS=(a b c d e f g h i j k l m n o p q r s t u v w x y z)
-
- CURR_DRIVE_LETTER=0
- while read line; do
- set -- $line
- [ "$1" = "$INSTALL_DISK_DEVICE" ] && REMAPPED_INSTALL_DEVICE="${INSTALL_DEVICE:0:7}${LETTERS[CURR_DRIVE_LETTER]}${INSTALL_DEVICE:8:2}"
- [ "$2" = "$INSTALL_DRIVER" ] && {
- DEV_NAME_ORIG=(${DEV_NAME_ORIG[*]} $1)
- DEV_NAME_DEST=(${DEV_NAME_DEST[*]} ${1:0:7}${LETTERS[CURR_DRIVE_LETTER]})
- let CURR_DRIVE_LETTER+=1
- }
- done < $mapfile
- [ "$REMAPPED_INSTALL_DEVICE" ] || REMAPPED_INSTALL_DEVICE=$INSTALL_DEVICE
- echo $REMAPPED_INSTALL_DEVICE
-
- rm -f $mapfile
- rm -f $tmpfile
-}
-
DCOPID=$2
echo $"\
@@ -166,9 +111,6 @@ MOUNTPOINT=$INSTALL_MOUNTPOINT
abort
}
-REMAPPED_INSTALL_DEVICE=`find_remapped_device $INSTALL_DEVICE`
-echo $"Install device $INSTALL_DEVICE will be known as $REMAPPED_INSTALL_DEVICE in the installed system" | tee -a $LOG_FILE
-
dcop_write $"Binding system dirs to new mountpoint..." 73
mount -o bind /dev $MOUNTPOINT/dev || {
echo $"Error: could not mount $MOUNTPOINT/dev; aborting." >&2
@@ -246,10 +188,6 @@ _EOF
}
chroot $MOUNTPOINT update-grub | tee -a $LOGFILE
-
- [ "${INSTALL_DEVICE}" != "${REMAPPED_INSTALL_DEVICE}" ] && \
- sed -i "s|root=/dev/${INSTALL_DEVICE:5:5}|root=/dev/${REMAPPED_INSTALL_DEVICE:5:5}|" \
- $MOUNTPOINT/boot/grub/grub.cfg
else
echo $"Info: skipping bootloader installation" | tee -a $LOG_FILE
fi