Hello to all,
I have written a Perl code which facilitate to create a slackware container using template from https://images.linuxcontainers.org/ and PVE UI. So now I would like to share it in case it can be added to the source code for future updates. I am actually using it since version 8.1 of PVE but updates ruin it couple of times.. so now it works on 8.2.4
Attached archive contains Perl package file which should be in PVE/LXC/Setup/ directory. The code in it use the collected information from the PVE UI (IP, hostname, net mask, gateway..) to create new container. Currently you can use only Slackware 15 templates and newer.
The code prints few debug lines which can be easily removed!
Regards,
Bob
I have written a Perl code which facilitate to create a slackware container using template from https://images.linuxcontainers.org/ and PVE UI. So now I would like to share it in case it can be added to the source code for future updates. I am actually using it since version 8.1 of PVE but updates ruin it couple of times.. so now it works on 8.2.4
Perl:
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 1664a35..b2d4d14 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -480,7 +480,7 @@ my $confdesc = {
ostype => {
optional => 1,
type => 'string',
- enum => [qw(debian devuan ubuntu centos fedora opensuse archlinux alpine gentoo nixos unmanaged)],
+ enum => [qw(debian devuan ubuntu centos fedora opensuse archlinux alpine gentoo nixos slackware unmanaged)],
description => "OS type. This is used to setup configuration inside the container, and corresponds to lxc setup scripts in /usr/share/lxc/config/<ostype>.common.conf. Value 'unmanaged' can be used to skip and OS specific setup.",
},
console => {
diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 5c9114c..21f1157 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::Slackware;
use PVE::LXC::Setup::Unmanaged;
my $plugins = {
@@ -31,6 +32,7 @@ my $plugins = {
opensuse => 'PVE::LXC::Setup::SUSE',
ubuntu => 'PVE::LXC::Setup::Ubuntu',
nixos => 'PVE::LXC::Setup::NixOS',
+ slackware => 'PVE::LXC::Setup::Slackware',
unmanaged => 'PVE::LXC::Setup::Unmanaged',
};
@@ -79,6 +81,8 @@ my $autodetect_type = sub {
return "gentoo";
} elsif (-d "$rootdir/nix/store") {
return "nixos";
+ } elsif (-f "$rootdir/etc/slackware-version") {
+ return "slackware";
} elsif (-f "$rootdir/etc/os-release") {
die "unable to detect OS distribution\n";
} else {
Attached archive contains Perl package file which should be in PVE/LXC/Setup/ directory. The code in it use the collected information from the PVE UI (IP, hostname, net mask, gateway..) to create new container. Currently you can use only Slackware 15 templates and newer.
The code prints few debug lines which can be easily removed!
Regards,
Bob