Commit 3eae6ced authored by Silvan Calarco's avatar Silvan Calarco

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

parent 670a071a
......@@ -1451,6 +1451,102 @@ dcop @dcopid KommanderIf setBusyCursor false
<set>WordBreak|AlignVCenter</set>
</property>
</widget>
<widget class="ExecButton">
<property name="name">
<cstring>PartToolButton</cstring>
</property>
<property name="geometry">
<rect>
<x>420</x>
<y>80</y>
<width>150</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Ed&amp;it disk partitions</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@RunPartTool.execute()
@scandisks.execute()
@rebootneededbox.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`
for device in $devices; do
native_path=`get_udisks_key $device native-path`
[ -e $native_path/partition ] &amp;&amp; continue
partscheme=`get_udisks_key $device scheme`
is_system_internal=`get_udisks_key $device "system internal"`
[ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] &amp;&amp; continue
[ "$partscheme" = "none" -o "$partscheme" = "" ] &amp;&amp; dcop @dcopid KommanderIf setChecked rebootneededbox true
done
@execEnd
@setGlobal("rebootquest","0")
@if (@rebootneededbox.checked)
@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"))))
@endif
@if (@global("rebootquest") == "1")
if [ -x /usr/bin/qdbus ]; then
/usr/bin/qdbus org.kde.ksmserver /KSMServer logout 0 1 2
else
dcop ksmserver ksmserver logout 0 1 1
fi
@endif
</string>
</stringlist>
</property>
</widget>
<widget class="ScriptObject">
<property name="name">
<cstring>RunPartTool</cstring>
</property>
<property name="geometry">
<rect>
<x>550</x>
<y>40</y>
<width>32</width>
<height>32</height>
</rect>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@exec("dcop kded kded unloadModule medianotifier")
@execBegin
function get_udisks_key() {
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
}
volumes=`udisks --enumerate-device-files | grep -v /dev/disk`
for v in $volumes; do
native_path=`get_udisks_key $v native-path`
[ ! -e $native_path/partition ] || continue
udisks --unmount $v
done
/sbin/swapoff -a
@execEnd
@PartitionBox.setEnabled(false)
@BootloaderBox.setEnabled(false)
@Message.info("&lt;b&gt;
@i18n("Hint: in order to install openmamba you should create:")
&lt;/b&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;@i18n("a Linux partition (type ext2,ext3,ext4 or reiserfs)")
&lt;li&gt;@i18n("a Linux SWAP partition")
&lt;/ul&gt;
@i18n("Press OK to launch the disk partitioning tool.")
",@i18n("Hint for partitioning"))
@exec(/usr/sbin/gparted)
@scanDevices.execute()
@exec("dcop kded kded loadModule medianotifier")
@PartitionBox.setEnabled(true)
@BootloaderBox.setEnabled(true)
</string>
</stringlist>
</property>
</widget>
<widget class="ScriptObject">
<property name="name">
<cstring>scandisks</cstring>
......@@ -1484,7 +1580,13 @@ elif [ $memsize -lt 4194304 ]; then
else
swaprequired=`expr $memsize / 1024`
fi
systemrequired=5120
if [ -e /squashfs ]; then
systemoccupacy=`du -sm /squashfs | sed "s|[[:space:]].*||"`
systemrequired=`expr $systemoccupacy \* 2`
else
systemrequired=5120
fi
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")"
for d in $devices; do
......@@ -1555,102 +1657,6 @@ else
fi
dcop @dcopid KommanderIf setText installhint "$insthint"
@execEnd
</string>
</stringlist>
</property>
</widget>
<widget class="ExecButton">
<property name="name">
<cstring>PartToolButton</cstring>
</property>
<property name="geometry">
<rect>
<x>420</x>
<y>80</y>
<width>150</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Ed&amp;it disk partitions</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@RunPartTool.execute()
@scandisks.execute()
@rebootneededbox.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`
for device in $devices; do
native_path=`get_udisks_key $device native-path`
[ -e $native_path/partition ] &amp;&amp; continue
partscheme=`get_udisks_key $device scheme`
is_system_internal=`get_udisks_key $device "system internal"`
[ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] &amp;&amp; continue
[ "$partscheme" = "none" -o "$partscheme" = "" ] &amp;&amp; dcop @dcopid KommanderIf setChecked rebootneededbox true
done
@execEnd
@setGlobal("rebootquest","0")
@if (@rebootneededbox.checked)
@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"))))
@endif
@if (@global("rebootquest") == "1")
if [ -x /usr/bin/qdbus ]; then
/usr/bin/qdbus org.kde.ksmserver /KSMServer logout 0 1 2
else
dcop ksmserver ksmserver logout 0 1 1
fi
@endif
</string>
</stringlist>
</property>
</widget>
<widget class="ScriptObject">
<property name="name">
<cstring>RunPartTool</cstring>
</property>
<property name="geometry">
<rect>
<x>550</x>
<y>40</y>
<width>32</width>
<height>32</height>
</rect>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@exec("dcop kded kded unloadModule medianotifier")
@execBegin
function get_udisks_key() {
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
}
volumes=`udisks --enumerate-device-files | grep -v /dev/disk`
for v in $volumes; do
native_path=`get_udisks_key $v native-path`
[ ! -e $native_path/partition ] || continue
udisks --unmount $v
done
/sbin/swapoff -a
@execEnd
@PartitionBox.setEnabled(false)
@BootloaderBox.setEnabled(false)
@Message.info("&lt;b&gt;
@i18n("Hint: in order to install openmamba you should create:")
&lt;/b&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;@i18n("a Linux partition (type ext2,ext3,ext4 or reiserfs)")
&lt;li&gt;@i18n("a Linux SWAP partition")
&lt;/ul&gt;
@i18n("Press OK to launch the disk partitioning tool.")
",@i18n("Hint for partitioning"))
@exec(/usr/sbin/gparted)
@scanDevices.execute()
@exec("dcop kded kded loadModule medianotifier")
@PartitionBox.setEnabled(true)
@BootloaderBox.setEnabled(true)
</string>
</stringlist>
</property>
......@@ -2087,6 +2093,57 @@ done
</hbox>
</widget>
</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 &gt;= 0)
currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
@showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
@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 $device native-path`
[ -e $native_path/partition ] &amp;&amp; continue
is_system_internal=`get_udisks_key $device "system internal"`
partscheme=`get_udisks_key $device scheme`
if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
[ "$partscheme" == "mbr" ] &amp;&amp; \
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>
......@@ -2114,6 +2171,13 @@ rpm -q openmamba-devel &amp;&amp; {
dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablelabel true
}
if [ -e /squashfs ]; then
systemoccupacy=`du -sm /squashfs | sed "s|[[:space:]].*||"`
systemrequired=`expr $systemoccupacy \* 2`
else
systemrequired=5120
fi
devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
partlabel=
......@@ -2123,6 +2187,7 @@ for device in $devices; do
is_system_internal=`get_udisks_key $device "system internal"`
volsize=`get_udisks_key $device size`
volsize=`expr $volsize / 1024 / 1024`
[ $systemrequired -le $volsize ] || continue
volname=`get_udisks_key $device label`
[ "$volname" ] || volname="unnamed"
parttype=`get_udisks_key $device usage`
......@@ -2165,57 +2230,6 @@ done
</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 &gt;= 0)
currdev=@String.section(@devicesbox.item(@devicesbox.currentItem)," ",0)
@showdevice.setText(@devicesbox.item(@devicesbox.currentItem))
@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 $device native-path`
[ -e $native_path/partition ] &amp;&amp; continue
is_system_internal=`get_udisks_key $device "system internal"`
partscheme=`get_udisks_key $device scheme`
if [ "$is_system_internal" == "1" -o "@removablebox.checked" == "1" ]; then
[ "$partscheme" == "mbr" ] &amp;&amp; \
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">
<property name="name">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment