Commit 670a071a66c87db1719e6673f10626948363eb54

Authored by Silvan Calarco
1 parent 704bff28e2
Exists in master and in 1 other branch milestone2

installer.kmdr, installer.sh: code changed to use udisks instead of hal

Showing 2 changed files with 358 additions and 381 deletions Side-by-side Diff

installer/installer.kmdr
... ... @@ -334,30 +334,6 @@
334 334 <string>This program will install openmamba on this computer.</string>
335 335 </property>
336 336 </widget>
337   - <widget class="Label">
338   - <property name="name">
339   - <cstring>Label18_2</cstring>
340   - </property>
341   - <property name="geometry">
342   - <rect>
343   - <x>10</x>
344   - <y>220</y>
345   - <width>560</width>
346   - <height>60</height>
347   - </rect>
348   - </property>
349   - <property name="text">
350   - <string>If you have problems, suggestions or would like to contribute to the development of openmamba please consult the forums and maling lists available at &lt;a href="http://www.openmamba.org"&gt;www.openmamba.org&lt;/a&gt;.</string>
351   - </property>
352   - <property name="alignment">
353   - <set>WordBreak|AlignVCenter</set>
354   - </property>
355   - <property name="associations" stdset="0">
356   - <stringlist>
357   - <string></string>
358   - </stringlist>
359   - </property>
360   - </widget>
361 337 <widget class="GroupBox">
362 338 <property name="name">
363 339 <cstring>GroupBox4</cstring>
... ... @@ -399,26 +375,6 @@
399 375 </stringlist>
400 376 </property>
401 377 </widget>
402   - <widget class="Label">
403   - <property name="name">
404   - <cstring>integrityCheckLabel</cstring>
405   - </property>
406   - <property name="geometry">
407   - <rect>
408   - <x>10</x>
409   - <y>20</y>
410   - <width>540</width>
411   - <height>70</height>
412   - </rect>
413   - </property>
414   - <property name="text">
415   - <string>Please wait some time while the installation medium is checked for data integrity.
416   -Press the skip button only if you have previously checked the medium on this computer.</string>
417   - </property>
418   - <property name="alignment">
419   - <set>WordBreak|AlignVCenter</set>
420   - </property>
421   - </widget>
422 378 <widget class="ExecButton">
423 379 <property name="name">
424 380 <cstring>skipButton</cstring>
... ... @@ -445,6 +401,26 @@
445 401 </stringlist>
446 402 </property>
447 403 </widget>
  404 + <widget class="Label">
  405 + <property name="name">
  406 + <cstring>integrityCheckLabel</cstring>
  407 + </property>
  408 + <property name="geometry">
  409 + <rect>
  410 + <x>10</x>
  411 + <y>20</y>
  412 + <width>540</width>
  413 + <height>70</height>
  414 + </rect>
  415 + </property>
  416 + <property name="text">
  417 + <string>Please wait some time while the installation medium is checked for data integrity.
  418 +Press the skip button only if you have previously checked the medium on this computer.</string>
  419 + </property>
  420 + <property name="alignment">
  421 + <set>WordBreak|AlignVCenter</set>
  422 + </property>
  423 + </widget>
448 424 <widget class="ScriptObject">
449 425 <property name="name">
450 426 <cstring>launchMD5script</cstring>
... ... @@ -464,6 +440,30 @@
464 440 </property>
465 441 </widget>
466 442 </widget>
  443 + <widget class="Label">
  444 + <property name="name">
  445 + <cstring>Label18_2</cstring>
  446 + </property>
  447 + <property name="geometry">
  448 + <rect>
  449 + <x>10</x>
  450 + <y>220</y>
  451 + <width>560</width>
  452 + <height>60</height>
  453 + </rect>
  454 + </property>
  455 + <property name="text">
  456 + <string>If you have problems, suggestions or would like to contribute to the development of openmamba please consult the forums and maling lists available at &lt;a href="http://www.openmamba.org"&gt;www.openmamba.org&lt;/a&gt;.</string>
  457 + </property>
  458 + <property name="alignment">
  459 + <set>WordBreak|AlignVCenter</set>
  460 + </property>
  461 + <property name="associations" stdset="0">
  462 + <stringlist>
  463 + <string></string>
  464 + </stringlist>
  465 + </property>
  466 + </widget>
467 467 </widget>
468 468 <widget class="QWidget">
469 469 <property name="name">
... ... @@ -1293,6 +1293,52 @@
1293 1293 <set>WordBreak|AlignTop|AlignHCenter</set>
1294 1294 </property>
1295 1295 </widget>
  1296 + <widget class="CheckBox">
  1297 + <property name="name">
  1298 + <cstring>removablebox</cstring>
  1299 + </property>
  1300 + <property name="geometry">
  1301 + <rect>
  1302 + <x>300</x>
  1303 + <y>20</y>
  1304 + <width>270</width>
  1305 + <height>20</height>
  1306 + </rect>
  1307 + </property>
  1308 + <property name="text">
  1309 + <string>Show removab&amp;le devices</string>
  1310 + </property>
  1311 + <property name="associations" stdset="0">
  1312 + <stringlist>
  1313 + <string></string>
  1314 + <string></string>
  1315 + <string></string>
  1316 + </stringlist>
  1317 + </property>
  1318 + </widget>
  1319 + <widget class="CheckBox">
  1320 + <property name="name">
  1321 + <cstring>swapcheckbox</cstring>
  1322 + </property>
  1323 + <property name="geometry">
  1324 + <rect>
  1325 + <x>10</x>
  1326 + <y>20</y>
  1327 + <width>280</width>
  1328 + <height>21</height>
  1329 + </rect>
  1330 + </property>
  1331 + <property name="text">
  1332 + <string>I&amp;gnore SWAP partition check</string>
  1333 + </property>
  1334 + <property name="associations" stdset="0">
  1335 + <stringlist>
  1336 + <string></string>
  1337 + <string></string>
  1338 + <string></string>
  1339 + </stringlist>
  1340 + </property>
  1341 + </widget>
1296 1342 <widget class="Label">
1297 1343 <property name="name">
1298 1344 <cstring>installhint</cstring>
... ... @@ -1342,52 +1388,6 @@
1342 1388 </stringlist>
1343 1389 </property>
1344 1390 </widget>
1345   - <widget class="CheckBox">
1346   - <property name="name">
1347   - <cstring>removablebox</cstring>
1348   - </property>
1349   - <property name="geometry">
1350   - <rect>
1351   - <x>300</x>
1352   - <y>20</y>
1353   - <width>270</width>
1354   - <height>20</height>
1355   - </rect>
1356   - </property>
1357   - <property name="text">
1358   - <string>Show removab&amp;le devices</string>
1359   - </property>
1360   - <property name="associations" stdset="0">
1361   - <stringlist>
1362   - <string></string>
1363   - <string></string>
1364   - <string></string>
1365   - </stringlist>
1366   - </property>
1367   - </widget>
1368   - <widget class="CheckBox">
1369   - <property name="name">
1370   - <cstring>swapcheckbox</cstring>
1371   - </property>
1372   - <property name="geometry">
1373   - <rect>
1374   - <x>10</x>
1375   - <y>20</y>
1376   - <width>280</width>
1377   - <height>21</height>
1378   - </rect>
1379   - </property>
1380   - <property name="text">
1381   - <string>I&amp;gnore SWAP partition check</string>
1382   - </property>
1383   - <property name="associations" stdset="0">
1384   - <stringlist>
1385   - <string></string>
1386   - <string></string>
1387   - <string></string>
1388   - </stringlist>
1389   - </property>
1390   - </widget>
1391 1391 </widget>
1392 1392 <widget class="CheckBox">
1393 1393 <property name="name">
... ... @@ -1407,28 +1407,6 @@
1407 1407 </widget>
1408 1408 <widget class="Label">
1409 1409 <property name="name">
1410   - <cstring>swapsizelabel</cstring>
1411   - </property>
1412   - <property name="geometry">
1413   - <rect>
1414   - <x>10</x>
1415   - <y>70</y>
1416   - <width>410</width>
1417   - <height>60</height>
1418   - </rect>
1419   - </property>
1420   - <property name="text">
1421   - <string></string>
1422   - </property>
1423   - <property name="textFormat">
1424   - <enum>RichText</enum>
1425   - </property>
1426   - <property name="alignment">
1427   - <set>WordBreak|AlignVCenter</set>
1428   - </property>
1429   - </widget>
1430   - <widget class="Label">
1431   - <property name="name">
1432 1410 <cstring>Label21_2_3</cstring>
1433 1411 </property>
1434 1412 <property name="geometry">
... ... @@ -1451,6 +1429,28 @@
1451 1429 <set>AlignCenter</set>
1452 1430 </property>
1453 1431 </widget>
  1432 + <widget class="Label">
  1433 + <property name="name">
  1434 + <cstring>swapsizelabel</cstring>
  1435 + </property>
  1436 + <property name="geometry">
  1437 + <rect>
  1438 + <x>10</x>
  1439 + <y>70</y>
  1440 + <width>410</width>
  1441 + <height>60</height>
  1442 + </rect>
  1443 + </property>
  1444 + <property name="text">
  1445 + <string></string>
  1446 + </property>
  1447 + <property name="textFormat">
  1448 + <enum>RichText</enum>
  1449 + </property>
  1450 + <property name="alignment">
  1451 + <set>WordBreak|AlignVCenter</set>
  1452 + </property>
  1453 + </widget>
1454 1454 <widget class="ScriptObject">
1455 1455 <property name="name">
1456 1456 <cstring>scandisks</cstring>
... ... @@ -1468,7 +1468,11 @@
1468 1468 <string>@partitionslabel.clear
1469 1469 @BackBox.setChecked(true)
1470 1470 @execBegin
1471   -storages=`hal-find-by-capability --capability storage`
  1471 +function get_udisks_key() {
  1472 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  1473 +}
  1474 +
  1475 +devices=`udisks --enumerate-device-files | grep -v /dev/disk`
1472 1476 partlabel=
1473 1477 linuxok=
1474 1478 swapok=
1475 1479  
1476 1480  
1477 1481  
1478 1482  
1479 1483  
1480 1484  
... ... @@ -1483,59 +1487,58 @@
1483 1487 systemrequired=5120
1484 1488 dcop @dcopid KommanderIf setText swapsizelabel "@i18n("In order to install openmamba you need on your fixed disk(s):&lt;br&gt;- a Linux type partition with at least $systemrequired MBytes&lt;br&gt;- a SWAP type partition with at least $swaprequired MBytes")"
1485 1489  
1486   -for s in $storages; do
1487   - diskdevice=`hal-get-property --udi $s --key block.device`
1488   - vendor=`hal-get-property --udi $s --key info.vendor`
1489   - product=`hal-get-property --udi $s --key info.product`
1490   - hotpluggable=`hal-get-property --udi $s --key storage.hotpluggable` || hotpluggable="false"
1491   - partscheme=`hal-get-property --udi $s --key storage.partitioning_scheme`
1492   - [ "$partscheme" ] || continue
1493   - disksize=`hal-get-property --udi $s --key storage.size`
1494   - disksize=`expr $disksize / 1024 / 1024 / 1024`
  1490 +for d in $devices; do
  1491 + diskdevice=${d/\/dev\/}
  1492 + native_path=`get_udisks_key $d native-path`
  1493 + [ ! -e $native_path/partition ] || continue
  1494 + vendor=`get_udisks_key $d vendor`
  1495 + product=`get_udisks_key $d model`
  1496 + is_system_internal=`get_udisks_key $d "system internal"`
  1497 + [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] &amp;&amp; continue
  1498 + partscheme=`get_udisks_key $d scheme`
  1499 + [ "$partscheme" ] || continue
  1500 + disksize=`get_udisks_key $d size`
  1501 + disksize=`expr $disksize / 1024 / 1024 / 1024`
  1502 + volumes=`ls -d $native_path/${diskdevice}* 2&gt;/dev/null | sed "s|.*/||" | sort -n -r`
  1503 + thisdisk=
  1504 +
  1505 + for v in $volumes; do
  1506 + device=/dev/$v
  1507 + v_native_path=$native_path/$v
  1508 + volsize=`get_udisks_key $device size`
  1509 + volsize=`expr $volsize / 1024 / 1024`
  1510 + volname=`get_udisks_key $device label`
  1511 + parttype=`get_udisks_key $device usage`
  1512 + [ "$parttype" ] || parttype="unknown"
  1513 + fstype=`get_udisks_key $device type`
  1514 + [ "$fstype" ] || fstype="unformatted"
  1515 + add_info=""
  1516 + [ "$is_system_internal" = "1" ] || add_info=",removable"
  1517 + [ "$volsize" -gt "0" ] || continue
1495 1518  
1496   - volumes=`hal-find-by-property --key info.parent --string $s`
1497   - thisdisk=
1498   - [ "$hotpluggable" = "true" -a @removablebox.checked == 0 ] &amp;&amp; continue
1499   - for udi in $volumes; do
1500   - device=`hal-get-property --udi $udi --key block.device`
1501   - blocksize=`hal-get-property --udi $udi --key volume.block_size`
1502   - numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
1503   - volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
1504   - volname=`hal-get-property --udi $udi --key volume.label`
1505   - [ "$volname" ] || volname=""
1506   - parttype=`hal-get-property --udi $udi --key volume.partition.type`
1507   - [ "$parttype" ] || parttype="unknown"
1508   - fstype=`hal-get-property --udi $udi --key volume.fstype`
1509   - [ "$fstype" ] || fstype="unformatted"
1510   - add_info=""
1511   - [ "$hotpluggable" = "true" ] &amp;&amp; {
1512   - add_info=",removable"
1513   - }
1514   - [ "$volsize" -gt "0" ] || continue
1515   - case "$parttype" in
1516   - 0x82) fstype="swap" ;;
1517   - 0x83) fstype="linux" ;;
1518   - esac
1519   - thispart="&lt;tr&gt;&lt;td width=50&gt;${device:5:5}&lt;/td&gt;&lt;td width=100&gt;$fstype&lt;/td&gt;&lt;td width=130&gt;$volname&lt;/td&gt;&lt;td align=right&gt;$volsize MB&lt;/td&gt;"
1520   - case "$fstype" in
  1519 + thispart="&lt;tr&gt;&lt;td width=50&gt;${device:5:5}&lt;/td&gt;&lt;td width=100&gt;$fstype&lt;/td&gt;&lt;td width=130&gt;$volname&lt;/td&gt;&lt;td align=right&gt;$volsize MB&lt;/td&gt;"
  1520 +
  1521 + case "$fstype" in
1521 1522 swap) if [ $swaprequired -le $volsize ]; then
1522   - swapok=$udi
  1523 + swapok=1
1523 1524 thispart="$thispart&lt;td&gt;&lt;b&gt;@i18n("OK for swap")&lt;/b&gt;&lt;/td&gt;"
1524   - fi
  1525 + fi
1525 1526 ;;
1526 1527 linux|ext2|ext3|ext4|reiserfs|reiser4)
1527 1528 if [ $systemrequired -le $volsize ]; then
1528   - linuxok=$udi;
  1529 + linuxok=1
1529 1530 thispart="$thispart&lt;td&gt;&lt;b&gt;@i18n("OK for system")&lt;/b&gt;&lt;/td&gt;"
1530 1531 fi
1531 1532 ;;
1532 1533 *) thispart="$thispart&lt;td&gt;&lt;/td&gt;"
1533 1534 ;;
1534   - esac
1535   - thisdisk="${thispart}${thisdisk}"
1536   - done
1537   - partlabel="&lt;b&gt;@i18n(Disk) $vendor $product $disksize GB (${diskdevice:5:5})&lt;/b&gt;:&lt;br&gt;&lt;br&gt;&lt;table cellspacing=0 cellpadding=0&gt;&lt;tr&gt;${thisdisk}&lt;/tr&gt;&lt;/table&gt;${partlabel}"
  1535 + esac
  1536 + thisdisk="${thispart}${thisdisk}"
  1537 +
  1538 + done
  1539 + partlabel="&lt;b&gt;@i18n("Disk") $vendor $product $disksize GB (${diskdevice})&lt;/b&gt;:&lt;br&gt;&lt;br&gt;&lt;table cellspacing=0 cellpadding=0&gt;&lt;tr&gt;${thisdisk}&lt;/tr&gt;&lt;/table&gt;${partlabel}"
1538 1540 done
  1541 +
1539 1542 dcop @dcopid KommanderIf setText partitionslabel "$partlabel"
1540 1543 if [ @swapcheckbox.checked = 1 ]; then
1541 1544 swapok="1"
... ... @@ -1556,6 +1559,56 @@
1556 1559 </stringlist>
1557 1560 </property>
1558 1561 </widget>
  1562 + <widget class="ExecButton">
  1563 + <property name="name">
  1564 + <cstring>PartToolButton</cstring>
  1565 + </property>
  1566 + <property name="geometry">
  1567 + <rect>
  1568 + <x>420</x>
  1569 + <y>80</y>
  1570 + <width>150</width>
  1571 + <height>30</height>
  1572 + </rect>
  1573 + </property>
  1574 + <property name="text">
  1575 + <string>Ed&amp;it disk partitions</string>
  1576 + </property>
  1577 + <property name="associations" stdset="0">
  1578 + <stringlist>
  1579 + <string>@RunPartTool.execute()
  1580 +@scandisks.execute()
  1581 +@rebootneededbox.setChecked(false)
  1582 +@execBegin
  1583 +function get_udisks_key() {
  1584 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  1585 +}
  1586 +
  1587 +devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
  1588 +for device in $devices; do
  1589 + native_path=`get_udisks_key $device native-path`
  1590 + [ -e $native_path/partition ] &amp;&amp; continue
  1591 + partscheme=`get_udisks_key $device scheme`
  1592 + is_system_internal=`get_udisks_key $device "system internal"`
  1593 + [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] &amp;&amp; continue
  1594 + [ "$partscheme" = "none" -o "$partscheme" = "" ] &amp;&amp; dcop @dcopid KommanderIf setChecked rebootneededbox true
  1595 +done
  1596 +@execEnd
  1597 +@setGlobal("rebootquest","0")
  1598 +@if (@rebootneededbox.checked)
  1599 + @setGlobal("rebootquest",(@Message.question(@i18n("Partition table on at least one device is missing or has been recreated; reboot may be needed. If you choose to continue you may have data consistency errors."), @i18n("Reboot needed"), @i18n("Reboot"), @i18n("Continue"))))
  1600 +@endif
  1601 +@if (@global("rebootquest") == "1")
  1602 +if [ -x /usr/bin/qdbus ]; then
  1603 + /usr/bin/qdbus org.kde.ksmserver /KSMServer logout 0 1 2
  1604 +else
  1605 + dcop ksmserver ksmserver logout 0 1 1
  1606 +fi
  1607 +@endif
  1608 +</string>
  1609 + </stringlist>
  1610 + </property>
  1611 + </widget>
1559 1612 <widget class="ScriptObject">
1560 1613 <property name="name">
1561 1614 <cstring>RunPartTool</cstring>
1562 1615  
... ... @@ -1572,10 +1625,14 @@
1572 1625 <stringlist>
1573 1626 <string>@exec("dcop kded kded unloadModule medianotifier")
1574 1627 @execBegin
1575   -volumes=`hal-find-by-capability --capability volume`
  1628 +function get_udisks_key() {
  1629 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  1630 +}
  1631 +volumes=`udisks --enumerate-device-files | grep -v /dev/disk`
1576 1632 for v in $volumes; do
1577   - mountpoint=`hal-get-property --udi $v --key volume.mount_point`
1578   - [ "$mountpoint" ] &amp;&amp; umount $mountpoint
  1633 + native_path=`get_udisks_key $v native-path`
  1634 + [ ! -e $native_path/partition ] || continue
  1635 + udisks --unmount $v
1579 1636 done
1580 1637 /sbin/swapoff -a
1581 1638 @execEnd
... ... @@ -1598,50 +1655,6 @@
1598 1655 </stringlist>
1599 1656 </property>
1600 1657 </widget>
1601   - <widget class="ExecButton">
1602   - <property name="name">
1603   - <cstring>PartToolButton</cstring>
1604   - </property>
1605   - <property name="geometry">
1606   - <rect>
1607   - <x>420</x>
1608   - <y>80</y>
1609   - <width>150</width>
1610   - <height>30</height>
1611   - </rect>
1612   - </property>
1613   - <property name="text">
1614   - <string>Ed&amp;it disk partitions</string>
1615   - </property>
1616   - <property name="associations" stdset="0">
1617   - <stringlist>
1618   - <string>@RunPartTool.execute()
1619   -@scandisks.execute()
1620   -@rebootneededbox.setChecked(false)
1621   -@execBegin
1622   -storages=`hal-find-by-capability --capability storage`
1623   -for s in $storages; do
1624   - partscheme=`hal-get-property --udi $s --key storage.partitioning_scheme`
1625   - hotpluggable=`hal-get-property --udi $s --key storage.hotpluggable` || hotpluggable="false"
1626   - [ "$hotpluggable" = "true" -a @removablebox.checked == 0 ] &amp;&amp; continue
1627   - [ "$partscheme" = "none" ] &amp;&amp; dcop @dcopid KommanderIf setChecked rebootneededbox true
1628   -done
1629   -@execEnd
1630   -@setGlobal("rebootquest","0")
1631   -@if (@rebootneededbox.checked)
1632   - @setGlobal("rebootquest",(@Message.question(@i18n("Partition table on at least one device is missing or has been recreated; reboot may be needed. If you choose to continue you may have data consistency errors."), @i18n("Reboot needed"), @i18n("Reboot"), @i18n("Continue"))))
1633   -@endif
1634   -@if (@global("rebootquest") == "1")
1635   -if [ -x /usr/bin/qdbus ]; then
1636   - /usr/bin/qdbus org.kde.ksmserver /KSMServer logout 0 1 2
1637   -else
1638   - dcop ksmserver ksmserver logout 0 1 1
1639   -fi
1640   -@endif
1641   -</string>
1642   - </stringlist>
1643   - </property>
1644   - </widget>
1645 1658 </widget>
1646 1659 <widget class="QWidget">
1647 1660 <property name="name">
... ... @@ -2076,62 +2089,6 @@
2076 2089 </widget>
2077 2090 <widget class="ScriptObject">
2078 2091 <property name="name">
2079   - <cstring>setlabel</cstring>
2080   - </property>
2081   - <property name="geometry">
2082   - <rect>
2083   - <x>540</x>
2084   - <y>40</y>
2085   - <width>32</width>
2086   - <height>32</height>
2087   - </rect>
2088   - </property>
2089   - <property name="populationText">
2090   - <string></string>
2091   - </property>
2092   - <property name="associations" stdset="0">
2093   - <stringlist>
2094   - <string>@execBegin
2095   -@if (@devicesbox.currentItem &gt;= 0)
2096   - currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
2097   - @showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
2098   - @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
2099   - @BackBox.setChecked(true)
2100   -
2101   - parent_udi=`hal-find-by-property --key block.device --string /dev/$currdev`
2102   - # detect linux driver
2103   - unset linux_driver
2104   - while [ ! "$linux_driver" -a "$parent_udi" != "/org/freedesktop/Hal/devices/computer" ]; do
2105   - parent_udi=`hal-get-property --udi $parent_udi --key info.parent 2&gt;/dev/null`
2106   - [ "`hal-get-property --udi $parent_udi --key info.subsystem 2&gt;/dev/null`" = "pci" ] &amp;&amp; linux_driver=`hal-get-property --udi $parent_udi --key info.linux.driver 2&gt;/dev/null`
2107   - done
2108   - [ "$linux_driver" ] || linux_driver="undetected"
2109   - dcop @dcopid KommanderIf setText driverlabel $linux_driver
2110   -
2111   - #
2112   - # set MBR combo box
2113   - #
2114   - dcop @dcopid KommanderIf "clear(QString)" mbrbox
2115   - storages=`hal-find-by-capability --capability storage`
2116   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "$currdev (@i18n("System partition"))" 0
2117   - for udi in $storages; do
2118   - device=`hal-get-property --udi $udi --key block.device`
2119   - hotpluggable=`hal-get-property --udi $udi --key storage.hotpluggable` || hotpluggable="false"
2120   - partscheme=`hal-get-property --udi $udi --key storage.partitioning_scheme`
2121   - if [ "$hotpluggable" == "false" -o "@removablebox.checked" == "1" ]; then
2122   - [ "$partscheme" == "mbr" ] &amp;&amp; \
2123   - dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
2124   - fi
2125   - done
2126   - dcop @dcopid KommanderIf "setCurrentItem(int)" 0
2127   -@endif
2128   -@execEnd
2129   -@setBootableCheckbox.execute()</string>
2130   - </stringlist>
2131   - </property>
2132   - </widget>
2133   - <widget class="ScriptObject">
2134   - <property name="name">
2135 2092 <cstring>scanDevices</cstring>
2136 2093 </property>
2137 2094 <property name="geometry">
2138 2095  
2139 2096  
2140 2097  
2141 2098  
2142 2099  
2143 2100  
2144 2101  
2145 2102  
... ... @@ -2148,39 +2105,43 @@
2148 2105 @BackBox.setChecked(true)
2149 2106 @NextBox.setChecked(false)
2150 2107 @execBegin
  2108 +function get_udisks_key() {
  2109 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  2110 +}
  2111 +
2151 2112 rpm -q openmamba-devel &amp;&amp; {
2152 2113 dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablebox true
2153 2114 dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablelabel true
2154 2115 }
2155 2116  
2156   -volumes=`hal-find-by-capability --capability volume`
  2117 +devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
2157 2118 partlabel=
2158 2119  
2159   -for udi in $volumes; do
2160   - device=`hal-get-property --udi $udi --key block.device`
2161   - parent_udi=`hal-get-property --udi $udi --key block.storage_device`
2162   - hotpluggable=`hal-get-property --udi $parent_udi --key storage.hotpluggable` || hotpluggable="false"
2163   - blocksize=`hal-get-property --udi $udi --key volume.block_size`
2164   - numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
2165   - volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
2166   - volname=`hal-get-property --udi $udi --key volume.label`
  2120 +for device in $devices; do
  2121 + native_path=`get_udisks_key $device native-path`
  2122 + [ -e $native_path/partition ] || continue
  2123 + is_system_internal=`get_udisks_key $device "system internal"`
  2124 + volsize=`get_udisks_key $device size`
  2125 + volsize=`expr $volsize / 1024 / 1024`
  2126 + volname=`get_udisks_key $device label`
2167 2127 [ "$volname" ] || volname="unnamed"
2168   - parttype=`hal-get-property --udi $udi --key volume.partition.type`
  2128 + parttype=`get_udisks_key $device usage`
2169 2129 [ "$parttype" ] || parttype="unknown"
2170   - partscheme=`hal-get-property --udi $udi --key volume.partition.scheme`
  2130 + partscheme=`get_udisks_key $device scheme`
2171 2131 [ "$partscheme" ] || partscheme="unknown"
2172   - fstype=`hal-get-property --udi $udi --key volume.fstype`
  2132 + fstype=`get_udisks_key $device type`
2173 2133 [ "$fstype" ] || fstype="unformatted"
2174 2134 add_info=""
2175   - [ "$hotpluggable" = "true" ] &amp;&amp; {
  2135 + [ "$is_system_internal" = "1" ] || {
2176 2136 add_info=",removable"
2177 2137 [ @removablebox.checked == 1 ] || continue
2178 2138 }
  2139 +
2179 2140 if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
2180 2141 partlabel="$partlabel&lt;br&gt;${device:5:5} $fstype $volname $volsize MB"
2181   - case "$parttype" in
2182   - 0x82) ;;
2183   - 0x83) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
  2142 + case "$fstype" in
  2143 + ext2|ext3|ext4|reiserfs|reiser4|unformatted)
  2144 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
2184 2145 *) ;;
2185 2146 esac
2186 2147 elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
... ... @@ -2204,6 +2165,57 @@
2204 2165 </stringlist>
2205 2166 </property>
2206 2167 </widget>
  2168 + <widget class="ScriptObject">
  2169 + <property name="name">
  2170 + <cstring>setlabel</cstring>
  2171 + </property>
  2172 + <property name="geometry">
  2173 + <rect>
  2174 + <x>540</x>
  2175 + <y>40</y>
  2176 + <width>32</width>
  2177 + <height>32</height>
  2178 + </rect>
  2179 + </property>
  2180 + <property name="populationText">
  2181 + <string></string>
  2182 + </property>
  2183 + <property name="associations" stdset="0">
  2184 + <stringlist>
  2185 + <string>@execBegin
  2186 +function get_udisks_key() {
  2187 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  2188 +}
  2189 +@if (@devicesbox.currentItem &gt;= 0)
  2190 + currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
  2191 + @showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
  2192 + @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
  2193 + @BackBox.setChecked(true)
  2194 +
  2195 + #
  2196 + # set MBR combo box
  2197 + #
  2198 + dcop @dcopid KommanderIf "clear(QString)" mbrbox
  2199 + devices=`udisks --enumerate-device-files | grep -v /dev/disk`
  2200 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "$currdev (@i18n("System partition"))" 0
  2201 +
  2202 + for device in $devices; do
  2203 + native_path=`get_udisks_key $device native-path`
  2204 + [ -e $native_path/partition ] &amp;&amp; continue
  2205 + is_system_internal=`get_udisks_key $device "system internal"`
  2206 + partscheme=`get_udisks_key $device scheme`
  2207 + if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
  2208 + [ "$partscheme" == "mbr" ] &amp;&amp; \
  2209 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
  2210 + fi
  2211 + done
  2212 + dcop @dcopid KommanderIf "setCurrentItem(int)" 0
  2213 +@endif
  2214 +@execEnd
  2215 +@setBootableCheckbox.execute()</string>
  2216 + </stringlist>
  2217 + </property>
  2218 + </widget>
2207 2219 </widget>
2208 2220 <widget class="QWidget">
2209 2221 <property name="name">
... ... @@ -2586,6 +2598,30 @@
2586 2598 </property>
2587 2599 </widget>
2588 2600 </widget>
  2601 + <widget class="Label">
  2602 + <property name="name">
  2603 + <cstring>Label21_2_4</cstring>
  2604 + </property>
  2605 + <property name="geometry">
  2606 + <rect>
  2607 + <x>80</x>
  2608 + <y>10</y>
  2609 + <width>470</width>
  2610 + <height>30</height>
  2611 + </rect>
  2612 + </property>
  2613 + <property name="font">
  2614 + <font>
  2615 + <pointsize>15</pointsize>
  2616 + </font>
  2617 + </property>
  2618 + <property name="text">
  2619 + <string>Choose user data partition (home)</string>
  2620 + </property>
  2621 + <property name="alignment">
  2622 + <set>AlignCenter</set>
  2623 + </property>
  2624 + </widget>
2589 2625 <widget class="ScriptObject">
2590 2626 <property name="name">
2591 2627 <cstring>setlabel_2</cstring>
... ... @@ -2618,7 +2654,6 @@
2618 2654 fi
2619 2655 @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
2620 2656 @BackBox.setChecked(true)
2621   - parent_udi=`hal-find-by-property --key block.device --string /dev/$currdev`
2622 2657 dcop @dcopid KommanderIf "setCurrentItem(int)" 0
2623 2658 @endif
2624 2659 @execEnd
2625 2660  
2626 2661  
2627 2662  
2628 2663  
2629 2664  
2630 2665  
2631 2666  
2632 2667  
... ... @@ -2644,42 +2679,45 @@
2644 2679 @BackBox.setChecked(true)
2645 2680 @NextBox.setChecked(true)
2646 2681 @execBegin
2647   -volumes=`hal-find-by-capability --capability volume`
  2682 +function get_udisks_key() {
  2683 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  2684 +}
  2685 +devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
2648 2686 partlabel=
2649 2687 installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
2650 2688 dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "@i18n("none (just use a single partition for system and home)")" 0
2651   -for udi in $volumes; do
2652   - device=`hal-get-property --udi $udi --key block.device`
  2689 +for device in $devices; do
2653 2690 [ "${device:5:5}" = "$installdevice" ] &amp;&amp; continue
2654   - parent_udi=`hal-get-property --udi $udi --key block.storage_device`
2655   - hotpluggable=`hal-get-property --udi $parent_udi --key storage.hotpluggable` || hotpluggable="false"
2656   - blocksize=`hal-get-property --udi $udi --key volume.block_size`
2657   - numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
2658   - volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
2659   - volname=`hal-get-property --udi $udi --key volume.label`
  2691 + native_path=`get_udisks_key $device native-path`
  2692 + [ -e $native_path/partition ] || continue
  2693 + is_system_internal=`get_udisks_key $device "system internal"`
  2694 + volsize=`get_udisks_key $device size`
  2695 + volsize=`expr $volsize / 1024 / 1024`
  2696 + volname=`get_udisks_key $device label`
2660 2697 [ "$volname" ] || volname="unnamed"
2661   - parttype=`hal-get-property --udi $udi --key volume.partition.type`
  2698 + parttype=`get_udisks_key $device usage`
2662 2699 [ "$parttype" ] || parttype="unknown"
2663   - partscheme=`hal-get-property --udi $udi --key volume.partition.scheme`
  2700 + partscheme=`get_udisks_key $device scheme`
2664 2701 [ "$partscheme" ] || partscheme="unknown"
2665   - fstype=`hal-get-property --udi $udi --key volume.fstype`
  2702 + fstype=`get_udisks_key $device type`
2666 2703 [ "$fstype" ] || fstype="unformatted"
2667 2704 add_info=""
2668   - [ "$hotpluggable" = "true" ] &amp;&amp; {
  2705 + [ "$is_system_internal" = "1" ] || {
2669 2706 add_info=",removable"
2670 2707 [ @removablebox.checked == 1 ] || continue
2671 2708 }
2672 2709 if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
2673 2710 partlabel="$partlabel&lt;br&gt;${device:5:5} $fstype $volname $volsize MB"
2674   - case "$parttype" in
2675   - 0x82) ;;
2676   - 0x83) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
  2711 + case "$fstype" in
  2712 + ext2|ext3|ext4|reiserfs|reiser4|unformatted)
  2713 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
2677 2714 *) ;;
2678 2715 esac
2679 2716 elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
2680 2717 case "$fstype" in
2681 2718 swap|iso9660) ;;
2682   - 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 ;;
  2719 + ext2|ext3|ext4|reiserfs|reiser4|unformatted)
  2720 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox_2 "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 1 ;;
2683 2721 *) ;;
2684 2722 esac
2685 2723 fi
... ... @@ -2689,30 +2727,6 @@
2689 2727 </stringlist>
2690 2728 </property>
2691 2729 </widget>
2692   - <widget class="Label">
2693   - <property name="name">
2694   - <cstring>Label21_2_4</cstring>
2695   - </property>
2696   - <property name="geometry">
2697   - <rect>
2698   - <x>80</x>
2699   - <y>10</y>
2700   - <width>470</width>
2701   - <height>30</height>
2702   - </rect>
2703   - </property>
2704   - <property name="font">
2705   - <font>
2706   - <pointsize>15</pointsize>
2707   - </font>
2708   - </property>
2709   - <property name="text">
2710   - <string>Choose user data partition (home)</string>
2711   - </property>
2712   - <property name="alignment">
2713   - <set>AlignCenter</set>
2714   - </property>
2715   - </widget>
2716 2730 </widget>
2717 2731 <widget class="QWidget">
2718 2732 <property name="name">
2719 2733  
2720 2734  
2721 2735  
2722 2736  
2723 2737  
2724 2738  
2725 2739  
2726 2740  
2727 2741  
2728 2742  
... ... @@ -2998,41 +3012,41 @@
2998 3012 @chainloadbox.clear
2999 3013 @setBootableCheckbox.execute()
3000 3014 @execBegin
  3015 +function get_udisks_key() {
  3016 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  3017 +}
3001 3018 conffile=~/.installer.conf
3002 3019 [ -e $conffile ] &amp;&amp; mv ${conffile} ${conffile}~
3003   -
3004 3020 installdevice=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
3005   -volumes=`hal-find-by-capability --capability volume`
  3021 +devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
3006 3022 partlabel=
3007 3023  
3008   -for udi in $volumes; do
3009   - device=`hal-get-property --udi $udi --key block.device`
  3024 +for device in $devices; do
3010 3025 [ "${device:5:5}" = "$installdevice" ] &amp;&amp; continue
3011   - parent_udi=`hal-get-property --udi $udi --key block.storage_device`
3012   - hotpluggable=`hal-get-property --udi $parent_udi --key storage.hotpluggable` || hotpluggable="false"
3013   - blocksize=`hal-get-property --udi $udi --key volume.block_size`
3014   - numblocks=`hal-get-property --udi $udi --key volume.num_blocks`
3015   - volsize=`expr $blocksize \* $numblocks / 1024 / 1024`
3016   - [ $volsize = 0 ] &amp;&amp; continue
3017   - volname=`hal-get-property --udi $udi --key volume.label`
3018   - mount_point=`hal-get-property --udi $udi --key volume.mount_point`
  3026 + native_path=`get_udisks_key $device native-path`
  3027 + [ -e $native_path/partition ] || continue
  3028 + is_system_internal=`get_udisks_key $device "system internal"`
  3029 + volsize=`get_udisks_key $device size`
  3030 + volsize=`expr $volsize / 1024 / 1024`
  3031 + volname=`get_udisks_key $device label`
3019 3032 [ "$volname" ] || volname="unnamed"
3020   - parttype=`hal-get-property --udi $udi --key volume.partition.type`
  3033 + parttype=`get_udisks_key $device usage`
3021 3034 [ "$parttype" ] || parttype="unknown"
3022   - partscheme=`hal-get-property --udi $udi --key volume.partition.scheme`
  3035 + partscheme=`get_udisks_key $device scheme`
3023 3036 [ "$partscheme" ] || partscheme="unknown"
3024   - fstype=`hal-get-property --udi $udi --key volume.fstype`
  3037 + fstype=`get_udisks_key $device type`
3025 3038 [ "$fstype" ] || fstype="unformatted"
3026 3039 add_info=""
3027   - [ "$hotpluggable" = "true" ] &amp;&amp; {
  3040 + [ "$is_system_internal" = "1" ] || {
3028 3041 add_info=",removable"
3029 3042 [ @removablebox.checked == 1 ] || continue
3030 3043 }
  3044 +
3031 3045 if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
3032 3046 partlabel="$partlabel&lt;br&gt;${device:5:5} $fstype $volname $volsize MB"
3033   - case "$parttype" in
3034   - 0x82) ;;
3035   - 0x83) ;;
  3047 + case "$fstype" in
  3048 + swap|iso9660|unformatted) ;;
  3049 + ext2|ext3|ext4|reiserfs|reiser4) ;;
3036 3050 *) dcop @dcopid KommanderIf "addListItem(QString,QString,int)" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0
3037 3051 dcop @dcopid KommanderIf "setSelection" chainloadbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})"
3038 3052 ;;
installer/installer.sh
... ... @@ -85,29 +85,8 @@
85 85 done
86 86 }
87 87  
88   -# function dev2gdev()
89   -# convert the device name to the string used by grub
90   -# using the file /boot/grub/device.map
91   -# note: in case of error the null string is returned
92   -# args:
93   -# $1: the name of the device
94   -# example:
95   -# /dev/hda3 --> (hd0,2)
96   -# /dev/sdb1 --> (hd1,0)
97   -function dev2gdev() {
98   - local devname=$1
99   -
100   - local disk=${devname:0:8} \
101   - part=${devname:8:2}
102   -
103   - [ ${part:-0} -lt 1 ] && echo -n ""
104   -
105   - cat $MOUNTPOINT/boot/grub/device.map | \
106   - while read tok1 tok2; do
107   - if [ "$tok2" = "$disk" ]; then
108   - echo -n "${tok1/)/},$(($part)))"
109   - fi
110   - done
  88 +function get_udisks_key() {
  89 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
111 90 }
112 91  
113 92 [ "$1" = "-y" ] || {
... ... @@ -117,23 +96,6 @@
117 96 exit 0
118 97 }
119 98  
120   -function find_driver_for_udi() {
121   - local found_driver parent_udi
122   -
123   - parent_udi=$1
124   - while [ ! "$found_driver" -a "$parent_udi" != "/org/freedesktop/Hal/devices/computer" ]; do
125   - parent_udi=`hal-get-property --udi $parent_udi --key info.parent 2>/dev/null`
126   - [ "`hal-get-property --udi $parent_udi --key info.subsystem 2>/dev/null`" = "pci" ] &&
127   - found_driver=`hal-get-property --udi $parent_udi --key info.linux.driver 2>/dev/null`
128   - done
129   - if [ "$found_driver" ]; then
130   - echo $found_driver
131   - return 0
132   - else
133   - return 1
134   - fi
135   -}
136   -
137 99 DCOPID=$2
138 100  
139 101 echo $"\
140 102  
141 103  
142 104  
... ... @@ -212,15 +174,16 @@
212 174 mapfile=`tempfile 2>/dev/null`
213 175  
214 176 # generate current volumes sorted list with driver information
215   - storages=`hal-find-by-capability --capability storage`
  177 + devices=`udisks --enumerate-device-files | grep -v /dev/disk`
216 178 for s in $storages; do
217   - device=`hal-get-property --udi $s --key block.device`
218   - linux_driver=`find_driver_for_udi $s`
219   - hotpluggable=`hal-get-property --udi $s --key storage.hotpluggable` || hotpluggable="false"
  179 + native_path=`get_udisks_key $device native-path`
  180 + [ -e $native_path/partition ] && continue
  181 + is_system_internal=`get_udisks_key $device "system internal"`
  182 + #linux_driver=`find_driver_for_udi $s`
220 183 [ "${device:5:2}" = "sd" -o "${device:5:2}" = "hd" ] && \
221   - echo "${device:0:8} $linux_driver" >> $tempfile
  184 + echo "${device:0:8}" >> $tempfile
222 185 if [ "$INSTALL_BOOTLOADER_DEVICE" = "$device" ]; then
223   - INSTALL_BOOTLOADER_DEVICE_HOTPLUGGABLE=$hotpluggable
  186 + INSTALL_BOOTLOADER_DEVICE_INTERNAL=$is_system_internal
224 187 fi
225 188 done
226 189 # sort
... ... @@ -462,7 +425,7 @@
462 425 fi
463 426 done
464 427 echo "GRUB_INSTALL_DEVICE=$INSTALL_BOOTLOADER_DEVICE_BYID" >> $MOUNTPOINT/etc/sysconfig/grub
465   - if [ "$INSTALL_BOOTLOADER_DEVICE_HOTPLUGGABLE" = "true" ]; then
  428 + if [ "$INSTALL_BOOTLOADER_DEVICE_INTERNAL" != "1" ]; then
466 429 echo $"Installing grub bootloader on removable device $INSTALL_BOOTLOADER_DEVICE"
467 430 echo "(hd0) $INSTALL_BOOTLOADER_DEVICE" > $MOUNTPOINT/boot/grub/device.map
468 431 grub-install $INSTALL_BOOTLOADER_DEVICE --root-directory=$MOUNTPOINT --no-floppy --force