all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container 1/2] fix #5720: add setup support for openEuler
@ 2024-11-08 13:18 Fabian Grünbichler
  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:53 ` [pve-devel] applied-series: [PATCH container 1/2] fix #5720: add setup support for openEuler Thomas Lamprecht
  0 siblings, 2 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2024-11-08 13:18 UTC (permalink / raw)
  To: pve-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-08 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-08 13:18 [pve-devel] [PATCH container 1/2] fix #5720: add setup support for openEuler Fabian Grünbichler
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal