[Setup-tool-hackers] [PATCH] use lsb-release info in platform.pl.in
- From: Richard Bos <allabos freeler nl>
- To: setup-tool-hackers ximian com
- Subject: [Setup-tool-hackers] [PATCH] use lsb-release info in platform.pl.in
- Date: Sun, 20 May 2001 23:18:31 +0200
Dear Setup Tool Hackers,
just recently I got to know the XST and the lsb_release command.
The lsb_release command has been standardized by the Linux Standard Base (LSB)
project to determine the linux vendor/distributor and it's distro version.
As xst needs to know on which distro it is operating this command/config file
looks usefull for the xst project. Although the xst project already has a
tool that is able to determine the distro and it's version, it would still be
good to use lsb_release has it is a standard.
I discussed this proposal with Chema and he proposed to sent a patch using
the lsb_release to this list, so please find the patch in attachment.
The /etc/lsb-release file has been standardized for linux distributions by the
Linux Standard Base (LSB) project (http://www.linuxbase.org).
More info about the lsb_release command can be found at
http://www.linuxbase.org/spec/gLSB/gLSB/lsbrelease.html
The lsb-release package is already part of Debian, SuSE-7.1 and ...
The lsb_release package consist of 2 files (executable and manual page)
and can be downloaded from
http://sourceforge.net/project/showfiles.php?group_id=1107&release_id=19799+
The patch provides 2 additional variables:
1) $xst_lsb_version: the version that the vendor/distributor comply with)
this is a required field in the /etc/lsb_release file
2) $xst_dist_codename: e.g. woody in Debian
Last week I encountered 3 linux applications that are all figuring the distro
and it's version. Using lsb_release would make it easy for all this apps to
obtain this info (for xst it is already "too late").
Feedback, etc welcome.
--
Richard Bos
For those who have no (/)home the journey is endless
P.S. I haven't tested the platform.pl file in the xst environment, as I do not
have it running.
--- platform.pl.in.old Sun May 20 22:33:12 2001
+++ platform.pl.in Sun May 20 22:45:16 2001
@@ -25,6 +25,46 @@
# --- System guessing --- #
+my $xst_lsb_version = "na" ;
+my $xst_dist_codename = "na" ;
+
+sub check_lsb
+{
+ local $xst_dist_id = "na";
+ local $xst_dist_release = "na";
+
+ #
+ # Use the lsb-release config file to determine the distribution/vendor.
+ # This file has been standardized for linux distributions by the
+ # Linux Standard Base (LSB) project (http://www.linuxbase.org).
+ # More info about the lsb_release command can be found at
+ # http://www.linuxbase.org/spec/gLSB/gLSB/lsbrelease.html
+ # The lsb-release package is already part of Debian, SuSE-7.1 and ...
+ #
+ # The lsb_release package consist of 2 files (executable and manual page)
+ # and can be downloaded from
+ # http://sourceforge.net/project/showfiles.php?group_id=1107&release_id=19799
+ #
+ # To my opinion the variable $xst_lsb_version can now be refered to
+ # instead of redhat-6.2, to determine the distribution characteristics...
+ #
+ open RELEASE, "/etc/lsb-release" or return 0;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^LSB_VERSION=(\S+)/) { $xst_lsb_version = $1 }
+ if (/^DISTRIB_CODENAME=(\S+)/) { $xst_dist_codename = $1 }
+
+ #
+ # Make sure the id string is lower case
+ #
+ if (/^DISTRIB_ID=(\S+)/) { $xst_dist_id = lc($1) }
+ if (/^DISTRIB_RELEASE=(\S+)/) { $xst_dist_release = $1 }
+
+ $xst_dist = $xst_dist_id . "-" . $xst_dist_release
+ }
+ close RELEASE;
+}
sub check_debian
{
@@ -179,7 +219,8 @@ sub xst_platform_guess
# if the system is linux, &set $xst_dist and $xst_dist_version
if ($xst_system =~ /linux/)
{
- &check_debian
+ &check_lsb
+ || &check_debian
|| &check_caldera
|| &check_suse
|| &check_mandrake
LSB_VERSION=0.9
DISTRIB_RELEASE=7.0
DISTRIB_ID=SuSE
DISTRIB_CODENAME=tst-lsb
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]