]> git.proxmox.com Git - pve-container.git/commitdiff
added Setup::Fedora
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 24 Nov 2015 08:48:24 +0000 (09:48 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 26 Nov 2015 11:25:54 +0000 (12:25 +0100)
For now only Fedora 22 is tested. The setup routines from
the Redhat base can be kept, so the only difference for now
is the version scheme and 'ostype'.

debian/changelog
src/PVE/LXC.pm
src/PVE/LXC/Setup.pm
src/PVE/LXC/Setup/Fedora.pm [new file with mode: 0644]
src/PVE/LXC/Setup/Makefile

index e9bdaf1550295c5634213e8d6c86f743cb56fd22..758a2f7e14ff7029051b61857e89f39ef93922b0 100644 (file)
@@ -1,5 +1,7 @@
 pve-container (1.0-27) unstable; urgency=medium
 
+  * add support for Fedora 22
+  
   * add/restore firewall config with vzdump
 
   * warn when trying to delete non-existent options
index 594a5ce7d71aabd717f32647ea3f764cc70a4438..64563ebe938bc38b29792b11273911b7e2475934 100644 (file)
@@ -1072,7 +1072,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 | archlinux)$/x) {
+    if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | archlinux)$/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 9fb52ab4e58c1fabd908768a78c046a15f4d7da4..eaa4e2cf7b9bcc150dbab7a45333d2e0ba2a4e32 100644 (file)
@@ -8,12 +8,14 @@ use PVE::Tools;
 use PVE::LXC::Setup::Debian;
 use PVE::LXC::Setup::Ubuntu;
 use PVE::LXC::Setup::Redhat;
+use PVE::LXC::Setup::Fedora;
 use PVE::LXC::Setup::ArchLinux;
 
 my $plugins = {
     debian    => 'PVE::LXC::Setup::Debian',
     ubuntu    => 'PVE::LXC::Setup::Ubuntu',
     redhat    => 'PVE::LXC::Setup::Redhat',
+    fedora    => 'PVE::LXC::Setup::Fedora',
     archlinux => 'PVE::LXC::Setup::ArchLinux',
 };
 
@@ -30,6 +32,8 @@ my $autodetect_type = sub {
 
     if (-f "$rootdir/etc/debian_version") {
        return "debian";
+    } elsif (-f  "$rootdir/etc/fedora-release") {
+       return "fedora";
     } elsif (-f  "$rootdir/etc/redhat-release") {
        return "redhat";
     } elsif (-f  "$rootdir/etc/arch-release") {
diff --git a/src/PVE/LXC/Setup/Fedora.pm b/src/PVE/LXC/Setup/Fedora.pm
new file mode 100644 (file)
index 0000000..2507e26
--- /dev/null
@@ -0,0 +1,33 @@
+package PVE::LXC::Setup::Fedora;
+
+use strict;
+use warnings;
+
+use PVE::LXC::Setup::Redhat;
+
+use base qw(PVE::LXC::Setup::Redhat);
+
+sub new {
+    my ($class, $conf, $rootdir) = @_;
+
+    my $release = PVE::Tools::file_read_firstline("$rootdir/etc/fedora-release");
+    die "unable to read version info\n" if !defined($release);
+
+    my $version;
+
+    if ($release =~ m/release\s+(\d+(?:\.\d+)?)(\.\d+)?/) {
+       if ($1 >= 22 && $1 < 23) {
+           $version = $1;
+       }
+    }
+
+    die "unsupported fedora release '$release'\n" if !$version;
+
+    my $self = { conf => $conf, rootdir => $rootdir, version => $version };
+
+    $conf->{ostype} = "fedora";
+
+    return bless $self, $class;
+}
+
+1;
index 802fde3bb90d3a2227e72544c84853ba2e134264..1b5f6a2351c5724dbf7d2ca8b8bf1406734a2c61 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=Base.pm Debian.pm Ubuntu.pm Redhat.pm ArchLinux.pm
+SOURCES=Base.pm Debian.pm Ubuntu.pm Redhat.pm Fedora.pm ArchLinux.pm
 
 .PHONY: install
 install: