2021-05-19 Fred Gleason <fredg@paravelsystems.com>

* Hacked the build system to make the PyPAD module install
	correctly on Debian-ish systems.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-05-20 08:02:24 -04:00
parent 70d773d78e
commit cb4f8fe9ea
5 changed files with 64 additions and 15 deletions

View File

@@ -2,10 +2,13 @@
# get_distro.pl
#
# Try to determine the distribution name and version of the host machine.
# Used as part of the AR_GET_DISTRO() macro.
# Read various fields from 'os-release'.
# Used as part of the AR_GET_DISTRO() macro.
#
# (C) Copyright 2012,2016 Fred Gleason <fredg@salemradiolabs.com>
# See https://www.freedesktop.org/software/systemd/man/os-release.html
# for a description of the various fields.
#
# (C) Copyright 2012-2021 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
@@ -22,13 +25,28 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#USAGE: get_distro.pl NAME|VERSION|MAJOR|MINOR|POINT
my $usage="USAGE: get_distro.pl NAME|PRETTY_NAME|ID|ID_LIKE|VERSION|MAJOR|MINOR|POINT";
if($ARGV[0] eq "NAME") {
print &Extract("NAME");
exit 0;
}
if($ARGV[0] eq "PRETTY_NAME") {
print &Extract("PRETTY_NAME");
exit 0;
}
if($ARGV[0] eq "ID") {
print &Extract("ID");
exit 0;
}
if($ARGV[0] eq "ID_LIKE") {
print &Extract("ID_LIKE");
exit 0;
}
if($ARGV[0] eq "VERSION") {
print &Extract("VERSION_ID");
exit 0;
@@ -63,18 +81,22 @@ if($ARGV[0] eq "POINT") {
exit 0;
}
print $usage;
exit 256;
sub Extract
{
if(open RELEASE,"<","/etc/os-release") {
if((open RELEASE,"<","/etc/os-release") ||
(open RELEASE,"<","/usr/lib/os-release")) {
while(<RELEASE>) {
my @f0=split "\n",$_;
for(my $i=0;$i<@f0;$i++) {
my @f1=split "=",$f0[$i];
if($f1[0] eq $_[0]) {
return substr($f1[1],1,length($f1[1])-2);
$f1[1]=~s/^"(.*)"$/$1/;
return $f1[1];
# return substr($f1[1],1,length($f1[1])-2);
}
}
}