File: lsb_release

package info (click to toggle)
python-distro 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 852 kB
  • sloc: python: 2,563; sh: 160; makefile: 66
file content (43 lines) | stat: -rwxr-xr-x 1,105 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#
# lsb_release command for testing the ld module.
# Only the -a option is supported.
#
# This version of the lsb_release command reads an lsb-release file.
#
# The lsb-release file has the usual format, e.g.:
#   DISTRIB_ID=Ubuntu
#   DISTRIB_RELEASE=14.04
#   DISTRIB_CODENAME=trusty
#   DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
# Where each line is optional. If a line is missing, the default value
# will be the empty string.
#

if [[ "$@" != "-a" ]]; then
  echo "Usage: lsb_release -a"
  exit 2
fi

# Because the PATH is set to just this directory, we cannot use 'dirname'
# or other external programs, but need to use built-in abilities of bash.
LSB_FILE="${0%/*}/../etc/lsb-release"

if [[ ! -f $LSB_FILE ]]; then
  echo "Error: LSB release file does not exist: $LSB_FILE"
  exit 1
fi

source $LSB_FILE

if [[ -n $LSB_VERSION ]]; then
  echo "LSB Version:	$LSB_VERSION"
else
  echo "No LSB modules are available."
fi
echo "Distributor ID:	${DISTRIB_ID:-}"
echo "Description:	${DISTRIB_DESCRIPTION:-}"
echo "Release:	${DISTRIB_RELEASE:-}"
echo "Codename:	${DISTRIB_CODENAME:-}"

exit 0