]> git.proxmox.com Git - pve-container.git/commitdiff
add Alpine Linux distribution
authorJens Vehlhaber <jens@eisfair.org>
Fri, 12 Feb 2016 08:27:30 +0000 (09:27 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 16 Feb 2016 11:13:53 +0000 (12:13 +0100)
Signed-off-by: Jens Vehlhaber <jens@eisfair.org>
src/PVE/LXC.pm
src/PVE/LXC/Setup.pm
src/PVE/LXC/Setup/Alpine.pm [new file with mode: 0644]

index a737fc0d3ab4195f4aa2d05053e9eddd0135de43..52cdb68828041760b5b3ad0218513410abea5498 100644 (file)
@@ -119,7 +119,7 @@ my $confdesc = {
     ostype => {
        optional => 1,
        type => 'string',
-       enum => ['debian', 'ubuntu', 'centos', 'fedora', 'opensuse', 'archlinux'],
+       enum => ['debian', 'ubuntu', 'centos', 'fedora', 'opensuse', 'archlinux', 'alpine'],
        description => "OS type. Corresponds to lxc setup scripts in /usr/share/lxc/config/<ostype>.common.conf.",
     },
     console => {
@@ -1082,7 +1082,7 @@ sub update_lxc_config {
     my $custom_idmap = grep { $_->[0] eq 'lxc.id_map' } @{$conf->{lxc}};
 
     my $ostype = $conf->{ostype} || die "missing 'ostype' - internal error";
-    if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | opensuse | archlinux)$/x) {
+    if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | opensuse | archlinux | alpine)$/x) {
        $raw .= "lxc.include = /usr/share/lxc/config/$ostype.common.conf\n";
        if ($unprivileged || $custom_idmap) {
            $raw .= "lxc.include = /usr/share/lxc/config/$ostype.userns.conf\n"
index 20f8530d43fdb5298f216c5835a71d0deeab39ef..b932be692b41871a751b8037c4064d114bfcf508 100644 (file)
@@ -11,6 +11,7 @@ use PVE::LXC::Setup::Redhat;
 use PVE::LXC::Setup::Fedora;
 use PVE::LXC::Setup::SUSE;
 use PVE::LXC::Setup::ArchLinux;
+use PVE::LXC::Setup::Alpine;
 
 my $plugins = {
     debian    => 'PVE::LXC::Setup::Debian',
@@ -19,6 +20,7 @@ my $plugins = {
     fedora    => 'PVE::LXC::Setup::Fedora',
     opensuse  => 'PVE::LXC::Setup::SUSE',
     archlinux => 'PVE::LXC::Setup::ArchLinux',
+    alpine    => 'PVE::LXC::Setup::Alpine',
 };
 
 my $autodetect_type = sub {
@@ -42,8 +44,9 @@ my $autodetect_type = sub {
        return "redhat";
     } elsif (-f  "$rootdir/etc/arch-release") {
        return "archlinux";
+    } elsif (-f  "$rootdir/etc/alpine-release") {
+       return "alpine";
     }
-
     die "unable to detect OS disribution\n";
 };
 
diff --git a/src/PVE/LXC/Setup/Alpine.pm b/src/PVE/LXC/Setup/Alpine.pm
new file mode 100644 (file)
index 0000000..b32c798
--- /dev/null
@@ -0,0 +1,48 @@
+package PVE::LXC::Setup::Alpine;
+
+use strict;
+use warnings;
+
+use Data::Dumper;
+use PVE::LXC;
+use PVE::Network;
+use File::Path;
+
+use PVE::LXC::Setup::Base;
+
+use base qw(PVE::LXC::Setup::Base);
+
+sub new {
+    my ($class, $conf, $rootdir) = @_;
+    my $self = { conf => $conf, rootdir => $rootdir, version => 0 };
+    $conf->{ostype} = "alpine";
+    return bless $self, $class;
+}
+
+sub template_fixup {
+    my ($self, $conf) = @_;
+    my $rootdir = $self->{rootdir};
+    # enable networking service
+    $self->ct_symlink('/etc/init.d/networking',
+                      '/etc/runlevels/boot/networking');
+    # fixup any symlinks
+    $self->ct_symlink('/etc/init.d/bootmisc',
+                      '/etc/runlevels/boot/bootmisc');
+    $self->ct_symlink('/etc/init.d/hostname',
+                      '/etc/runlevels/boot/hostname');                                            
+    # fix stop system                  
+    $self->ct_symlink('/etc/init.d/killprocs',
+                      '/etc/runlevels/shutdown/killprocs'); 
+    $self->ct_symlink('/etc/init.d/savecache',
+                      '/etc/runlevels/shutdown/savecache');                            
+}
+
+sub setup_init {
+    # Nothing to do
+}
+
+sub setup_network {
+    # Nothing to do
+}
+
+1;