summaryrefslogtreecommitdiffstats
path: root/mgaapplet-upgrade-helper
diff options
context:
space:
mode:
Diffstat (limited to 'mgaapplet-upgrade-helper')
-rwxr-xr-xmgaapplet-upgrade-helper39
1 files changed, 39 insertions, 0 deletions
diff --git a/mgaapplet-upgrade-helper b/mgaapplet-upgrade-helper
index 7c4286c9..543ee66d 100755
--- a/mgaapplet-upgrade-helper
+++ b/mgaapplet-upgrade-helper
@@ -234,6 +234,26 @@ packages as well?)."))
);
exit(1);
}
+
+ my $nonfree = 0;
+ my $tainted = 0;
+
+ log::explanations("Checking for enabled Nonfree/Tainted");
+ for my $media (@{$urpm->{media}}) {
+ log::explanations("Checking $media->{name}");
+ if (!defined($media->{ignore})) {
+ log::explanations("Media $media->{name} is not ignored");
+ if ($media->{name} =~ m/^Nonfree/) {
+ $nonfree = 1;
+ log::explanations("Nonfree found to be enabled");
+ }
+ if ($media->{name} =~ m/^Tainted/) {
+ $tainted = 1;
+ log::explanations("Tainted found to be enabled");
+ }
+ }
+ }
+
undef $urpmi_lock;
touch(get_stale_upgrade_filename());
@@ -271,6 +291,20 @@ packages as well?)."))
exit(2);
};
+ if ($nonfree || $tainted) {
+ if ($nonfree) {
+ log::explanations("enabling nonfree as it was there before upgrade");
+ enable_media("Nonfree");
+ }
+
+ if ($tainted) {
+ log::explanations("enabling tainted as it was there before upgrade");
+ enable_media("Tainted");
+ }
+
+ # Media was added, update it and move along...
+ update_media();
+ }
log::explanations("upgrading urpmi and rpmdrake");
log::explanations("upgrading the whole system");
@@ -300,3 +334,8 @@ sub fork_gurpmi {
sub update_media() {
run_program::run('urpmi.update', if_($root, '--urpmi-root', $root), '-a', '--nocheck');
}
+
+sub enable_media {
+ my ($repos) = @_;
+ run_program::run('urpmi.update', if_($root, '--urpmi-root', $root), '--no-ignore', "$repos Release", "$repos Updates");
+}