summaryrefslogtreecommitdiffstats
path: root/mdkapplet-upgrade-helper
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-15 17:14:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-15 17:14:51 +0000
commit7dc086d17ee94e7f64afacf48e573b29eba09989 (patch)
treeeb4cc0c5295570fea40d5e3e23ba84f71050357f /mdkapplet-upgrade-helper
parent7a8a0618bf454816fd6b589ab680c4ce4c3956c2 (diff)
downloadmgaonline-7dc086d17ee94e7f64afacf48e573b29eba09989.tar
mgaonline-7dc086d17ee94e7f64afacf48e573b29eba09989.tar.gz
mgaonline-7dc086d17ee94e7f64afacf48e573b29eba09989.tar.bz2
mgaonline-7dc086d17ee94e7f64afacf48e573b29eba09989.tar.xz
mgaonline-7dc086d17ee94e7f64afacf48e573b29eba09989.zip
- mdkapplet-upgrade-helper
o check available free space, disallow upgrade if not enough room
Diffstat (limited to 'mdkapplet-upgrade-helper')
-rwxr-xr-xmdkapplet-upgrade-helper22
1 files changed, 22 insertions, 0 deletions
diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper
index 21212e58..03f51054 100755
--- a/mdkapplet-upgrade-helper
+++ b/mdkapplet-upgrade-helper
@@ -54,12 +54,34 @@ my $root = Rpmdrake::open_db::fast_open_urpmi_db()->{root};
my $product_id = common::parse_LDAP_namespace_structure(cat_("$root/etc/product.id"));
+if (!$ENV{URPMI_IGNORESIZE}) {
+ check_available_free_space('/usr', 800) &&
+ check_available_free_space('/var', 800)
+ or exit(1);
+}
+
run_program::raw({ detach => 1 }, 'ionice', '-p', $$, '-n7');
upgrade();
my ($refork_gurpmi);
+sub check_available_free_space {
+ my ($dir, $wanted_MB) = @_;
+
+ my (undef, $free_KB) = MDK::Common::System::df($dir);
+
+ if ($free_KB / 1024 < $wanted_MB) {
+ my $msg = ugtk2::escape_text_for_TextView_markup_format(
+ N("Your system does not have enough space left in %s for upgrade (%dMB < %dMB)",
+ $dir,
+ $free_KB / 1024, $wanted_MB));
+ ugtk2::ask_warn(N("Error"), $msg);
+ 0;
+ } else {
+ 1;
+ }
+}
sub run_gurpmi() {
my @initial_args = ('--replacefiles', '--clean');