diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-10-15 17:14:51 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-10-15 17:14:51 +0000 |
commit | 7dc086d17ee94e7f64afacf48e573b29eba09989 (patch) | |
tree | eb4cc0c5295570fea40d5e3e23ba84f71050357f | |
parent | 7a8a0618bf454816fd6b589ab680c4ce4c3956c2 (diff) | |
download | mgaonline-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
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | mdkapplet-upgrade-helper | 22 |
2 files changed, 24 insertions, 0 deletions
@@ -1,3 +1,5 @@ +- mdkapplet-upgrade-helper + o check available free space, disallow upgrade if not enough room - mdkapplet o update media in chroot when using --urpmi-root 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'); |