summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/remove-unselected-locales
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-08-18 18:35:33 +0000
committerOlivier Blin <oblin@mandriva.com>2008-08-18 18:35:33 +0000
commit3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b (patch)
tree39f7836b86f3b25b7cba01e3078bf4a4111845d0 /perl-install/standalone/remove-unselected-locales
parent646cb1d7c756ac18da31157f0e234ece0a1f3f41 (diff)
downloaddrakx-3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b.tar
drakx-3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b.tar.gz
drakx-3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b.tar.bz2
drakx-3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b.tar.xz
drakx-3fe3248881feee76de20a2e8ecd4d6e0aa8efd5b.zip
add helpers to remove unused localization and hardware packages
(remove-unselected-locales, remove-unused-hardware-packages)
Diffstat (limited to 'perl-install/standalone/remove-unselected-locales')
-rw-r--r--perl-install/standalone/remove-unselected-locales40
1 files changed, 40 insertions, 0 deletions
diff --git a/perl-install/standalone/remove-unselected-locales b/perl-install/standalone/remove-unselected-locales
new file mode 100644
index 000000000..f25628fd5
--- /dev/null
+++ b/perl-install/standalone/remove-unselected-locales
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+use common;
+use lang;
+use interactive;
+use do_pkgs;
+use run_program;
+use standalone;
+
+my $locales_prefix = 'locales-';
+
+my $in = interactive->vnew;
+
+my $wait = $in->wait_message(N("Localization packages removal"),
+ N("Finding unused localization packages..."));
+
+my $do_pkgs = do_pkgs->do_pkgs($in);
+my $locale = lang::read();
+my $selected_locale = $locales_prefix. $locale->{lang};
+my @available_locales = $do_pkgs->are_installed($locales_prefix . '*');
+
+my @unselected_locales;
+@unselected_locales = difference2(\@available_locales, [ $selected_locale ])
+ if member($selected_locale, @available_locales);
+
+undef $wait;
+
+#- we should have some gurpme
+if (@unselected_locales &&
+ $in->ask_yesorno(
+ N("Localization packages removal"),
+ N("The following localization packages do not seem to be useful for your system:") . "\n" .
+ join("\n", map { " " . $_ } sort(@unselected_locales)) . "\n" .
+ N("Do you want to remove these packages?"))) {
+ my $_wait = $in->wait_message(N("Please wait"), N("Removing packages..."));
+ run_program::run('urpme', '--auto', @unselected_locales);
+}
+
+# use script from One to list language files (/usr/share/locale mainly) and remove them?