From d9df4d42b9fc128cf6da7fb6203e614308ea2e30 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: May 13 2004 21:20:19 +0000 Subject: First try at the module update. --- diff --git a/lsb_release/src/INSTALL b/lsb_release/src/INSTALL index 248bd34..58c7875 100644 --- a/lsb_release/src/INSTALL +++ b/lsb_release/src/INSTALL @@ -2,7 +2,7 @@ This dir contains the lsb_release script and the required programs to build the associated man pages. README -lsb_release : version 1.4 +lsb_release : version 2.0 help2man : the GNU script to build Man from --help output Makefile : Makefile for creating the man page lsb_release.examples : the Man style add-on for the pages diff --git a/lsb_release/src/Makefile b/lsb_release/src/Makefile index b69387d..a7dfdd9 100644 --- a/lsb_release/src/Makefile +++ b/lsb_release/src/Makefile @@ -1,12 +1,11 @@ # # Makefile for lsb_release program # -# Copyright (C) 2000 Free Software Group, Inc -# Copyright (C) 2002 Free Software Group, Inc +# Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc # # Christopher Yeoh # -# This is $Revision: 1.6 $ +# This is $Revision: 1.7 $ # Config diff --git a/lsb_release/src/lsb_release b/lsb_release/src/lsb_release index d17bb4c..f787690 100755 --- a/lsb_release/src/lsb_release +++ b/lsb_release/src/lsb_release @@ -1,10 +1,19 @@ #!/bin/sh # About: This shell script is the lsb_release implementation, # Version: see SCRIPTVERSION (in the Declarations section) -# Licence: GPL (latest version), Free Software Group, Inc +# Licence: GPL (latest version), Free Standards Group, Inc # Author: Dominique MASSONIE # Date: September 27th, 2000 # +# * Changes in 2.0 +# - Support LSB 2.0 module layout (Mats Wichmann) +# The LSB_VERSION is now a colon-separated field of supported module versions +# An /etc/lsb-release.d is searched for modules beyond the core. +# Only the filenames in this directory is looked at, those names are added +# to LSB_VERSION. This allows module support to be handled easily by +# package install/removal without a need to edit lsb-release on the fly. +# - Correct license: FSG == Free Standards Group, Inc. +# # * Changes in 1.4 # - "awk" not needed anymore (Loic Lefort) # - fixed bug #121879 reported by Chris D. Faulhaber, @@ -21,17 +30,18 @@ # - LSB_VERSION is no longer required in /etc/lsb-release file # # * Changes in 1.1 -# - removed some bash-ism and typos (me) +# - removed some bash-ism and typos # Notice: script remains broken with ash because of awk issues -# - changed licence to FSG - "Free Software Group, Inc" (me) -# - fixed problem with --short single arg call (me) -# - changed Debian specifics, codename anticipates release num (me) +# - changed licence to FSG - "Free Software Group, Inc" +# - fixed problem with --short single arg call +# - changed Debian specifics, codename anticipates release num # # Description: -# Collect informations from sourceable /etc/lsb-release file (present on +# Collect information from sourceable /etc/lsb-release file (present on # LSB-compliant systems) : LSB_VERSION, DISTRIB_ID, DISTRIB_RELEASE, -# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional). -# Then (if needed) find and parse the /etc/[distro]-release file. +# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional) +# Then (if needed) find and add names from /etc/lsb-release.d +# Then (if needed) find and parse the /etc/[distro]-release file ############################################################################### @@ -39,11 +49,12 @@ ############################################################################### # This script version -SCRIPTVERSION="1.4" +SCRIPTVERSION="2.0" # Defines the data files INFO_ROOT="/etc" # directory of config files INFO_LSB_FILE="lsb-release" # where to get LSB version +INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules INFO_DISTRIB_SUFFIX="release" # - ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib] ALTERNATE_DISTRIB_NAME="Debian" # " @@ -79,13 +90,13 @@ DESCSTR_DELI="release" DisplayProgramVersion() { echo "FSG `basename $0` v$SCRIPTVERSION" echo - echo "Copyright (C) 2000 Free Software Group, Inc." + echo "Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc." echo "This is free software; see the source for copying conditions. There\ is NO" echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR\ PURPOSE." echo - echo "Written by Dominique MASSONIE." + echo "Originally written by Dominique MASSONIE." exit $EXIT_STATUS } @@ -168,7 +179,19 @@ GetLSBInfo() { # should init at least LSB_VERSION . "$INFO_ROOT/$INFO_LSB_FILE" fi - [ -z "$LSB_VERSION" ] && LSB_VERSION=$MSG_NA + if [ -z "$LSB_VERSION" ] + then + LSB_VERSION=$MSG_NA + else + # if we found LSB_VERSION, continue to look in directory + if [ -d "$INFO_ROOT/$INFO_LSB_DIR" ] + then + for tag in "$INFO_ROOT/$INFO_LSB_DIR/"* + do + LSB_VERSION=$LSB_VERSION:`basename $tag` + done + fi + fi } # Get the whole distrib information string (from ARG $1 file) diff --git a/lsb_release/src/lsb_release.examples b/lsb_release/src/lsb_release.examples index 1edfa9a..079360a 100644 --- a/lsb_release/src/lsb_release.examples +++ b/lsb_release/src/lsb_release.examples @@ -1,18 +1,24 @@ [FILES] If the installation is LSB compliant, the \fB"/etc/lsb-release"\fR -file should contain the \fBLSB_VERSION\fR field. The value of the -field should be the version number of the LSB specification against -which the installation is compliant. If the installation is not +file should contain the \fBLSB_VERSION\fR field. +The value of the field should be a colon separated list of +supported module versions indicating the LSB specification +modules to which the installation is compliant. If the installation is not compliant, the above field should .B not be present. Optional fields are \fBDISTRIB_ID\fR, \fBDISTRIB_RELEASE\fR, \fBDISTRIB_CODENAME\fR, \fBDISTRIB_DESCRIPTION\fR and can be used to -overwrite information which is parsed from the next file. +override information which is parsed from the +\fB"/etc/\fIdistrib\fB-release"\fR file. + +If the \fB"/etc/lsb-release.d"\fR directory exists, it is +searched for filenames which are taken as additional module-version +strings to add to \fBLSB_VERSION\fR. -The \fB"/etc/[distrib]-release"\fR file contains a description line +The \fB"/etc/\fIdistrib\fB-release"\fR file contains a description line which is parsed to get information (especially on currently non-LSB compliant systems). @@ -20,29 +26,39 @@ The required line style is: .br "\fIDistributor\fR \fBrelease\fR \fIx.x\fR \fB(\fR\fICodename\fR\fB)\fR" -Where \fIDistributor\fR can be a couple of words, but then concatenated (i.e. Linux Foo BarLinux Linux -> FooBarLinux), +Where \fIDistributor\fR can be a couple of words, but then concatenated +(i.e. Linux Foo BarLinux Linux -> FooBarLinux), .br \fIx.x\fR starts with a digit followed by any non-blank characters, \fICodename\fR will also be concatenated (blanks cleanup only). -And \fBrelease\fR is a keyword not to be used in \fBDISTRIB_DESCRIPTION\fR if you don't want to overwrite "/etc/[distrib]-release" data. +\fBrelease\fR may not be used as a keyword in \fBDISTRIB_DESCRIPTION\fR +if you don't want to override \fB"/etc/\fIdistrib\fB-release"\fR data. -\fBNotice:\fR To support the \fBDebian\fR distributions' lack of information (see "/etc/debian_version" file) some have been directly added into the \fBlsb_release\fR script. +\fBNotice:\fR To support the \fBDebian\fR distributions' lack of +information (see "/etc/debian_version" file) some have been directly +added into the \fBlsb_release\fR script. [EXAMPLES] -.B The "/etc/lsb-release" file contains: +If the "\fB/etc/lsb-release\fR" file contains: -LSB_VERSION="1.0" +LSB_VERSION="core-2.0-ia64:core-2.0-noarch" .br DISTRIB_DESCRIPTION="I enjoy using my distrib" -.B And the "/etc/foobar-release" file contains: +and the "\fB/etc/lsb-release.d\fR" directory contains: + +graphics-2.0-ia64 graphics-2.0-noarch + +and the "\fB/etc/foobar-release\fP" file contains: My Linux Distrib release 1.0RC4 (TryIt) +Then the results of various options will be: + .B $ ./lsb_release --all .br -LSB Version: core-2.0-ia32:graphics-2.0-ia32 +LSB Version: core-2.0-ia64:core-2.0-noarch:graphics-2.0-ia64:graphics-2.0-noarch .br Distributor ID: MyDistrib .br @@ -56,8 +72,9 @@ Codename: TryIt .br 1.0 MyDistrib "I enjoy using my distrib" 1.0RC4 TryIt -Then simply without the "/etc/lsb-release" file, that means result on a \fBnon-LSB\fR compliant distrib: -.br +If the "/etc/lsb-release" file is absent (indicating this is +not an LSB compliant distribution), the result will be: + .B $ ./lsb_release -a .br LSB Version: n/a @@ -71,5 +88,6 @@ Release: 1.0RC4 Codename: TryIt [REPORTING BUGS] -Report bugs to . -Include a complete, self contained example that will allow the bug to be reproduced, and say which version of lsb_release you are using. +Report bugs at http://bugs.linuxbase.org. +Please include a complete, self contained example that will allow the +bug to be reproduced, and say which version of lsb_release you are using.