[pve-devel] [PATCH container v2 4/4] setup/fedora: use os_release and support 26

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 22 15:43:25 CEST 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC/Setup/Fedora.pm | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/PVE/LXC/Setup/Fedora.pm b/src/PVE/LXC/Setup/Fedora.pm
index 70aab62..23851d5 100644
--- a/src/PVE/LXC/Setup/Fedora.pm
+++ b/src/PVE/LXC/Setup/Fedora.pm
@@ -8,20 +8,10 @@ use PVE::LXC::Setup::CentOS;
 use base qw(PVE::LXC::Setup::CentOS);
 
 sub new {
-    my ($class, $conf, $rootdir) = @_;
+    my ($class, $conf, $rootdir, $os_release) = @_;
 
-    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 < 26) {
-	    $version = $1;
-	}
-    }
-
-    die "unsupported fedora release '$release'\n" if !$version;
+    my $version = $os_release->{VERSION_ID};
+    die "unsupported fedora release\n" if !($version >= 22 && $version <= 26);
 
     my $self = { conf => $conf, rootdir => $rootdir, version => $version };
 
-- 
2.11.0





More information about the pve-devel mailing list