public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container 1/2] fix #5720: add setup support for openEuler
Date: Fri,  8 Nov 2024 14:18:29 +0100	[thread overview]
Message-ID: <20241108131830.467949-1-f.gruenbichler@proxmox.com> (raw)

openEuler is centOS-derived Linux distribution. the LXC project builds a
template for it that mostly works out of the box.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    did some basic smoke testing using
    openeuler-24.09-default_20241028_amd64.tar.xz from images.linuxcontainers.org

 src/PVE/LXC/Setup.pm           |  5 +++++
 src/PVE/LXC/Setup/Makefile     |  1 +
 src/PVE/LXC/Setup/OpenEuler.pm | 35 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 src/PVE/LXC/Setup/OpenEuler.pm

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 3a937a9..dc58990 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -18,6 +18,7 @@ use PVE::LXC::Setup::Gentoo;
 use PVE::LXC::Setup::SUSE;
 use PVE::LXC::Setup::Ubuntu;
 use PVE::LXC::Setup::NixOS;
+use PVE::LXC::Setup::OpenEuler;
 use PVE::LXC::Setup::Unmanaged;
 
 my $plugins = {
@@ -28,6 +29,7 @@ my $plugins = {
     devuan    => 'PVE::LXC::Setup::Devuan',
     fedora    => 'PVE::LXC::Setup::Fedora',
     gentoo    => 'PVE::LXC::Setup::Gentoo',
+    openeuler => 'PVE::LXC::Setup::OpenEuler',
     opensuse  => 'PVE::LXC::Setup::SUSE',
     ubuntu    => 'PVE::LXC::Setup::Ubuntu',
     nixos     => 'PVE::LXC::Setup::NixOS',
@@ -39,6 +41,7 @@ my $plugin_alias = {
     'opensuse-leap' => 'opensuse',
     'opensuse-tumbleweed' => 'opensuse',
     'opensuse-slowroll' => 'opensuse',
+    'openEuler' => 'openeuler',
     arch => 'archlinux',
     sles => 'opensuse',
 };
@@ -80,6 +83,8 @@ my $autodetect_type = sub {
 	return "gentoo";
     } elsif (-d  "$rootdir/nix/store") {
 	return "nixos";
+    } elsif (-f "$rootdir/etc/openEuler-release") {
+	return "openeuler";
     } elsif (-f "$rootdir/etc/os-release") {
 	die "unable to detect OS distribution\n";
     } else {
diff --git a/src/PVE/LXC/Setup/Makefile b/src/PVE/LXC/Setup/Makefile
index df1cf97..688b547 100644
--- a/src/PVE/LXC/Setup/Makefile
+++ b/src/PVE/LXC/Setup/Makefile
@@ -11,6 +11,7 @@ SOURCES=\
     SUSE.pm		\
     Ubuntu.pm		\
     NixOS.pm		\
+    OpenEuler.pm	\
     Unmanaged.pm	\
 
 .PHONY: install
diff --git a/src/PVE/LXC/Setup/OpenEuler.pm b/src/PVE/LXC/Setup/OpenEuler.pm
new file mode 100644
index 0000000..b34b957
--- /dev/null
+++ b/src/PVE/LXC/Setup/OpenEuler.pm
@@ -0,0 +1,35 @@
+package PVE::LXC::Setup::OpenEuler;
+
+use strict;
+use warnings;
+
+use PVE::LXC::Setup::CentOS;
+use base qw(PVE::LXC::Setup::CentOS);
+
+sub new {
+    my ($class, $conf, $rootdir, $os_release) = @_;
+
+    my $version = $os_release->{VERSION_ID};
+    # we cannot really win anything by actively dying on newer versions so only check lower boundary.
+    die "unsupported openEuler release '$version'\n" if !defined($version) || $version < 24;
+
+    my $self = { conf => $conf, rootdir => $rootdir, version => $version };
+
+    $conf->{ostype} = "openeuler";
+
+    return bless $self, $class;
+}
+
+sub template_fixup {
+    my ($self, $conf) = @_;
+
+    $self->remove_lxc_name_from_etc_hosts();
+}
+
+sub setup_init {
+    my ($self, $conf) = @_;
+    $self->setup_container_getty_service($conf);
+    $self->setup_systemd_preset();
+}
+
+1;
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

             reply	other threads:[~2024-11-08 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 13:18 Fabian Grünbichler [this message]
2024-11-08 13:18 ` [pve-devel] [PATCH container 2/2] setup: add helper to disable static units when fixing up templates Fabian Grünbichler
2024-11-08 13:40   ` Thomas Lamprecht
2024-11-08 13:47     ` Fabian Grünbichler
2024-11-08 13:53 ` [pve-devel] applied-series: [PATCH container 1/2] fix #5720: add setup support for openEuler Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241108131830.467949-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal