installer.kmdr: preliminary LVM support

This commit is contained in:
Silvan Calarco 2014-06-25 17:04:14 +02:00
parent 16ea9baaf8
commit 0311bc8539

View File

@ -1598,6 +1598,19 @@ fi
dcop @dcopid KommanderIf setText swapsizelabel "@i18n("In order to install openmamba you need on your fixed disk(s):<br>- a Linux type partition with at least $systemrequired MBytes<br>- a SWAP type partition with at least $swaprequired MBytes")" dcop @dcopid KommanderIf setText swapsizelabel "@i18n("In order to install openmamba you need on your fixed disk(s):<br>- a Linux type partition with at least $systemrequired MBytes<br>- a SWAP type partition with at least $swaprequired MBytes")"
for d in $devices; do for d in $devices; do
# lvm device?
lvm_vgname=`sudo pvdisplay $d 2>/dev/null | grep "VG Name" | sed "s|.*VG Name[[:space:]]*||"`
if [ "$lvm_vgname" ]; then
diskdevice=$lvm_vgname
native_path="/dev/$lvm_vgname"
lvm_lvnames=`ls -d $native_path/* | sort -n -r`
volumes=
for f in $lvm_lvnames; do
lvm_volume=`get_udisks_key $f "device-file" | sed "s|.*/||"`
volumes="$volumes $lvm_volume"
done
disktype="@i18n("LVM Group")"
else
diskdevice=${d/\/dev\/} diskdevice=${d/\/dev\/}
native_path=`get_udisks_key $d native-path` native_path=`get_udisks_key $d native-path`
[ ! -e $native_path/partition ] || continue [ ! -e $native_path/partition ] || continue
@ -1607,17 +1620,22 @@ for d in $devices; do
[ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue
partscheme=`get_udisks_key $d scheme` partscheme=`get_udisks_key $d scheme`
[ "$partscheme" ] || continue [ "$partscheme" ] || continue
volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
disktype="@i18n("Disk")"
fi
disksize=`get_udisks_key $d size` disksize=`get_udisks_key $d size`
disksize=`expr $disksize / 1024 / 1024 / 1024` disksize=`expr $disksize / 1024 / 1024 / 1024`
volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
thisdisk= thisdisk=
for v in $volumes; do for v in $volumes; do
device=/dev/$v device=/dev/$v
v_native_path=$native_path/$v
volsize=`get_udisks_key $device size` volsize=`get_udisks_key $device size`
volsize=`expr $volsize / 1024 / 1024` volsize=`expr $volsize / 1024 / 1024`
if [ "${v:0:3}" = "dm-" ]; then
volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
else
volname=`get_udisks_key $device label` volname=`get_udisks_key $device label`
fi
parttype=`get_udisks_key $device usage` parttype=`get_udisks_key $device usage`
[ "$parttype" ] || parttype="unknown" [ "$parttype" ] || parttype="unknown"
fstype=`get_udisks_key $device type` fstype=`get_udisks_key $device type`
@ -1626,7 +1644,7 @@ for d in $devices; do
[ "$is_system_internal" = "1" ] || add_info=",removable" [ "$is_system_internal" = "1" ] || add_info=",removable"
[ "$volsize" -gt "0" ] || continue [ "$volsize" -gt "0" ] || continue
thispart="<tr><td width=50>${device:5:5}</td><td width=100>$fstype</td><td width=130>$volname</td><td align=right>$volsize MB</td>" thispart="<tr><td width=80>$v</td><td width=100>$fstype</td><td width=130>$volname</td><td width=100 align=right>$volsize MB</td>"
case "$fstype" in case "$fstype" in
swap) if [ $swaprequired -le $volsize ]; then swap) if [ $swaprequired -le $volsize ]; then
@ -1634,7 +1652,7 @@ for d in $devices; do
thispart="$thispart<td><b>@i18n("OK for swap")</b></td>" thispart="$thispart<td><b>@i18n("OK for swap")</b></td>"
fi fi
;; ;;
linux|ext2|ext3|ext4|reiserfs|reiser4) unformatted|linux|ext2|ext3|ext4|reiserfs|reiser4)
if [ $systemrequired -le $volsize ]; then if [ $systemrequired -le $volsize ]; then
linuxok=1 linuxok=1
thispart="$thispart<td><b>@i18n("OK for system")</b></td>" thispart="$thispart<td><b>@i18n("OK for system")</b></td>"
@ -1646,7 +1664,7 @@ for d in $devices; do
thisdisk="${thispart}${thisdisk}" thisdisk="${thispart}${thisdisk}"
done done
partlabel="<b>@i18n("Disk") $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}" partlabel="<b>$disktype $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}"
done done
dcop @dcopid KommanderIf setText partitionslabel "$partlabel" dcop @dcopid KommanderIf setText partitionslabel "$partlabel"
@ -2134,13 +2152,20 @@ devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
partlabel= partlabel=
for device in $devices; do for device in $devices; do
if [ "${device:0:8}" != "/dev/dm-" ]; then
# not a lvm device
native_path=`get_udisks_key $device native-path` native_path=`get_udisks_key $device native-path`
[ -e $native_path/partition ] || continue [ -e $native_path/partition ] || continue
fi
is_system_internal=`get_udisks_key $device "system internal"` is_system_internal=`get_udisks_key $device "system internal"`
volsize=`get_udisks_key $device size` volsize=`get_udisks_key $device size`
volsize=`expr $volsize / 1024 / 1024` volsize=`expr $volsize / 1024 / 1024`
[ $systemrequired -le $volsize ] || continue [ $systemrequired -le $volsize ] || continue
if [ "${device:5:3}" = "dm-" ]; then
volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
else
volname=`get_udisks_key $device label` volname=`get_udisks_key $device label`
fi
[ "$volname" ] || volname="unnamed" [ "$volname" ] || volname="unnamed"
parttype=`get_udisks_key $device usage` parttype=`get_udisks_key $device usage`
[ "$parttype" ] || parttype="unknown" [ "$parttype" ] || parttype="unknown"
@ -2155,16 +2180,16 @@ for device in $devices; do
} }
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB" partlabel="$partlabel<br>${device:5} $fstype $volname $volsize MB"
case "$fstype" in case "$fstype" in
ext2|ext3|ext4|reiserfs|reiser4|unformatted) ext2|ext3|ext4|reiserfs|reiser4|unformatted)
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;; dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
*) ;; *) ;;
esac esac
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
case "$fstype" in case "$fstype" in
swap|iso9660) ;; swap|iso9660) ;;
ext2|ext3|ext4|reiserfs|reiser4|unformatted) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;; ext2|ext3|ext4|reiserfs|reiser4|unformatted) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
*) ;; *) ;;
esac esac
fi fi
@ -2224,14 +2249,14 @@ function get_udisks_key_last() {
if [ -e $native_path/partition ]; then if [ -e $native_path/partition ]; then
partition_label=`get_udisks_key_last $device label` partition_label=`get_udisks_key_last $device label`
if [ "${partition_label:0:3}" = "EFI" ]; then if [ "${partition_label:0:3}" = "EFI" ]; then
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (@i18n("EFI system partition"))" 0 dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5} (@i18n("EFI system partition"))" 0
fi fi
else else
is_system_internal=`get_udisks_key $device "system internal"` is_system_internal=`get_udisks_key $device "system internal"`
partscheme=`get_udisks_key $device scheme` partscheme=`get_udisks_key $device scheme`
if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
[ "$partscheme" == "mbr" ] && \ [ "$partscheme" == "mbr" ] && \
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0 dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5} (master boot record)" 0
fi fi
fi fi
done done
@ -2669,13 +2694,19 @@ partlabel=
installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0) installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "@i18n("none (just use a single partition for system and home)")" 0 dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "@i18n("none (just use a single partition for system and home)")" 0
for device in $devices; do for device in $devices; do
[ "${device:5:5}" = "$installdevice" ] && continue [ "${device:5}" = "$installdevice" ] && continue
if [ "${device:5:3}" != "dm-" ]; then
native_path=`get_udisks_key $device native-path` native_path=`get_udisks_key $device native-path`
[ -e $native_path/partition ] || continue [ -e $native_path/partition ] || continue
fi
is_system_internal=`get_udisks_key $device "system internal"` is_system_internal=`get_udisks_key $device "system internal"`
volsize=`get_udisks_key $device size` volsize=`get_udisks_key $device size`
volsize=`expr $volsize / 1024 / 1024` volsize=`expr $volsize / 1024 / 1024`
if [ "${device:5:3}" = "dm-" ]; then
volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
else
volname=`get_udisks_key $device label` volname=`get_udisks_key $device label`
fi
[ $volsize -ge 512 ] || continue [ $volsize -ge 512 ] || continue
[ "$volname" ] || volname="unnamed" [ "$volname" ] || volname="unnamed"
parttype=`get_udisks_key $device usage` parttype=`get_udisks_key $device usage`
@ -2690,17 +2721,17 @@ for device in $devices; do
[ @removablebox.checked == 1 ] || continue [ @removablebox.checked == 1 ] || continue
} }
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB" partlabel="$partlabel<br>${device:5} $fstype $volname $volsize MB"
case "$fstype" in case "$fstype" in
ext2|ext3|ext4|reiserfs|reiser4|unformatted) ext2|ext3|ext4|reiserfs|reiser4|unformatted)
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;; dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
*) ;; *) ;;
esac esac
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
case "$fstype" in case "$fstype" in
swap|iso9660) ;; swap|iso9660) ;;
ext2|ext3|ext4|reiserfs|reiser4|unformatted) ext2|ext3|ext4|reiserfs|reiser4|unformatted)
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;; dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
*) ;; *) ;;
esac esac
fi fi