Commit 0311bc8539653f60de39024cc7d67f71e006a14d

Authored by Silvan Calarco
1 parent 16ea9baaf8
Exists in master

installer.kmdr: preliminary LVM support

Showing 1 changed file with 61 additions and 30 deletions Side-by-side Diff

installer/installer.kmdr
... ... @@ -1598,26 +1598,44 @@
1598 1598 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")"
1599 1599  
1600 1600 for d in $devices; do
1601   - diskdevice=${d/\/dev\/}
1602   - native_path=`get_udisks_key $d native-path`
1603   - [ ! -e $native_path/partition ] || continue
1604   - vendor=`get_udisks_key $d vendor`
1605   - product=`get_udisks_key $d model`
1606   - is_system_internal=`get_udisks_key $d "system internal"`
1607   - [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue
1608   - partscheme=`get_udisks_key $d scheme`
1609   - [ "$partscheme" ] || continue
  1601 + # lvm device?
  1602 + lvm_vgname=`sudo pvdisplay $d 2>/dev/null | grep "VG Name" | sed "s|.*VG Name[[:space:]]*||"`
  1603 + if [ "$lvm_vgname" ]; then
  1604 + diskdevice=$lvm_vgname
  1605 + native_path="/dev/$lvm_vgname"
  1606 + lvm_lvnames=`ls -d $native_path/* | sort -n -r`
  1607 + volumes=
  1608 + for f in $lvm_lvnames; do
  1609 + lvm_volume=`get_udisks_key $f "device-file" | sed "s|.*/||"`
  1610 + volumes="$volumes $lvm_volume"
  1611 + done
  1612 + disktype="@i18n("LVM Group")"
  1613 + else
  1614 + diskdevice=${d/\/dev\/}
  1615 + native_path=`get_udisks_key $d native-path`
  1616 + [ ! -e $native_path/partition ] || continue
  1617 + vendor=`get_udisks_key $d vendor`
  1618 + product=`get_udisks_key $d model`
  1619 + is_system_internal=`get_udisks_key $d "system internal"`
  1620 + [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue
  1621 + partscheme=`get_udisks_key $d scheme`
  1622 + [ "$partscheme" ] || continue
  1623 + volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
  1624 + disktype="@i18n("Disk")"
  1625 + fi
1610 1626 disksize=`get_udisks_key $d size`
1611 1627 disksize=`expr $disksize / 1024 / 1024 / 1024`
1612   - volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
1613 1628 thisdisk=
1614 1629  
1615 1630 for v in $volumes; do
1616 1631 device=/dev/$v
1617   - v_native_path=$native_path/$v
1618 1632 volsize=`get_udisks_key $device size`
1619 1633 volsize=`expr $volsize / 1024 / 1024`
1620   - volname=`get_udisks_key $device label`
  1634 + if [ "${v:0:3}" = "dm-" ]; then
  1635 + volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
  1636 + else
  1637 + volname=`get_udisks_key $device label`
  1638 + fi
1621 1639 parttype=`get_udisks_key $device usage`
1622 1640 [ "$parttype" ] || parttype="unknown"
1623 1641 fstype=`get_udisks_key $device type`
... ... @@ -1626,7 +1644,7 @@
1626 1644 [ "$is_system_internal" = "1" ] || add_info=",removable"
1627 1645 [ "$volsize" -gt "0" ] || continue
1628 1646  
1629   - 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>"
  1647 + 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>"
1630 1648  
1631 1649 case "$fstype" in
1632 1650 swap) if [ $swaprequired -le $volsize ]; then
... ... @@ -1634,7 +1652,7 @@
1634 1652 thispart="$thispart<td><b>@i18n("OK for swap")</b></td>"
1635 1653 fi
1636 1654 ;;
1637   - linux|ext2|ext3|ext4|reiserfs|reiser4)
  1655 + unformatted|linux|ext2|ext3|ext4|reiserfs|reiser4)
1638 1656 if [ $systemrequired -le $volsize ]; then
1639 1657 linuxok=1
1640 1658 thispart="$thispart<td><b>@i18n("OK for system")</b></td>"
... ... @@ -1646,7 +1664,7 @@
1646 1664 thisdisk="${thispart}${thisdisk}"
1647 1665  
1648 1666 done
1649   - partlabel="<b>@i18n("Disk") $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}"
  1667 + partlabel="<b>$disktype $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}"
1650 1668 done
1651 1669  
1652 1670 dcop @dcopid KommanderIf setText partitionslabel "$partlabel"
1653 1671  
... ... @@ -2134,13 +2152,20 @@
2134 2152 partlabel=
2135 2153  
2136 2154 for device in $devices; do
2137   - native_path=`get_udisks_key $device native-path`
2138   - [ -e $native_path/partition ] || continue
  2155 + if [ "${device:0:8}" != "/dev/dm-" ]; then
  2156 + # not a lvm device
  2157 + native_path=`get_udisks_key $device native-path`
  2158 + [ -e $native_path/partition ] || continue
  2159 + fi
2139 2160 is_system_internal=`get_udisks_key $device "system internal"`
2140 2161 volsize=`get_udisks_key $device size`
2141 2162 volsize=`expr $volsize / 1024 / 1024`
2142 2163 [ $systemrequired -le $volsize ] || continue
2143   - volname=`get_udisks_key $device label`
  2164 + if [ "${device:5:3}" = "dm-" ]; then
  2165 + volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
  2166 + else
  2167 + volname=`get_udisks_key $device label`
  2168 + fi
2144 2169 [ "$volname" ] || volname="unnamed"
2145 2170 parttype=`get_udisks_key $device usage`
2146 2171 [ "$parttype" ] || parttype="unknown"
2147 2172  
2148 2173  
... ... @@ -2155,16 +2180,16 @@
2155 2180 }
2156 2181  
2157 2182 if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
2158   - partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
  2183 + partlabel="$partlabel<br>${device:5} $fstype $volname $volsize MB"
2159 2184 case "$fstype" in
2160 2185 ext2|ext3|ext4|reiserfs|reiser4|unformatted)
2161   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
  2186 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
2162 2187 *) ;;
2163 2188 esac
2164 2189 elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
2165 2190 case "$fstype" in
2166 2191 swap|iso9660) ;;
2167   - ext2|ext3|ext4|reiserfs|reiser4|unformatted) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
  2192 + ext2|ext3|ext4|reiserfs|reiser4|unformatted) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
2168 2193 *) ;;
2169 2194 esac
2170 2195 fi
2171 2196  
... ... @@ -2224,14 +2249,14 @@
2224 2249 if [ -e $native_path/partition ]; then
2225 2250 partition_label=`get_udisks_key_last $device label`
2226 2251 if [ "${partition_label:0:3}" = "EFI" ]; then
2227   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (@i18n("EFI system partition"))" 0
  2252 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5} (@i18n("EFI system partition"))" 0
2228 2253 fi
2229 2254 else
2230 2255 is_system_internal=`get_udisks_key $device "system internal"`
2231 2256 partscheme=`get_udisks_key $device scheme`
2232 2257 if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
2233 2258 [ "$partscheme" == "mbr" ] && \
2234   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
  2259 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5} (master boot record)" 0
2235 2260 fi
2236 2261 fi
2237 2262 done
2238 2263  
... ... @@ -2669,13 +2694,19 @@
2669 2694 installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
2670 2695 dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "@i18n("none (just use a single partition for system and home)")" 0
2671 2696 for device in $devices; do
2672   - [ "${device:5:5}" = "$installdevice" ] && continue
2673   - native_path=`get_udisks_key $device native-path`
2674   - [ -e $native_path/partition ] || continue
  2697 + [ "${device:5}" = "$installdevice" ] && continue
  2698 + if [ "${device:5:3}" != "dm-" ]; then
  2699 + native_path=`get_udisks_key $device native-path`
  2700 + [ -e $native_path/partition ] || continue
  2701 + fi
2675 2702 is_system_internal=`get_udisks_key $device "system internal"`
2676 2703 volsize=`get_udisks_key $device size`
2677 2704 volsize=`expr $volsize / 1024 / 1024`
2678   - volname=`get_udisks_key $device label`
  2705 + if [ "${device:5:3}" = "dm-" ]; then
  2706 + volname=`sudo dmsetup info $device | grep "^Name:" | sed "s|.*[[:space:]]||"`
  2707 + else
  2708 + volname=`get_udisks_key $device label`
  2709 + fi
2679 2710 [ $volsize -ge 512 ] || continue
2680 2711 [ "$volname" ] || volname="unnamed"
2681 2712 parttype=`get_udisks_key $device usage`
2682 2713  
2683 2714  
... ... @@ -2690,17 +2721,17 @@
2690 2721 [ @removablebox.checked == 1 ] || continue
2691 2722 }
2692 2723 if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
2693   - partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
  2724 + partlabel="$partlabel<br>${device:5} $fstype $volname $volsize MB"
2694 2725 case "$fstype" in
2695 2726 ext2|ext3|ext4|reiserfs|reiser4|unformatted)
2696   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
  2727 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
2697 2728 *) ;;
2698 2729 esac
2699 2730 elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
2700 2731 case "$fstype" in
2701 2732 swap|iso9660) ;;
2702 2733 ext2|ext3|ext4|reiserfs|reiser4|unformatted)
2703   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
  2734 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
2704 2735 *) ;;
2705 2736 esac
2706 2737 fi