]> git.proxmox.com Git - pve-container.git/blob - src/PVE/LXC/Setup/Fedora.pm
68d63b1c3adc425d4dbcd82aa697f41cb917a340
[pve-container.git] / src / PVE / LXC / Setup / Fedora.pm
1 package PVE::LXC::Setup::Fedora;
2
3 use strict;
4 use warnings;
5
6 use PVE::LXC::Setup::CentOS;
7
8 use base qw(PVE::LXC::Setup::CentOS);
9
10 sub new {
11 my ($class, $conf, $rootdir, $os_release) = @_;
12
13 my $version = $os_release->{VERSION_ID};
14 die "unsupported Fedora release '$version'\n" if !($version >= 22 && $version <= 33);
15
16 my $self = { conf => $conf, rootdir => $rootdir, version => $version };
17
18 $conf->{ostype} = "fedora";
19
20 return bless $self, $class;
21 }
22
23 sub template_fixup {
24 my ($self, $conf) = @_;
25 $self->setup_securetty($conf);
26 $self->ct_unlink('/etc/systemd/system/getty@.service');
27 }
28
29 sub setup_init {
30 my ($self, $conf) = @_;
31 $self->setup_container_getty_service($conf);
32 }
33
34 sub setup_network {
35 my ($self, $conf) = @_;
36
37 # systemd-networkd is default in fedora-templates from upstream since
38 # 25, however quite a few workarounds were posted in the forum, recommending
39 # to start the (legacy) network.service via /etc/rc.local for fedora > 25.
40 # /etc/sysconfig/network is not present in the templates for fedora > 25.
41 # use its presence to decide, whether to configure the legacy config
42 # additionally for 25, 26, 27.
43
44 my $sysconfig_used = $self->ct_file_exists("/etc/sysconfig/network");
45
46 my $version = $self->{version};
47
48 my $setup_sysconfig = ($version <= 24 || ($self->{version} <= 27 && $sysconfig_used));
49 my $setup_systemd = ($self->{version} >= 25);
50
51 $self->SUPER::setup_network($conf) if $setup_sysconfig;
52 $self->SUPER::setup_systemd_networkd($conf) if $setup_systemd;
53 }
54 1;