logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Linux::Distribution - Perl extension to detect on which Linux distribution we are running.

Authors

       Alexandr Ciornii <alexchorny@gmail.com>, <http://chorny.net> Alberto Re, <alberto@accidia.net> Judith
       Lebzelter, <judith@osdl.org>

Description

       This is a simple module that tries to guess on what linux distribution we are running by looking for
       release's files in /etc.  It now looks for 'lsb-release' first as that should be the most correct and
       adds ubuntu support.  Secondly, it will look for the distro specific files.

       It currently recognizes slackware, debian, suse, fedora, redhat, turbolinux, yellowdog, knoppix,
       mandrake, conectiva, immunix, tinysofa, va-linux, trustix, adamantix, yoper, arch-linux, libranet,
       gentoo, ubuntu, scientific, oracle enterprise linux, amazon linux and redflag.

       It has function to get the version for debian, suse, fedora, redhat, gentoo, slackware, scientific,
       oracle enterprise linux, amazon linux, redflag and ubuntu(lsb). People running unsupported distro's are
       greatly encouraged to submit patches :-)

   EXPORT
       None by default.

Name

       Linux::Distribution - Perl extension to detect on which Linux distribution we are running.

Synopsis

         use Linux::Distribution qw(distribution_name distribution_version);

         if(my $distro = distribution_name) {
               my $version = distribution_version();
               print "you are running $distro, version $version\n";
         } else {
               print "distribution unknown\n";
         }

         Or else do it OO:

         use Linux::Distribution qw(distribution_name distribution_version);

         my $linux = Linux::Distribution->new;
         if(my $distro = $linux->distribution_name()) {
               my $version = $linux->distribution_version();
               print "you are running $distro, version $version\n";
         } else {
               print "distribution unknown\n";
         }

Todo

       Add the capability of recognize the version of the distribution for all recognized distributions.

See Also