Commit 3eae6ced60e00cd458bdf64b8649c63826b19e12

Authored by Silvan Calarco
1 parent 670a071a66
Exists in master and in 1 other branch milestone2

installer.kmdr: calculated needed system space using medium occupacy (/squashfs)

Showing 1 changed file with 162 additions and 148 deletions Side-by-side Diff

installer/installer.kmdr
... ... @@ -1451,8 +1451,104 @@
1451 1451 <set>WordBreak|AlignVCenter</set>
1452 1452 </property>
1453 1453 </widget>
  1454 + <widget class="ExecButton">
  1455 + <property name="name">
  1456 + <cstring>PartToolButton</cstring>
  1457 + </property>
  1458 + <property name="geometry">
  1459 + <rect>
  1460 + <x>420</x>
  1461 + <y>80</y>
  1462 + <width>150</width>
  1463 + <height>30</height>
  1464 + </rect>
  1465 + </property>
  1466 + <property name="text">
  1467 + <string>Ed&amp;it disk partitions</string>
  1468 + </property>
  1469 + <property name="associations" stdset="0">
  1470 + <stringlist>
  1471 + <string>@RunPartTool.execute()
  1472 +@scandisks.execute()
  1473 +@rebootneededbox.setChecked(false)
  1474 +@execBegin
  1475 +function get_udisks_key() {
  1476 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  1477 +}
  1478 +
  1479 +devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
  1480 +for device in $devices; do
  1481 + native_path=`get_udisks_key $device native-path`
  1482 + [ -e $native_path/partition ] &amp;&amp; continue
  1483 + partscheme=`get_udisks_key $device scheme`
  1484 + is_system_internal=`get_udisks_key $device "system internal"`
  1485 + [ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] &amp;&amp; continue
  1486 + [ "$partscheme" = "none" -o "$partscheme" = "" ] &amp;&amp; dcop @dcopid KommanderIf setChecked rebootneededbox true
  1487 +done
  1488 +@execEnd
  1489 +@setGlobal("rebootquest","0")
  1490 +@if (@rebootneededbox.checked)
  1491 + @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"))))
  1492 +@endif
  1493 +@if (@global("rebootquest") == "1")
  1494 +if [ -x /usr/bin/qdbus ]; then
  1495 + /usr/bin/qdbus org.kde.ksmserver /KSMServer logout 0 1 2
  1496 +else
  1497 + dcop ksmserver ksmserver logout 0 1 1
  1498 +fi
  1499 +@endif
  1500 +</string>
  1501 + </stringlist>
  1502 + </property>
  1503 + </widget>
1454 1504 <widget class="ScriptObject">
1455 1505 <property name="name">
  1506 + <cstring>RunPartTool</cstring>
  1507 + </property>
  1508 + <property name="geometry">
  1509 + <rect>
  1510 + <x>550</x>
  1511 + <y>40</y>
  1512 + <width>32</width>
  1513 + <height>32</height>
  1514 + </rect>
  1515 + </property>
  1516 + <property name="associations" stdset="0">
  1517 + <stringlist>
  1518 + <string>@exec("dcop kded kded unloadModule medianotifier")
  1519 +@execBegin
  1520 +function get_udisks_key() {
  1521 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  1522 +}
  1523 +volumes=`udisks --enumerate-device-files | grep -v /dev/disk`
  1524 +for v in $volumes; do
  1525 + native_path=`get_udisks_key $v native-path`
  1526 + [ ! -e $native_path/partition ] || continue
  1527 + udisks --unmount $v
  1528 +done
  1529 +/sbin/swapoff -a
  1530 +@execEnd
  1531 +@PartitionBox.setEnabled(false)
  1532 +@BootloaderBox.setEnabled(false)
  1533 +@Message.info("&lt;b&gt;
  1534 +@i18n("Hint: in order to install openmamba you should create:")
  1535 +&lt;/b&gt;&lt;br&gt;&lt;ul&gt;
  1536 +&lt;li&gt;@i18n("a Linux partition (type ext2,ext3,ext4 or reiserfs)")
  1537 +&lt;li&gt;@i18n("a Linux SWAP partition")
  1538 +&lt;/ul&gt;
  1539 +@i18n("Press OK to launch the disk partitioning tool.")
  1540 +",@i18n("Hint for partitioning"))
  1541 +@exec(/usr/sbin/gparted)
  1542 +@scanDevices.execute()
  1543 +@exec("dcop kded kded loadModule medianotifier")
  1544 +@PartitionBox.setEnabled(true)
  1545 +@BootloaderBox.setEnabled(true)
  1546 +</string>
  1547 + </stringlist>
  1548 + </property>
  1549 + </widget>
  1550 + <widget class="ScriptObject">
  1551 + <property name="name">
1456 1552 <cstring>scandisks</cstring>
1457 1553 </property>
1458 1554 <property name="geometry">
... ... @@ -1484,7 +1580,13 @@
1484 1580 else
1485 1581 swaprequired=`expr $memsize / 1024`
1486 1582 fi
1487   -systemrequired=5120
  1583 +if [ -e /squashfs ]; then
  1584 + systemoccupacy=`du -sm /squashfs | sed "s|[[:space:]].*||"`
  1585 + systemrequired=`expr $systemoccupacy \* 2`
  1586 +else
  1587 + systemrequired=5120
  1588 +fi
  1589 +
1488 1590 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")"
1489 1591  
1490 1592 for d in $devices; do
... ... @@ -1559,102 +1661,6 @@
1559 1661 </stringlist>
1560 1662 </property>
1561 1663 </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>
1612   - <widget class="ScriptObject">
1613   - <property name="name">
1614   - <cstring>RunPartTool</cstring>
1615   - </property>
1616   - <property name="geometry">
1617   - <rect>
1618   - <x>550</x>
1619   - <y>40</y>
1620   - <width>32</width>
1621   - <height>32</height>
1622   - </rect>
1623   - </property>
1624   - <property name="associations" stdset="0">
1625   - <stringlist>
1626   - <string>@exec("dcop kded kded unloadModule medianotifier")
1627   -@execBegin
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`
1632   -for v in $volumes; do
1633   - native_path=`get_udisks_key $v native-path`
1634   - [ ! -e $native_path/partition ] || continue
1635   - udisks --unmount $v
1636   -done
1637   -/sbin/swapoff -a
1638   -@execEnd
1639   -@PartitionBox.setEnabled(false)
1640   -@BootloaderBox.setEnabled(false)
1641   -@Message.info("&lt;b&gt;
1642   -@i18n("Hint: in order to install openmamba you should create:")
1643   -&lt;/b&gt;&lt;br&gt;&lt;ul&gt;
1644   -&lt;li&gt;@i18n("a Linux partition (type ext2,ext3,ext4 or reiserfs)")
1645   -&lt;li&gt;@i18n("a Linux SWAP partition")
1646   -&lt;/ul&gt;
1647   -@i18n("Press OK to launch the disk partitioning tool.")
1648   -",@i18n("Hint for partitioning"))
1649   -@exec(/usr/sbin/gparted)
1650   -@scanDevices.execute()
1651   -@exec("dcop kded kded loadModule medianotifier")
1652   -@PartitionBox.setEnabled(true)
1653   -@BootloaderBox.setEnabled(true)
1654   -</string>
1655   - </stringlist>
1656   - </property>
1657   - </widget>
1658 1664 </widget>
1659 1665 <widget class="QWidget">
1660 1666 <property name="name">
... ... @@ -2089,6 +2095,57 @@
2089 2095 </widget>
2090 2096 <widget class="ScriptObject">
2091 2097 <property name="name">
  2098 + <cstring>setlabel</cstring>
  2099 + </property>
  2100 + <property name="geometry">
  2101 + <rect>
  2102 + <x>540</x>
  2103 + <y>40</y>
  2104 + <width>32</width>
  2105 + <height>32</height>
  2106 + </rect>
  2107 + </property>
  2108 + <property name="populationText">
  2109 + <string></string>
  2110 + </property>
  2111 + <property name="associations" stdset="0">
  2112 + <stringlist>
  2113 + <string>@execBegin
  2114 +function get_udisks_key() {
  2115 + LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
  2116 +}
  2117 +@if (@devicesbox.currentItem &gt;= 0)
  2118 + currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
  2119 + @showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
  2120 + @dcop(@dcopid, KommanderIf, enableWidget(QString,bool), next, true)
  2121 + @BackBox.setChecked(true)
  2122 +
  2123 + #
  2124 + # set MBR combo box
  2125 + #
  2126 + dcop @dcopid KommanderIf "clear(QString)" mbrbox
  2127 + devices=`udisks --enumerate-device-files | grep -v /dev/disk`
  2128 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "$currdev (@i18n("System partition"))" 0
  2129 +
  2130 + for device in $devices; do
  2131 + native_path=`get_udisks_key $device native-path`
  2132 + [ -e $native_path/partition ] &amp;&amp; continue
  2133 + is_system_internal=`get_udisks_key $device "system internal"`
  2134 + partscheme=`get_udisks_key $device scheme`
  2135 + if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
  2136 + [ "$partscheme" == "mbr" ] &amp;&amp; \
  2137 + dcop @dcopid KommanderIf "addListItem(QString,QString,int)" mbrbox "${device:5:5} (master boot record)" 0
  2138 + fi
  2139 + done
  2140 + dcop @dcopid KommanderIf "setCurrentItem(int)" 0
  2141 +@endif
  2142 +@execEnd
  2143 +@setBootableCheckbox.execute()</string>
  2144 + </stringlist>
  2145 + </property>
  2146 + </widget>
  2147 + <widget class="ScriptObject">
  2148 + <property name="name">
2092 2149 <cstring>scanDevices</cstring>
2093 2150 </property>
2094 2151 <property name="geometry">
... ... @@ -2114,6 +2171,13 @@
2114 2171 dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablelabel true
2115 2172 }
2116 2173  
  2174 +if [ -e /squashfs ]; then
  2175 + systemoccupacy=`du -sm /squashfs | sed "s|[[:space:]].*||"`
  2176 + systemrequired=`expr $systemoccupacy \* 2`
  2177 +else
  2178 + systemrequired=5120
  2179 +fi
  2180 +
2117 2181 devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
2118 2182 partlabel=
2119 2183  
... ... @@ -2123,6 +2187,7 @@
2123 2187 is_system_internal=`get_udisks_key $device "system internal"`
2124 2188 volsize=`get_udisks_key $device size`
2125 2189 volsize=`expr $volsize / 1024 / 1024`
  2190 + [ $systemrequired -le $volsize ] || continue
2126 2191 volname=`get_udisks_key $device label`
2127 2192 [ "$volname" ] || volname="unnamed"
2128 2193 parttype=`get_udisks_key $device usage`
... ... @@ -2162,57 +2227,6 @@
2162 2227 @dcop(@dcopid, MainApplication-Interface, quit())
2163 2228 @end
2164 2229 @endif</string>
2165   - </stringlist>
2166   - </property>
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 2230 </stringlist>
2217 2231 </property>
2218 2232 </widget>