bootrecover: added udisks support, dropped hal
This commit is contained in:
parent
9e32604293
commit
d7ae79e2d5
@ -426,128 +426,6 @@ This tool is also useful before the installation of a third party boot manager i
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>setlabel</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>40</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="populationText">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@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()</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>scanDevices</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@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
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="GroupBox">
|
||||
<property name="name">
|
||||
<cstring>PartitionBox</cstring>
|
||||
@ -601,27 +479,6 @@ done
|
||||
<set>WordBreak|AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Label">
|
||||
<property name="name">
|
||||
<cstring>showdevice</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>340</y>
|
||||
<width>280</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string></string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Label">
|
||||
<property name="name">
|
||||
<cstring>Label3</cstring>
|
||||
@ -667,6 +524,157 @@ done
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Label">
|
||||
<property name="name">
|
||||
<cstring>showdevice</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>340</y>
|
||||
<width>350</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string></string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>scanDevices</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@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
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>setlabel</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>40</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="populationText">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@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()
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
@ -837,41 +845,6 @@ done
|
||||
<set>WordBreak|AlignTop</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)
|
||||
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
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ListBox">
|
||||
<property name="name">
|
||||
<cstring>chainloadbox</cstring>
|
||||
@ -907,6 +880,41 @@ fi
|
||||
<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)
|
||||
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
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
@ -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
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TextEdit">
|
||||
<property name="name">
|
||||
<cstring>installlog</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>540</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="hScrollBarMode">
|
||||
<enum>AlwaysOn</enum>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>LogText</enum>
|
||||
</property>
|
||||
<property name="populationText">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string></string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>launchinstall</cstring>
|
||||
@ -1113,33 +1149,6 @@ _EOF
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TextEdit">
|
||||
<property name="name">
|
||||
<cstring>installlog</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>540</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="hScrollBarMode">
|
||||
<enum>AlwaysOn</enum>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>LogText</enum>
|
||||
</property>
|
||||
<property name="populationText">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string></string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<images>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# openmamba boot loader recovery script
|
||||
# Copyright (c) 2007-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
# Copyright (c) 2007-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user