Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($showDistro) {
- @distros = (
- "Gentoo", "/etc/gentoo-release",
- "Fedora Core", "/etc/fedora-release",
- "SuSE", "/etc/SuSE-release",
- "Slackware", "/etc/slackware-version",
- "Cobalt", "/etc/cobalt-release",
- "Debian", "/etc/debian_version",
- "Mandrake", "/etc/mandrake-release",
- "Mandrake", "/etc/mandrakelinux-release",
- "Yellow Dog", "/etc/yellowdog-release",
- "OpenFiler", "/etc/distro-release",
- "Red Hat", "/etc/redhat-release"
- );
- $distro = "";
- $distrov = "";
- do {
- if (-e $distros[1]) {
- $distro = $distros[0];
- $distrov = `cat $distros[1] | head -n 1`;
- chomp($distrov);
- $distrov =~ s/[^0-9]*([0-9.]+)[^0-9.]{0,1}.*/$1/;
- }
- shift @distros; shift @distros;
- } until (scalar @distros == 0) || (length $distro > 0);
- if ($distro eq "Debian") {
- if (-e "/etc/lsb-release") {
- $realdistro = `cat /etc/lsb-release | grep DISTRIB_DESCRIPTION`;
- if ($realdistro ne "") {
- chomp $realdistro;
- $realdistro =~ s/DISTRIB_DESCRIPTION="//;
- $realdistro =~ s/"$//;
- $distro = $realdistro;
- $distrov = $realdistro;
- $distro =~ s/ [0-9.]+.*$//;
- $distrov =~ s/$distro //;
- }
- }
- }
- if ($distro eq "Red Hat") {
- $realdistro = `cat /etc/redhat-release`;
- if ($realdistro =~ "^CentOS") {
- $distro = "CentOS";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement