lsb_release (2495B)
1#!/bin/sh 2# 3# Compatibility script for FSG lsb_release v1.4 or newer 4# 5version="1.0" 6distributor_id="VoidLinux" 7description="Void Linux" 8release="rolling" 9codename="void" 10options="" 11short=0 12 13while [ $# -gt 0 ]; do 14 case "$1" in 15 -v|--version) options="${options} version" ;; 16 -i|--id) options="${options} distributor_id" ;; 17 -d|--description) options="${options} description" ;; 18 -r|--release) options="${options} release" ;; 19 -c|--codename) options="${options} codename" ;; 20 -a|--all) options="version distributor_id description release codename" ;; 21 -s|--short) short=1 ;; 22 -h|--help) cat << _EOF 23SYNOPSIS 24 lsb_release [OPTION]... 25OPTIONS 26 −v, −−version 27 Display the version of the LSB specification against which the distribution is compliant. 28 29 −i, −−id 30 Display the string id of the distributor. 31 32 −d, −−description 33 Display the single line text description of the distribution. 34 35 −r, −−release 36 Display the release number of the distribution. 37 38 −c, −−codename 39 Display the codename according to the distribution release. 40 41 −a, −−all 42 Display all of the above information. 43 44 −s, −−short 45 Display all of the above information in short output format. 46 47 −h, −−help 48 Display this message. 49_EOF 50 ;; 51 -*) # Multiple options in one parameter 52 opt=$(echo $1 | cut -c2-) 53 while [ ! -z "$opt" ]; do 54 o=$(echo $opt | cut -c1) 55 case "$o" in 56 v) options="${options} version" ;; 57 i) options="${options} distributor_id" ;; 58 d) options="${options} description" ;; 59 r) options="${options} release" ;; 60 c) options="${options} codename" ;; 61 a) options="version distributor_id description release codename" ;; 62 s) short=1 ;; 63 esac 64 opt=$(echo $opt | cut -c2-) 65 done 66 ;; 67 esac 68 shift 69done 70 71[ -z "$options" ] && options="version" 72 73if [ "$short" -eq 1 ]; then 74 space="" 75 for opt in $options; do 76 case "$opt" in 77 version) printf "${space}${version}" ;; 78 distributor_id) printf "${space}${distributor_id}" ;; 79 description) printf "${space}\"${description}\"" ;; 80 release) printf "${space}${release}" ;; 81 codename) printf "${space}${codename}" ;; 82 esac 83 space=" " 84 done 85 printf "\n" 86else 87 for opt in $options; do 88 case "$opt" in 89 version) printf "LSB Version:\t${version}\n" ;; 90 distributor_id) printf "Distributor ID:\t${distributor_id}\n" ;; 91 description) printf "Description:\t${description}\n" ;; 92 release) printf "Release:\t${release}\n" ;; 93 codename) printf "Codename:\t${codename}\n" ;; 94 esac 95 done 96fi 97 98exit 0