mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-10 09:01:17 +02:00
2016-06-21 Fred Gleason <fredg@paravelsystems.com>
* Reimplemented 'get_distro.sh' as 'get_distro.pl'.
This commit is contained in:
parent
b7db9406d9
commit
798f744bd6
@ -15259,3 +15259,5 @@
|
|||||||
2016-06-18 Fred Gleason <fredg@paravelsystems.com>
|
2016-06-18 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a bug in 'xdg/Makefile.am' that caused the 'make rpm' target
|
* Fixed a bug in 'xdg/Makefile.am' that caused the 'make rpm' target
|
||||||
to break when HPI support was not enabled.
|
to break when HPI support was not enabled.
|
||||||
|
2016-06-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Reimplemented 'get_distro.sh' as 'get_distro.pl'.
|
||||||
|
@ -116,7 +116,7 @@ doxygen:
|
|||||||
EXTRA_DIST = autogen.sh\
|
EXTRA_DIST = autogen.sh\
|
||||||
build_win32.bat\
|
build_win32.bat\
|
||||||
CODINGSTYLE\
|
CODINGSTYLE\
|
||||||
get_distro.sh\
|
get_distro.pl\
|
||||||
get_target.sh\
|
get_target.sh\
|
||||||
install-init.sh\
|
install-init.sh\
|
||||||
make_slack.in\
|
make_slack.in\
|
||||||
|
@ -52,10 +52,10 @@ dnl
|
|||||||
AC_DEFUN([AR_GET_DISTRO],[]
|
AC_DEFUN([AR_GET_DISTRO],[]
|
||||||
[
|
[
|
||||||
AC_MSG_CHECKING(distribution)
|
AC_MSG_CHECKING(distribution)
|
||||||
ar_distro_name=$(./get_distro.sh NAME $AWK)
|
ar_distro_name=$(./get_distro.pl NAME)
|
||||||
ar_distro_version=$(./get_distro.sh VERSION $AWK)
|
ar_distro_version=$(./get_distro.pl VERSION)
|
||||||
ar_distro_major=$(./get_distro.sh MAJOR $AWK)
|
ar_distro_major=$(./get_distro.pl MAJOR)
|
||||||
ar_distro_minor=$(./get_distro.sh MINOR $AWK)
|
ar_distro_minor=$(./get_distro.pl MINOR)
|
||||||
AC_MSG_RESULT([$ar_distro_name $ar_distro_version])
|
AC_MSG_RESULT([$ar_distro_name $ar_distro_version])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
148
get_distro.pl
Executable file
148
get_distro.pl
Executable file
@ -0,0 +1,148 @@
|
|||||||
|
#!/usr/bin/perl -W
|
||||||
|
|
||||||
|
# get_distro.pl
|
||||||
|
#
|
||||||
|
# Try to determine the distribution name and version of the host machine.
|
||||||
|
# Used as part of the AR_GET_DISTRO() macro.
|
||||||
|
#
|
||||||
|
# (C) Copyright 2012,2016 Fred Gleason <fredg@salemradiolabs.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of
|
||||||
|
# the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
#USAGE: get_distro.pl NAME|VERSION|MAJOR|MINOR|POINT
|
||||||
|
|
||||||
|
if($ARGV[0] eq "NAME") {
|
||||||
|
if(!system("test","-f","/etc/SuSE-release")) {
|
||||||
|
print "SuSE";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/debian_version")) {
|
||||||
|
print "Debian";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/redhat-release")) {
|
||||||
|
print "RedHat";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ARGV[0] eq "VERSION") {
|
||||||
|
if(!system("test","-f","/etc/SuSE-release")) {
|
||||||
|
print &GetVersion("/etc/SuSE-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/debian_version")) {
|
||||||
|
print &GetVersion("/etc/debian_version");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/redhat-release")) {
|
||||||
|
print &GetVersion("/etc/redhat-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ARGV[0] eq "MAJOR") {
|
||||||
|
if(!system("test","-f","/etc/SuSE-release")) {
|
||||||
|
print &GetMajor("/etc/SuSE-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/debian_version")) {
|
||||||
|
print &GetMajor("/etc/debian_version");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/redhat-release")) {
|
||||||
|
print &GetMajor("/etc/redhat-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ARGV[0] eq "MINOR") {
|
||||||
|
if(!system("test","-f","/etc/SuSE-release")) {
|
||||||
|
print &GetMinor("/etc/SuSE-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/debian_version")) {
|
||||||
|
print &GetMinor("/etc/debian_version");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/redhat-release")) {
|
||||||
|
print &GetMinor("/etc/redhat-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ARGV[0] eq "POINT") {
|
||||||
|
if(!system("test","-f","/etc/SuSE-release")) {
|
||||||
|
print &GetPoint("/etc/SuSE-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/debian_version")) {
|
||||||
|
print &GetPoint("/etc/debian_version");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
if(!system("test","-f","/etc/redhat-release")) {
|
||||||
|
print &GetPoint("/etc/redhat-release");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 256;
|
||||||
|
|
||||||
|
|
||||||
|
sub GetVersion
|
||||||
|
{
|
||||||
|
if(open VERSION,"<",$_[0]) {
|
||||||
|
my $version=<VERSION>;
|
||||||
|
my @f0=split " ",$version;
|
||||||
|
for(my $i=0;$i<@f0;$i++) {
|
||||||
|
my @f1=split "[.]",$f0[$i];
|
||||||
|
if(@f1>1) {
|
||||||
|
return $f0[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub GetMajor
|
||||||
|
{
|
||||||
|
my @f0=split "[.]",&GetVersion($_[0]);
|
||||||
|
|
||||||
|
return $f0[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub GetMinor
|
||||||
|
{
|
||||||
|
my @f0=split "[.]",&GetVersion($_[0]);
|
||||||
|
|
||||||
|
if(@f0 ge 2) {
|
||||||
|
return $f0[1];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub GetPoint
|
||||||
|
{
|
||||||
|
my @f0=split "[.]",&GetVersion($_[0]);
|
||||||
|
|
||||||
|
if(@f0 ge 3) {
|
||||||
|
return $f0[2];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
115
get_distro.sh
115
get_distro.sh
@ -1,115 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# get_distro.sh
|
|
||||||
#
|
|
||||||
# Try to determine the distribution name and version of the host machine.
|
|
||||||
# Used as part of the AR_GET_DISTRO() macro.
|
|
||||||
#
|
|
||||||
# (C) Copyright 2012,2016 Fred Gleason <fredg@salemradiolabs.com>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of
|
|
||||||
# the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public
|
|
||||||
# License along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
#
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
NAME)
|
|
||||||
if test -f /etc/SuSE-release ; then
|
|
||||||
echo -n "SuSE"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/debian_version ; then
|
|
||||||
echo -n "Debian"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/redhat-release ; then
|
|
||||||
echo -n "RedHat"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test `uname` = "Darwin" ; then
|
|
||||||
echo -n "OS X"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo -n "unknown"
|
|
||||||
;;
|
|
||||||
VERSION)
|
|
||||||
if test -f /etc/SuSE-release ; then
|
|
||||||
cat /etc/SuSE-release | sed "/SE/ d;s/VERSION = //"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/debian_version ; then
|
|
||||||
cat /etc/debian_version
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/redhat-release ; then
|
|
||||||
VER=`awk '/release/ {print $3}' /etc/redhat-release`
|
|
||||||
if test $VER = "release" ; then
|
|
||||||
VER=`awk '/release/ {print $4}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
if test $VER = "Enterprise" ; then
|
|
||||||
VER=`awk '/release/ {print $7}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
echo $VER
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test `uname` = "Darwin" ; then
|
|
||||||
echo -n `uname -r`
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
MAJOR)
|
|
||||||
if test -f /etc/SuSE-release ; then
|
|
||||||
cat /etc/SuSE-release | sed "/SE/ d;s/VERSION = //" | awk -F '.' '{print $1}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/debian_version ; then
|
|
||||||
cat /etc/debian_version | awk -F '.' '{print $1}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/redhat-release ; then
|
|
||||||
VER=`awk '/release/ {print $3}' /etc/redhat-release`
|
|
||||||
if test $VER = "release" ; then
|
|
||||||
VER=`awk '/release/ {print $4}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
if test $VER = "Enterprise" ; then
|
|
||||||
VER=`awk '/release/ {print $7}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
echo $VER | awk -F '.' '{print $1}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
MINOR)
|
|
||||||
if test -f /etc/SuSE-release ; then
|
|
||||||
cat /etc/SuSE-release | sed "/SE/ d;s/VERSION = //" | awk -F '.' '{print $2}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/debian_version ; then
|
|
||||||
cat /etc/debian_version | awk -F '.' '{print $2}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if test -f /etc/redhat-release ; then
|
|
||||||
VER=`awk '/release/ {print $3}' /etc/redhat-release`
|
|
||||||
if test $VER = "release" ; then
|
|
||||||
VER=`awk '/release/ {print $4}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
if test $VER = "Enterprise" ; then
|
|
||||||
VER=`awk '/release/ {print $7}' /etc/redhat-release`
|
|
||||||
fi
|
|
||||||
echo $VER | awk -F '.' '{print $2}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
# End of get_distro.sh
|
|
Loading…
x
Reference in New Issue
Block a user