summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/Makefile.config2
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/standalone/remove-unselected-locales40
-rw-r--r--perl-install/standalone/remove-unused-hardware-packages34
4 files changed, 77 insertions, 1 deletions
diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config
index b7b89487c..8e031ea41 100644
--- a/perl-install/Makefile.config
+++ b/perl-install/Makefile.config
@@ -9,7 +9,7 @@ SO_FILES = c/blib/arch/auto/c/c.so
PMS_DIRS = c diskdrake harddrake interactive modules partition_table resize_fat security fs fs/remote
PMS = *.pm $(PMS_DIRS:%=%/*.pm) install/*.pm install/help/*.pm install/commands install/install2
-STANDALONEPMS_ = adduserdrake bootloader-config diskdrake drakauth drakboot drakbug drakbug_report drakclock drakedm drakfont drakhelp drakperm draksec draksound draksplash drakupdate_fstab drakups drakxservices drakxtv fileshareset finish-install harddrake2 localedrake logdrake lsnetdrake notify-x11-free-driver-switch scannerdrake service_harddrake service_harddrake_confirm
+STANDALONEPMS_ = adduserdrake bootloader-config diskdrake drakauth drakboot drakbug drakbug_report drakclock drakedm drakfont drakhelp drakperm draksec draksound draksplash drakupdate_fstab drakups drakxservices drakxtv fileshareset finish-install harddrake2 localedrake logdrake lsnetdrake notify-x11-free-driver-switch remove-unselected-locales remove-unused-hardware-packages scannerdrake service_harddrake service_harddrake_confirm
STANDALONEPMS = $(STANDALONEPMS_:%=standalone/%)
ALLPMS = $(PMS) $(STANDALONEPMS)
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 4587b52d9..f2519a006 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -2,6 +2,8 @@
- finish-install: set locale at first step when language is selected
in gfxmenu (#42299)
- move hardware packages detection code from installer to drakxtools
+- add helpers to remove unused localization and hardware packages
+ (remove-unselected-locales, remove-unused-hardware-packages)
Version 11.10.2 - 18 August 2008
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?
diff --git a/perl-install/standalone/remove-unused-hardware-packages b/perl-install/standalone/remove-unused-hardware-packages
new file mode 100644
index 000000000..c1fdf0747
--- /dev/null
+++ b/perl-install/standalone/remove-unused-hardware-packages
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+use common;
+use pkgs;
+use interactive;
+use do_pkgs;
+use run_program;
+use standalone;
+
+my $in = interactive->vnew;
+
+my $wait = $in->wait_message(N("Hardware packages removal"),
+ N("Finding unused hardware packages..."));
+
+my $do_pkgs = do_pkgs->do_pkgs($in);
+
+my @all_hardware_packages = (pkgs::detect_hardware_packages($do_pkgs, 'match_all_hardware'));
+my @used_hardware_packages = (pkgs::detect_hardware_packages($do_pkgs));
+my @unneeded_hardware_packages = difference2(\@all_hardware_packages, \@used_hardware_packages);
+my @unused_hardware_packages = $do_pkgs->are_installed(@unneeded_hardware_packages);
+
+undef $wait;
+
+#- we should have some gurpme
+if (@unused_hardware_packages &&
+ $in->ask_yesorno(
+ N("Hardware packages removal"),
+ N("The following hardware packages do not seem to be useful for your system:") . "\n" .
+ join("\n", map { " " . $_ } sort(@unused_hardware_packages)) . "\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', @unused_hardware_packages);
+}