This commit is contained in:
2024-03-25 17:44:36 -04:00
parent 91b6e8e13f
commit fc884e4629
187 changed files with 5039 additions and 130 deletions

View File

@@ -0,0 +1,30 @@
{
use esmith::ConfigDB;
my $ydb = esmith::ConfigDB->open_ro('yum_repositories')
or die "Couldn't open yum_repositories";
my $smecontribs=$ydb->get_prop('smecontribs','status') || 'disabled';
return "\n# dnf check for smecontribs updates is disabled\n" unless ( ($dnf{status} eq 'enabled') && ($dnf{CheckContribs} eq 'enabled') && ($smecontribs eq 'disabled') );
my $freq = $dnf{check4updates} || 'daily';
my $min;
my $dom;
my $dow;
if ($freq eq 'weekly') {
$min = 22;
$dom = '*';
$dow = 0;
} elsif ($freq eq 'monthly') {
$min = 42;
$dom = 1;
$dow = '*';
} else {
$min = 2;
$dom = '*';
$dow = '*';
}
return "$min 4 $dom * $dow root "
. q{sleep $[ $RANDOM \\% 3600 ]; /sbin/e-smith/check4contribsupdates -m };
}

View File

@@ -0,0 +1,25 @@
{
return "\n# dnf check for updates is disabled\n" unless $dnf{status} eq 'enabled';
my $freq = $dnf{check4updates} || 'daily';
my $min;
my $dom;
my $dow;
if ($freq eq 'weekly') {
$min = 22;
$dom = '*';
$dow = 0;
} elsif ($freq eq 'monthly') {
$min = 42;
$dom = 1;
$dow = '*';
} else {
$min = 2;
$dom = '*';
$dow = '*';
}
return "$min 4 $dom * $dow root "
. q{sleep $[ $RANDOM \\% 3600 ]; /sbin/e-smith/check4updates -m };
}

View File

@@ -0,0 +1,39 @@
{
our $AutoInstallUpdates = $dnf{AutoInstallUpdates} || 'disabled';
$AutoInstallUpdates = ( $AutoInstallUpdates eq "disabled") ? "no" : "yes";
our $downloadonly = $dnf{DownloadOnly} || 'disabled';
$downloadonly = ($downloadonly eq "disabled") ? "no" : "yes";
our $check = $dnf{check4updates} || 'daily';
$check = ($check eq "disabled") ? "no" : "yes";
$check = ($downloadonly eq "yes" || $AutoInstallUpdates eq "yes" ) ? "yes" : $check;
$OUT = "";
}
[commands]
# What kind of upgrade to perform:
# default = all available upgrades
# security = only the security upgrades
upgrade_type = default
# Maximum time in seconds to wait until the system is on-line and able to
# connect to remote repositories.
network_online_timeout = 60
# Whether updates should be downloaded when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
download_updates = { $downloadonly }
# Whether updates should be applied when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
apply_updates = { $AutoInstallUpdates }
# Maximum amout of time to randomly sleep, in minutes. The program
# will sleep for a random amount of time between 0 and random_sleep
# minutes before running. This is useful for e.g. staggering the
# times that multiple systems will access update servers. If
# random_sleep is 0 or negative, the program will run immediately.
# 6*60 = 360
random_sleep = { $dnf{sleep} || '0' }

View File

@@ -0,0 +1,13 @@
[emitters]
# Name to use for this system in messages that are emitted. If
# system_name is None, the hostname will be used.
system_name = { $SystemName . "." . $DomainName || 'None' }
# How to send messages. Valid options are stdio and email. If
# emit_via includes stdio, messages will be sent to stdout; this is useful
# to have cron send the messages. If emit_via includes email, this
# program will send email itself according to the configured options.
# If emit_via is None or left blank, no messages will be sent.
emit_via = stdio

View File

@@ -0,0 +1,12 @@
[email]
# The address to send email messages from.
# NOTE: 'localhost' will be replaced with the value of system_name.
email_from = { 'root@' . $DomainName }
# List of addresses to send messages to.
email_to = { $dnf{ReportEmail} || 'admin@' . $DomainName }
# Name of the host to connect to to send email messages.
email_host = localhost

View File

@@ -0,0 +1,12 @@
[base]
# This section overrides dnf.conf
# Use this to filter dnf core messages
# -4: critical
# -3: critical+errors
# -2: critical+errors+warnings (default)
debuglevel = -{ $dnf{Debug} || '2' }
# Uncomment to auto-import new gpg keys (dangerous)
# assumeyes = True

View File

@@ -0,0 +1 @@
[main]

View File

@@ -0,0 +1 @@
best=0

View File

@@ -0,0 +1,2 @@
cachedir=/var/cache/dnf/$basearch/$releasever
keepcache=0

View File

@@ -0,0 +1 @@
debuglevel={ $yum{Debug} || '2' }

View File

@@ -0,0 +1,6 @@
{
my $deltaRpm = $dnf{DeltaRpmProcess} || 'disabled';
$deltaRpm = '0' if ($deltaRpm eq 'disabled');
$deltaRpm = '2' if ($deltaRpm eq 'enabled');
$OUT .= "deltarpm=$deltaRpm";
}

View File

@@ -0,0 +1 @@
installonly_limit=3

View File

@@ -0,0 +1 @@
logdir=/var/log/dnf

View File

@@ -0,0 +1 @@
obsoletes=1

View File

@@ -0,0 +1 @@
plugins=1

View File

@@ -0,0 +1,2 @@
skip_if_unavailable=0

View File

@@ -0,0 +1 @@
reposdir=/etc/yum.smerepos.d

View File

@@ -0,0 +1,4 @@
{
$pkgs = $dnf{Protected} || 'smeserver-base,smeserver-support';
$OUT = join "\n", split /[,;]/, $pkgs;
}

View File

@@ -0,0 +1,4 @@
#dnf Koozali SME Server updater
if $programname startswith "dnf_update_dbs" then /var/log/dnf/dnf-update.log
& stop

View File

@@ -0,0 +1,78 @@
{
my $ydb = esmith::ConfigDB->open_ro('yum_repositories')
or die "Couldn't open yum_repositories";
my $priority = $dnf{priority} || 'enabled';
$OUT = "\n";
for my $repos ( $ydb->get_all_by_prop('type' => 'repository') )
{
my %props = ($DB->get('dnf')->props(), $repos->props());
$OUT .= "[" . $repos->key . "]\n";
$OUT .= "enabled=" . (($repos->prop('status') eq 'enabled') ? 1 : 0)
. "\n";
if ( exists $props{MetaLink} )
{
$OUT .= 'metalink=' . $props{MetaLink} . "\n";
}
elsif ( ! exists $props{MirrorList} or $props{MirrorList} eq "disabled" )
{
$OUT .= 'baseurl=' . $props{BaseURL} . "\n";
}
else
{
$OUT .= 'mirrorlist=' . $props{MirrorList} . "\n";
}
for my $prop (qw(Name))
{
$OUT .= lc($prop) . '=' . $props{$prop} . "\n";
}
for my $prop (qw(GPGCheck EnableGroups))
{
$OUT .= lc($prop) . '=' . ($props{$prop} eq "yes" ? 1 : 0) . "\n";
}
if (exists $props{Exclude})
{
$OUT .= "exclude=" . join(' ', split(/,/, $props{Exclude})) . "\n";
}
if (exists $props{IncludePkgs})
{
$OUT .= "includepkgs=" . join(' ', split(/,/, $props{IncludePkgs})) . "\n";
}
if ( exists $props{GPGKey})
{
$OUT .= "gpgkey" . '=' . $props{GPGKey} . "\n";
}
if ($priority eq 'enabled' && exists $props{Priority})
{
$OUT .= "priority" . '=' . $props{Priority} . "\n";
}
elsif ($priority eq 'enabled' && $repos->key =~ /^sme.*/)
{
$OUT .= "priority=10\n";
}
elsif ($priority eq 'enabled' && ( $repos->key eq 'appstream' || $repos->key eq 'baseos' || $repos->key eq 'remi-safe' || $repos->key eq 'remi-modular' ))
{
$OUT .= "priority=10\n";
}
if (exists $props{DeltaRpmPercentage})
{
my $deltarpmpercentage = $props{DeltaRpmPercentage};
$deltarpmpercentage = '0' if ($deltarpmpercentage eq 'disabled');
$OUT .= "deltarpm_percentage" . '=' . $deltarpmpercentage . "\n";
}
$OUT .= "\n";
}
}