Home · About · Download · Documentation · Getting Help · Google+

Ticket #39 (new enhancement)

Opened 21 months ago

Last modified 15 months ago

Change how Warewulf::SystemFactory determines OS

Reported by: ikaufman Owned by: gmk
Priority: minor Milestone:
Component: general Version:
Keywords: Cc:

Description

Currently, Warewulf::SystemFactory looks for /etc/redhat-release to determine that the system is RHEL based. For Debian based distros, you could look for /etc/debian_version, but that would encompass both Ubuntu and Debian, which may have slight differences. It might be better to use "lsb_release -i" which should differentiate all three: i.e.:

on an Ubuntu box:
# lsb_release -i
Distributor ID: Ubuntu

and on a RHEL box:
~$ lsb_release -i
Distributor ID: RedHatEnterpriseServer

and on a CentOS box:
# lsb_release -i
Distributor ID: CentOS

Change History

comment:1 Changed 21 months ago by ikaufman

Maybe use a qiven/when block like so (of course, this requires perl 5.10+):

my $OS_test = lsb_release -i;

given ($type) {

when ($OS_test =~ m/RedHatEnterpriseServer/) {$type = "rhel"}
when ($OS_test =~ m/Ubuntu/) {$type = "ubuntu"}

}

comment:2 Changed 15 months ago by gmk

Does Ubuntu also have something like an /etc/ubuntu_release or equiv?

Thanks :)

Note: See TracTickets for help on using tickets.