diff --git a/packages/pve-container/patches/001-add-loongarch-support.patch b/packages/pve-container/patches/001-add-loongarch-support.patch index cfe5832..10c2b97 100644 --- a/packages/pve-container/patches/001-add-loongarch-support.patch +++ b/packages/pve-container/patches/001-add-loongarch-support.patch @@ -1,5 +1,17 @@ +From 6c3157c3324c5e47cb0a8c3df0aaa59b753a2f2f Mon Sep 17 00:00:00 2001 +From: jiangcuo +Date: Thu, 5 Dec 2024 11:31:29 +0800 +Subject: [PATCH] Add loongarch support + +--- + src/PVE/LXC/Config.pm | 2 +- + src/PVE/LXC/Setup.pm | 11 ---------- + src/PVE/LXC/Setup/Plugin.pm | 44 ++++++++++++++++++++++++++++++++++++- + src/PVE/LXC/Tools.pm | 1 + + 4 files changed, 45 insertions(+), 13 deletions(-) + diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm -index 1664a35..73f60f0 100644 +index 5cc37f7..0452d4a 100644 --- a/src/PVE/LXC/Config.pm +++ b/src/PVE/LXC/Config.pm @@ -473,7 +473,7 @@ my $confdesc = { @@ -12,10 +24,10 @@ index 1664a35..73f60f0 100644 default => 'amd64', }, diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm -index 5c9114c..cae55b1 100644 +index dc58990..78272be 100644 --- a/src/PVE/LXC/Setup.pm +++ b/src/PVE/LXC/Setup.pm -@@ -135,17 +135,6 @@ sub new { +@@ -141,17 +141,6 @@ sub new { if (!defined($conf->{arch})) { my $arch = eval { $self->protected_call(sub { $plugin->detect_architecture() }) }; @@ -34,14 +46,14 @@ index 5c9114c..cae55b1 100644 } diff --git a/src/PVE/LXC/Setup/Plugin.pm b/src/PVE/LXC/Setup/Plugin.pm -index b9d9c2d..533afe0 100644 +index b9d9c2d..f413d91 100644 --- a/src/PVE/LXC/Setup/Plugin.pm +++ b/src/PVE/LXC/Setup/Plugin.pm @@ -6,6 +6,7 @@ use strict; use warnings; use Carp; -+use PVE::Tools; ++use PVE::Tools qw(get_host_arch); sub new { my ($class, $conf, $rootdir, $os_release) = @_; @@ -84,8 +96,8 @@ index b9d9c2d..533afe0 100644 + + my $arch = eval { PVE::Tools::run_fork_with_timeout(5, $detect_arch) }; + if (my $err = $@) { -+ $arch = 'arm64'; -+ print "Architecture detection failed: $err\nFalling back to loongarch64.\n" . ++ $arch = get_host_arch(); ++ print "Architecture detection failed: $err\nFalling back to $arch.\n" . + "Use `pct set VMID --arch ARCH` to change.\n"; + } else { + print "Detected container architecture: $arch\n"; @@ -96,7 +108,7 @@ index b9d9c2d..533afe0 100644 # hooks diff --git a/src/PVE/LXC/Tools.pm b/src/PVE/LXC/Tools.pm -index 7e3e530..838327f 100644 +index 3380c62..a9aa942 100644 --- a/src/PVE/LXC/Tools.pm +++ b/src/PVE/LXC/Tools.pm @@ -179,6 +179,7 @@ sub detect_elf_architecture { diff --git a/packages/pve-container/patches/002-add-anolis.patch b/packages/pve-container/patches/002-add-anolis.patch new file mode 100644 index 0000000..c3a4e48 --- /dev/null +++ b/packages/pve-container/patches/002-add-anolis.patch @@ -0,0 +1,84 @@ +From a5fec2b01a76ae3ba33704f9f8037c332bd30966 Mon Sep 17 00:00:00 2001 +From: jiangcuo +Date: Thu, 5 Dec 2024 12:17:37 +0800 +Subject: [PATCH] add anolis + +--- + src/PVE/LXC/Setup.pm | 2 ++ + src/PVE/LXC/Setup/Anolis.pm | 34 ++++++++++++++++++++++++++++++++++ + src/PVE/LXC/Setup/Makefile | 1 + + 3 files changed, 37 insertions(+) + create mode 100644 src/PVE/LXC/Setup/Anolis.pm + +diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm +index 78272be..98398f8 100644 +--- a/src/PVE/LXC/Setup.pm ++++ b/src/PVE/LXC/Setup.pm +@@ -10,6 +10,7 @@ use PVE::Tools; + + use PVE::LXC::Setup::Alpine; + use PVE::LXC::Setup::ArchLinux; ++use PVE::LXC::Setup::Anolis; + use PVE::LXC::Setup::CentOS; + use PVE::LXC::Setup::Debian; + use PVE::LXC::Setup::Devuan; +@@ -24,6 +25,7 @@ use PVE::LXC::Setup::Unmanaged; + my $plugins = { + alpine => 'PVE::LXC::Setup::Alpine', + archlinux => 'PVE::LXC::Setup::ArchLinux', ++ anolis => 'PVE::LXC::Setup::Anolis', + centos => 'PVE::LXC::Setup::CentOS', + debian => 'PVE::LXC::Setup::Debian', + devuan => 'PVE::LXC::Setup::Devuan', +diff --git a/src/PVE/LXC/Setup/Anolis.pm b/src/PVE/LXC/Setup/Anolis.pm +new file mode 100644 +index 0000000..7c482b5 +--- /dev/null ++++ b/src/PVE/LXC/Setup/Anolis.pm +@@ -0,0 +1,34 @@ ++package PVE::LXC::Setup::Anolis; ++ ++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}; ++ ++ my $self = { conf => $conf, rootdir => $rootdir, version => $version }; ++ ++ $conf->{ostype} = "anolis"; ++ ++ return bless $self, $class; ++} ++ ++sub template_fixup { ++ my ($self, $conf) = @_; ++ ++ $self->remove_lxc_name_from_etc_hosts(); ++ $self->setup_systemd_disable_static_units(['dev-mqueue.mount']); ++} ++ ++sub setup_init { ++ my ($self, $conf) = @_; ++ $self->setup_container_getty_service($conf); ++ $self->setup_systemd_preset(); ++} ++ ++1; +diff --git a/src/PVE/LXC/Setup/Makefile b/src/PVE/LXC/Setup/Makefile +index 688b547..9ff3de9 100644 +--- a/src/PVE/LXC/Setup/Makefile ++++ b/src/PVE/LXC/Setup/Makefile +@@ -13,6 +13,7 @@ SOURCES=\ + NixOS.pm \ + OpenEuler.pm \ + Unmanaged.pm \ ++ Anolis.pm \ + + .PHONY: install + install: diff --git a/packages/pve-container/patches/003-set-unknown-ostype-to-unmanaged.patch b/packages/pve-container/patches/003-set-unknown-ostype-to-unmanaged.patch new file mode 100644 index 0000000..e08a5d2 --- /dev/null +++ b/packages/pve-container/patches/003-set-unknown-ostype-to-unmanaged.patch @@ -0,0 +1,22 @@ +From bba618e88b694a38f63de8b4bfaa403b7e3cad2f Mon Sep 17 00:00:00 2001 +From: jiangcuo +Date: Thu, 5 Dec 2024 12:21:23 +0800 +Subject: [PATCH] set unknown ostype to unmanaged + +--- + src/PVE/LXC/Setup.pm | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm +index 98398f8..a3a4588 100644 +--- a/src/PVE/LXC/Setup.pm ++++ b/src/PVE/LXC/Setup.pm +@@ -87,8 +87,6 @@ my $autodetect_type = sub { + return "nixos"; + } elsif (-f "$rootdir/etc/openEuler-release") { + return "openeuler"; +- } elsif (-f "$rootdir/etc/os-release") { +- die "unable to detect OS distribution\n"; + } else { + warn "/etc/os-release file not found and autodetection failed, falling back to 'unmanaged'\n"; + return "unmanaged"; diff --git a/packages/pve-container/patches/changelog/001-bump-version-to-5.2.2+port1.patch b/packages/pve-container/patches/changelog/001-bump-version-to-5.2.2+port1.patch new file mode 100644 index 0000000..d86f53c --- /dev/null +++ b/packages/pve-container/patches/changelog/001-bump-version-to-5.2.2+port1.patch @@ -0,0 +1,25 @@ +From 22b279f7305e3d80634cf697f61ae64f47f25622 Mon Sep 17 00:00:00 2001 +From: jiangcuo +Date: Thu, 5 Dec 2024 12:22:17 +0800 +Subject: [PATCH] bump version to 5.2.2+port1 + +--- + debian/changelog | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/debian/changelog b/debian/changelog +index 014958c..44785c2 100644 +--- a/debian/changelog ++++ b/debian/changelog +@@ -1,3 +1,11 @@ ++pve-container (5.2.2+port1) bookworm; urgency=medium ++ ++ * Add Anolis support ++ ++ * Set all unknown ostype to unmanaged ++ ++ -- Jiangcuo Thu, 05 Dec 2024 12:18:26 +0800 ++ + pve-container (5.2.2) bookworm; urgency=medium + + * network config: avoid committing invalid config on hotplug failure, rather diff --git a/packages/pve-container/series b/packages/pve-container/series index 2d52c4d..22a08b0 100644 --- a/packages/pve-container/series +++ b/packages/pve-container/series @@ -1 +1,4 @@ -patches/001-add-loongarch-support.patch \ No newline at end of file +patches/001-add-loongarch-support.patch +patches/002-add-anolis.patch +patches/003-set-unknown-ostype-to-unmanaged.patch +patches/changelog/001-bump-version-to-5.2.2+port1.patch