1 |
diff -Nur --no-dereference smeserver-yum-2.6.0.old/root/etc/e-smith/db/configuration/migrate/Yum-remove-previous-eolversion smeserver-yum-2.6.0/root/etc/e-smith/db/configuration/migrate/Yum-remove-previous-eolversion |
2 |
--- smeserver-yum-2.6.0.old/root/etc/e-smith/db/configuration/migrate/Yum-remove-previous-eolversion 1969-12-31 19:00:00.000000000 -0500 |
3 |
+++ smeserver-yum-2.6.0/root/etc/e-smith/db/configuration/migrate/Yum-remove-previous-eolversion 2021-03-21 13:12:19.847000000 -0400 |
4 |
@@ -0,0 +1,9 @@ |
5 |
+{ |
6 |
+ use POSIX qw(strftime); |
7 |
+ my $curdate = strftime '%Y%m%d', localtime; |
8 |
+ my $curVers = 7; |
9 |
+ my $curVersEOL = 20240630; |
10 |
+ # we remove the forced value if for a previous release; |
11 |
+ # also if not after the eol date |
12 |
+ my $dropit = $DB->get_prop_and_delete('yum','eolversion') if ( (substr($yum{eolversion},0,1)<$curVers) || ( "$curdate" < "$curVersEOL") ); |
13 |
+} |
14 |
diff -Nur --no-dereference smeserver-yum-2.6.0.old/root/etc/e-smith/db/yum_repositories/migrate/45CentOSEOL smeserver-yum-2.6.0/root/etc/e-smith/db/yum_repositories/migrate/45CentOSEOL |
15 |
--- smeserver-yum-2.6.0.old/root/etc/e-smith/db/yum_repositories/migrate/45CentOSEOL 2021-03-21 02:05:05.155000000 -0400 |
16 |
+++ smeserver-yum-2.6.0/root/etc/e-smith/db/yum_repositories/migrate/45CentOSEOL 2021-03-21 13:12:20.078000000 -0400 |
17 |
@@ -1,15 +1,45 @@ |
18 |
{ |
19 |
use POSIX qw(strftime); |
20 |
use File::Slurp; |
21 |
+ my $curdate = strftime '%Y%m%d', localtime; |
22 |
+ my $curVers = 7; |
23 |
+ my $curVersEOL = 20240630; |
24 |
#get CentOS release we are |
25 |
my $SUBVER = read_file('/etc/centos-release'); |
26 |
$SUBVER =~ s/^CentOS Linux release ([0-9\.]+).*?$/$1/; |
27 |
chomp $SUBVER; |
28 |
+ # we ignore the force value if for a previous release; idealy should be deleted from another fragment against configuration db |
29 |
+ delete $yum{eolversion} if ( ( defined $yum{eolversion} && (substr($yum{eolversion},0,1)<$curVers) ) || ( "$curdate" < "$curVersEOL") ); |
30 |
$SUBVER = $yum{eolversion} || $SUBVER ; |
31 |
+ |
32 |
+ # we need to remove that from migrated server |
33 |
+ for my $name ( qw(base updates centosplus extras fasttrack centos-sclo-rh centos-sclo-centos) ) |
34 |
+ { |
35 |
+ my $repo = $DB->get($name) or next; |
36 |
+ my $baseurl = $repo->prop('BaseURL') or next; |
37 |
+ my $mirrorlist = $repo->prop('MirrorList') or next; |
38 |
+ if ( $baseurl =~ /^http:\/\/vault\.centos\.org\/([0-9])/ ) |
39 |
+ { |
40 |
+ # we want to reset this unless vers 7 |
41 |
+ next if ($1 == $curVers && "$curdate" >= "$curVersEOL"); |
42 |
+ $repo->delete_prop('MirrorList'); |
43 |
+ $repo->delete_prop('BaseURL'); |
44 |
+ unlink "/var/cache/yum/$name/$_" foreach qw(repomd.xml mirrorlist.txt); |
45 |
+ } |
46 |
+ else |
47 |
+ { |
48 |
+ # no match for a numerical, we probably want to reset that as well |
49 |
+ $repo->delete_prop('MirrorList'); |
50 |
+ $repo->delete_prop('BaseURL'); |
51 |
+ unlink "/var/cache/yum/$name/$_" foreach qw(repomd.xml mirrorlist.txt); |
52 |
+ } |
53 |
+ } |
54 |
+ |
55 |
+ # return unless we have a release version |
56 |
return unless $SUBVER ne ""; |
57 |
my $curdate = strftime '%Y%m%d', localtime; |
58 |
# return unless EOL is reached |
59 |
- return unless ( "$curdate" >= "20240630"); |
60 |
+ return unless ( "$curdate" >= "$curVersEOL"); |
61 |
for my $name ( qw(base updates centosplus extras fasttrack centos-sclo-rh centos-sclo-centos) ) |
62 |
{ |
63 |
my $repo = $DB->get($name) or next; |