initial commit of file from CVS for smeserver-yum on Thu 26 Oct 11:26:23 BST 2023

This commit is contained in:
2023-10-26 11:26:23 +01:00
parent b6e325dc61
commit 2302f71017
189 changed files with 4126 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
{
$DB = esmith::ConfigDB->open(${DB_FILENAME});
}

View File

@@ -0,0 +1,16 @@
{
for my $repo ($DB->get_all_by_prop(type => 'repository'))
{
%props = $repo->props;
if (defined $props{GPGCheck}) {
$props{GPGCheck} = 'yes' if ($props{GPGCheck} =~ /1/);
$props{GPGCheck} = 'no' if ($props{GPGCheck} =~ /0/);
}
if (defined $props{EnableGroups}) {
$props{EnableGroups} = 'yes' if ($props{EnableGroups} =~ /1/);
$props{EnableGroups} = 'no' if ($props{EnableGroups} =~ /0/);
}
$repo->merge_props(%props);
}
}

View File

@@ -0,0 +1,8 @@
{
for my $name ( qw(base updates) )
{
my $repo = $DB->get($name) or next;
$repo->set_prop('Visible', 'yes');
}
}

View File

@@ -0,0 +1,4 @@
{
my $repo = $DB->get('addons');
$repo->delete if $repo;
}

View File

@@ -0,0 +1,4 @@
{
my $repo = $DB->get('contrib');
$repo->delete if $repo;
}

View File

@@ -0,0 +1,4 @@
{
my $repo = $DB->get('dungog');
$repo->delete if $repo;
}

View File

@@ -0,0 +1,9 @@
{
for my $name ( qw(smecontribs) )
{
my $repo = $DB->get($name) or next;
#only migrate if restore from previous SME version, we do not want to override an admin setting for current version.
return unless $repo->prop('MirrorList') =~ m{/$name-[789]$};
$repo->set_prop('Visible', 'yes');
}
}

View File

@@ -0,0 +1,30 @@
{
for my $name ( qw(smeaddons smecontribs smedev smeextras smeos smetest
smeupdates smeupdates-testing) )
{
my $repo = $DB->get($name) or next;
my $mirrorlist = $repo->prop('MirrorList') || '';
my $baseurl = $repo->prop('BaseURL') || '';
if ($mirrorlist =~ m{^file:///etc/yum.repos.d/mirrors-sme|/7/|/sme.*-7$} || $baseurl =~ m{/7/|/sme.*-7$})
{
$repo->delete_prop('MirrorList');
$repo->delete_prop('BaseURL');
unlink "/var/cache/yum/$name/$_" foreach qw(repomd.xml mirrorlist.txt);
if ($repo->prop('status') eq 'enabled')
{
unlink "/home/e-smith/db/yum_$_" foreach qw(available updates installed);
}
}
$repo->set_prop('MirrorList', "https://mirrorlist.koozali.org/mirrorlist/$name-10")
if $repo->prop('MirrorList') =~ m{^http://distro.ibiblio.org/pub/linux/distributions/smeserver};
$repo->set_prop('MirrorList', "http://mirrorlist.koozali.org/mirrorlist/$name-10")
if $repo->prop('MirrorList') =~ m{/$name-[789]$};
$repo->set_prop('MirrorList', "https://mirrorlist.koozali.org/mirrorlist/$name-10")
if $repo->prop('MirrorList') =~ m{^http://mirrorlist.contribs.org/mirrorlist/$name-10$};
}
}

View File

@@ -0,0 +1,55 @@
{
use POSIX qw(strftime);
use File::Slurp;
my $curdate = strftime '%Y%m%d', localtime;
my $curVers = 7;
my $curVersEOL = 20240630;
#get CentOS release we are
my $SUBVER = read_file('/etc/centos-release');
$SUBVER =~ s/^CentOS Linux release ([0-9\.]+).*?$/$1/;
chomp $SUBVER;
# we ignore the force value if for a previous release; idealy should be deleted from another fragment against configuration db
delete $yum{eolversion} if ( ( defined $yum{eolversion} && (substr($yum{eolversion},0,1)<$curVers) ) || ( "$curdate" < "$curVersEOL") );
$SUBVER = $yum{eolversion} || $SUBVER ;
# we need to remove that from migrated server
for my $name ( qw(base updates centosplus extras fasttrack centos-sclo-rh centos-sclo-centos) )
{
my $repo = $DB->get($name) or next;
my $baseurl = $repo->prop('BaseURL') or next;
my $mirrorlist = $repo->prop('MirrorList') or next;
if ( $baseurl =~ /^http:\/\/vault\.centos\.org\/([0-9])/ )
{
# we want to reset this unless vers 7
next if ($1 == $curVers && "$curdate" >= "$curVersEOL");
$repo->delete_prop('MirrorList');
$repo->delete_prop('BaseURL');
unlink "/var/cache/yum/$name/$_" foreach qw(repomd.xml mirrorlist.txt);
}
else
{
# no match for a numerical, we probably want to reset that as well
$repo->delete_prop('MirrorList');
$repo->delete_prop('BaseURL');
unlink "/var/cache/yum/$name/$_" foreach qw(repomd.xml mirrorlist.txt);
}
}
# return unless we have a release version
return unless $SUBVER ne "";
my $curdate = strftime '%Y%m%d', localtime;
# return unless EOL is reached
return unless ( "$curdate" >= "$curVersEOL");
for my $name ( qw(base updates centosplus extras fasttrack centos-sclo-rh centos-sclo-centos) )
{
my $repo = $DB->get($name) or next;
my $rname = ( $name eq 'base' )? 'os' :$name;
my $sclo = "";
$sclo = "rh/" if $name eq "centos-sclo-rh";
$sclo = "sclo/" if $name eq "centos-sclo-centos";
# setprop BaseURL "http://vault.centos.org/$SUBVER/$rname/\$basearch/"
$repo->set_prop('BaseURL', "http://vault.centos.org/$SUBVER/$rname/\$basearch/$sclo");
# delprop MirrorList
$repo->set_prop('MirrorList', "disabled");
}
}