installer.kmdr: calculated needed system space using medium occupacy (/squashfs)
This commit is contained in:
parent
670a071a66
commit
3eae6ced60
@ -1451,114 +1451,6 @@ dcop @dcopid KommanderIf setBusyCursor false
|
||||
<set>WordBreak|AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>scandisks</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>550</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@partitionslabel.clear
|
||||
@BackBox.setChecked(true)
|
||||
@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`
|
||||
partlabel=
|
||||
linuxok=
|
||||
swapok=
|
||||
memsize=`cat /proc/meminfo |grep MemTotal:|sed "s|[^0-9]||g"`
|
||||
if [ $memsize -lt 1048576 ]; then
|
||||
swaprequired=`expr $memsize / 512`
|
||||
elif [ $memsize -lt 4194304 ]; then
|
||||
swaprequired=`expr $memsize / 683`
|
||||
else
|
||||
swaprequired=`expr $memsize / 1024`
|
||||
fi
|
||||
systemrequired=5120
|
||||
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
|
||||
diskdevice=${d/\/dev\/}
|
||||
native_path=`get_udisks_key $d native-path`
|
||||
[ ! -e $native_path/partition ] || continue
|
||||
vendor=`get_udisks_key $d vendor`
|
||||
product=`get_udisks_key $d model`
|
||||
is_system_internal=`get_udisks_key $d "system internal"`
|
||||
[ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue
|
||||
partscheme=`get_udisks_key $d scheme`
|
||||
[ "$partscheme" ] || continue
|
||||
disksize=`get_udisks_key $d size`
|
||||
disksize=`expr $disksize / 1024 / 1024 / 1024`
|
||||
volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
|
||||
thisdisk=
|
||||
|
||||
for v in $volumes; do
|
||||
device=/dev/$v
|
||||
v_native_path=$native_path/$v
|
||||
volsize=`get_udisks_key $device size`
|
||||
volsize=`expr $volsize / 1024 / 1024`
|
||||
volname=`get_udisks_key $device label`
|
||||
parttype=`get_udisks_key $device usage`
|
||||
[ "$parttype" ] || parttype="unknown"
|
||||
fstype=`get_udisks_key $device type`
|
||||
[ "$fstype" ] || fstype="unformatted"
|
||||
add_info=""
|
||||
[ "$is_system_internal" = "1" ] || add_info=",removable"
|
||||
[ "$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>"
|
||||
|
||||
case "$fstype" in
|
||||
swap) if [ $swaprequired -le $volsize ]; then
|
||||
swapok=1
|
||||
thispart="$thispart<td><b>@i18n("OK for swap")</b></td>"
|
||||
fi
|
||||
;;
|
||||
linux|ext2|ext3|ext4|reiserfs|reiser4)
|
||||
if [ $systemrequired -le $volsize ]; then
|
||||
linuxok=1
|
||||
thispart="$thispart<td><b>@i18n("OK for system")</b></td>"
|
||||
fi
|
||||
;;
|
||||
*) thispart="$thispart<td></td>"
|
||||
;;
|
||||
esac
|
||||
thisdisk="${thispart}${thisdisk}"
|
||||
|
||||
done
|
||||
partlabel="<b>@i18n("Disk") $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}"
|
||||
done
|
||||
|
||||
dcop @dcopid KommanderIf setText partitionslabel "$partlabel"
|
||||
if [ @swapcheckbox.checked = 1 ]; then
|
||||
swapok="1"
|
||||
fi
|
||||
insthint=""
|
||||
[ "$linuxok" ] || insthint="${insthint}@i18n("You need to create a Linux type partition<br>")"
|
||||
[ "$swapok" ] || insthint="${insthint}@i18n("You need to create a SWAP type partition<br>")"
|
||||
if [ "$linuxok" -a "$swapok" ]; then
|
||||
insthint="${insthint}<b>@i18n("GOOD, you have both a Linux and SWAP partition.")</b><br>@i18n("Please, modify the partitions or press Next to proceed with the installation.")"
|
||||
dcop @dcopid KommanderIf setChecked NextBox "true"
|
||||
else
|
||||
insthint="${insthint}<br><br>@i18n("Please, press the button above and modify the partitions as needed before proceeding.")<br>"
|
||||
dcop @dcopid KommanderIf setChecked NextBox "false"
|
||||
fi
|
||||
dcop @dcopid KommanderIf setText installhint "$insthint"
|
||||
@execEnd
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ExecButton">
|
||||
<property name="name">
|
||||
<cstring>PartToolButton</cstring>
|
||||
@ -1651,6 +1543,120 @@ done
|
||||
@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>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>550</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@partitionslabel.clear
|
||||
@BackBox.setChecked(true)
|
||||
@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`
|
||||
partlabel=
|
||||
linuxok=
|
||||
swapok=
|
||||
memsize=`cat /proc/meminfo |grep MemTotal:|sed "s|[^0-9]||g"`
|
||||
if [ $memsize -lt 1048576 ]; then
|
||||
swaprequired=`expr $memsize / 512`
|
||||
elif [ $memsize -lt 4194304 ]; then
|
||||
swaprequired=`expr $memsize / 683`
|
||||
else
|
||||
swaprequired=`expr $memsize / 1024`
|
||||
fi
|
||||
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):<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
|
||||
diskdevice=${d/\/dev\/}
|
||||
native_path=`get_udisks_key $d native-path`
|
||||
[ ! -e $native_path/partition ] || continue
|
||||
vendor=`get_udisks_key $d vendor`
|
||||
product=`get_udisks_key $d model`
|
||||
is_system_internal=`get_udisks_key $d "system internal"`
|
||||
[ "$is_system_internal" != "1" -a @removablebox.checked == 0 ] && continue
|
||||
partscheme=`get_udisks_key $d scheme`
|
||||
[ "$partscheme" ] || continue
|
||||
disksize=`get_udisks_key $d size`
|
||||
disksize=`expr $disksize / 1024 / 1024 / 1024`
|
||||
volumes=`ls -d $native_path/${diskdevice}* 2>/dev/null | sed "s|.*/||" | sort -n -r`
|
||||
thisdisk=
|
||||
|
||||
for v in $volumes; do
|
||||
device=/dev/$v
|
||||
v_native_path=$native_path/$v
|
||||
volsize=`get_udisks_key $device size`
|
||||
volsize=`expr $volsize / 1024 / 1024`
|
||||
volname=`get_udisks_key $device label`
|
||||
parttype=`get_udisks_key $device usage`
|
||||
[ "$parttype" ] || parttype="unknown"
|
||||
fstype=`get_udisks_key $device type`
|
||||
[ "$fstype" ] || fstype="unformatted"
|
||||
add_info=""
|
||||
[ "$is_system_internal" = "1" ] || add_info=",removable"
|
||||
[ "$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>"
|
||||
|
||||
case "$fstype" in
|
||||
swap) if [ $swaprequired -le $volsize ]; then
|
||||
swapok=1
|
||||
thispart="$thispart<td><b>@i18n("OK for swap")</b></td>"
|
||||
fi
|
||||
;;
|
||||
linux|ext2|ext3|ext4|reiserfs|reiser4)
|
||||
if [ $systemrequired -le $volsize ]; then
|
||||
linuxok=1
|
||||
thispart="$thispart<td><b>@i18n("OK for system")</b></td>"
|
||||
fi
|
||||
;;
|
||||
*) thispart="$thispart<td></td>"
|
||||
;;
|
||||
esac
|
||||
thisdisk="${thispart}${thisdisk}"
|
||||
|
||||
done
|
||||
partlabel="<b>@i18n("Disk") $vendor $product $disksize GB (${diskdevice})</b>:<br><br><table cellspacing=0 cellpadding=0><tr>${thisdisk}</tr></table>${partlabel}"
|
||||
done
|
||||
|
||||
dcop @dcopid KommanderIf setText partitionslabel "$partlabel"
|
||||
if [ @swapcheckbox.checked = 1 ]; then
|
||||
swapok="1"
|
||||
fi
|
||||
insthint=""
|
||||
[ "$linuxok" ] || insthint="${insthint}@i18n("You need to create a Linux type partition<br>")"
|
||||
[ "$swapok" ] || insthint="${insthint}@i18n("You need to create a SWAP type partition<br>")"
|
||||
if [ "$linuxok" -a "$swapok" ]; then
|
||||
insthint="${insthint}<b>@i18n("GOOD, you have both a Linux and SWAP partition.")</b><br>@i18n("Please, modify the partitions or press Next to proceed with the installation.")"
|
||||
dcop @dcopid KommanderIf setChecked NextBox "true"
|
||||
else
|
||||
insthint="${insthint}<br><br>@i18n("Please, press the button above and modify the partitions as needed before proceeding.")<br>"
|
||||
dcop @dcopid KommanderIf setChecked NextBox "false"
|
||||
fi
|
||||
dcop @dcopid KommanderIf setText installhint "$insthint"
|
||||
@execEnd
|
||||
</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
@ -2087,84 +2093,6 @@ done
|
||||
</hbox>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>scanDevices</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@devicesbox.clear
|
||||
@BackBox.setChecked(true)
|
||||
@NextBox.setChecked(false)
|
||||
@execBegin
|
||||
function get_udisks_key() {
|
||||
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
|
||||
}
|
||||
|
||||
rpm -q openmamba-devel && {
|
||||
dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablebox true
|
||||
dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablelabel true
|
||||
}
|
||||
|
||||
devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n -r`
|
||||
partlabel=
|
||||
|
||||
for device in $devices; do
|
||||
native_path=`get_udisks_key $device native-path`
|
||||
[ -e $native_path/partition ] || continue
|
||||
is_system_internal=`get_udisks_key $device "system internal"`
|
||||
volsize=`get_udisks_key $device size`
|
||||
volsize=`expr $volsize / 1024 / 1024`
|
||||
volname=`get_udisks_key $device label`
|
||||
[ "$volname" ] || volname="unnamed"
|
||||
parttype=`get_udisks_key $device usage`
|
||||
[ "$parttype" ] || parttype="unknown"
|
||||
partscheme=`get_udisks_key $device scheme`
|
||||
[ "$partscheme" ] || partscheme="unknown"
|
||||
fstype=`get_udisks_key $device type`
|
||||
[ "$fstype" ] || fstype="unformatted"
|
||||
add_info=""
|
||||
[ "$is_system_internal" = "1" ] || {
|
||||
add_info=",removable"
|
||||
[ @removablebox.checked == 1 ] || continue
|
||||
}
|
||||
|
||||
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
|
||||
partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
|
||||
case "$fstype" in
|
||||
ext2|ext3|ext4|reiserfs|reiser4|unformatted)
|
||||
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
|
||||
*) ;;
|
||||
esac
|
||||
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
|
||||
case "$fstype" in
|
||||
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 ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
@execEnd
|
||||
@if (@devicesbox.count == "0")
|
||||
@switch(@Message.question(@i18n("No installable partitions found, do you want to launch the partitioning tool?"), @i18n("No installable partitions found"), Launch, Abort))
|
||||
@case(1)
|
||||
@RunPartTool.execute()
|
||||
@case(2)
|
||||
@Message.info(@i18n("Installation aborted."))
|
||||
@dcop(@dcopid, MainApplication-Interface, quit())
|
||||
@end
|
||||
@endif</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>setlabel</cstring>
|
||||
@ -2216,6 +2144,92 @@ function get_udisks_key() {
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ScriptObject">
|
||||
<property name="name">
|
||||
<cstring>scanDevices</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>0</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="associations" stdset="0">
|
||||
<stringlist>
|
||||
<string>@devicesbox.clear
|
||||
@BackBox.setChecked(true)
|
||||
@NextBox.setChecked(false)
|
||||
@execBegin
|
||||
function get_udisks_key() {
|
||||
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
|
||||
}
|
||||
|
||||
rpm -q openmamba-devel && {
|
||||
dcop @dcopid KommanderIf "setEnabled(QString,bool)" stablebox true
|
||||
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=
|
||||
|
||||
for device in $devices; do
|
||||
native_path=`get_udisks_key $device native-path`
|
||||
[ -e $native_path/partition ] || continue
|
||||
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`
|
||||
[ "$parttype" ] || parttype="unknown"
|
||||
partscheme=`get_udisks_key $device scheme`
|
||||
[ "$partscheme" ] || partscheme="unknown"
|
||||
fstype=`get_udisks_key $device type`
|
||||
[ "$fstype" ] || fstype="unformatted"
|
||||
add_info=""
|
||||
[ "$is_system_internal" = "1" ] || {
|
||||
add_info=",removable"
|
||||
[ @removablebox.checked == 1 ] || continue
|
||||
}
|
||||
|
||||
if [ "$partscheme" == "mbr" -o "$partscheme" == "embr" ]; then
|
||||
partlabel="$partlabel<br>${device:5:5} $fstype $volname $volsize MB"
|
||||
case "$fstype" in
|
||||
ext2|ext3|ext4|reiserfs|reiser4|unformatted)
|
||||
dcop @dcopid KommanderIf "addListItem(QString,QString,int)" devicesbox "${device:5:5} ($fstype,$volname,$volsize MB${add_info})" 0 ;;
|
||||
*) ;;
|
||||
esac
|
||||
elif [ "$partscheme" == "gpt" -o "$partscheme" == "unknown" -a $volsize -gt 0 ]; then
|
||||
case "$fstype" in
|
||||
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 ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
@execEnd
|
||||
@if (@devicesbox.count == "0")
|
||||
@switch(@Message.question(@i18n("No installable partitions found, do you want to launch the partitioning tool?"), @i18n("No installable partitions found"), Launch, Abort))
|
||||
@case(1)
|
||||
@RunPartTool.execute()
|
||||
@case(2)
|
||||
@Message.info(@i18n("Installation aborted."))
|
||||
@dcop(@dcopid, MainApplication-Interface, quit())
|
||||
@end
|
||||
@endif</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
|
Loading…
Reference in New Issue
Block a user