summaryrefslogtreecommitdiffstats
path: root/mgaapplet-upgrade-helper
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-05-13 13:13:40 +0000
committerColin Guthrie <colin@mageia.org>2013-05-13 13:13:40 +0000
commita312623315e4d214bfcfc7743d233775bec2afe5 (patch)
treeee00916f25baed20638b1e8a441bb46d07bcc258 /mgaapplet-upgrade-helper
parent456618f13582c9c53e17dbf60764cc7b613a7682 (diff)
downloadmgaonline-a312623315e4d214bfcfc7743d233775bec2afe5.tar
mgaonline-a312623315e4d214bfcfc7743d233775bec2afe5.tar.gz
mgaonline-a312623315e4d214bfcfc7743d233775bec2afe5.tar.bz2
mgaonline-a312623315e4d214bfcfc7743d233775bec2afe5.tar.xz
mgaonline-a312623315e4d214bfcfc7743d233775bec2afe5.zip
Ensure nonfree/tainted media is kept enabled on distro upgrade.
Patch from Maarten Vanraes and Dave Hodgins and tweaked by me for trunk. mga#6061
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");
+}