99 lines
2.4 KiB
Bash
99 lines
2.4 KiB
Bash
#!/bin/sh
|
||
#
|
||
# Compatibility script for FSG lsb_release v1.4 or newer
|
||
#
|
||
version="1.0"
|
||
distributor_id="VoidLinux"
|
||
description="Void Linux"
|
||
release="rolling"
|
||
codename="void"
|
||
options=""
|
||
short=0
|
||
|
||
while [ $# -gt 0 ]; do
|
||
case "$1" in
|
||
-v|--version) options="${options} version" ;;
|
||
-i|--id) options="${options} distributor_id" ;;
|
||
-d|--description) options="${options} description" ;;
|
||
-r|--release) options="${options} release" ;;
|
||
-c|--codename) options="${options} codename" ;;
|
||
-a|--all) options="version distributor_id description release codename" ;;
|
||
-s|--short) short=1 ;;
|
||
-h|--help) cat << _EOF
|
||
SYNOPSIS
|
||
lsb_release [OPTION]...
|
||
OPTIONS
|
||
−v, −−version
|
||
Display the version of the LSB specification against which the distribution is compliant.
|
||
|
||
−i, −−id
|
||
Display the string id of the distributor.
|
||
|
||
−d, −−description
|
||
Display the single line text description of the distribution.
|
||
|
||
−r, −−release
|
||
Display the release number of the distribution.
|
||
|
||
−c, −−codename
|
||
Display the codename according to the distribution release.
|
||
|
||
−a, −−all
|
||
Display all of the above information.
|
||
|
||
−s, −−short
|
||
Display all of the above information in short output format.
|
||
|
||
−h, −−help
|
||
Display this message.
|
||
_EOF
|
||
;;
|
||
-*) # Multiple options in one parameter
|
||
opt=$(echo $1 | cut -c2-)
|
||
while [ ! -z "$opt" ]; do
|
||
o=$(echo $opt | cut -c1)
|
||
case "$o" in
|
||
v) options="${options} version" ;;
|
||
i) options="${options} distributor_id" ;;
|
||
d) options="${options} description" ;;
|
||
r) options="${options} release" ;;
|
||
c) options="${options} codename" ;;
|
||
a) options="version distributor_id description release codename" ;;
|
||
s) short=1 ;;
|
||
esac
|
||
opt=$(echo $opt | cut -c2-)
|
||
done
|
||
;;
|
||
esac
|
||
shift
|
||
done
|
||
|
||
[ -z "$options" ] && options="version"
|
||
|
||
if [ "$short" -eq 1 ]; then
|
||
space=""
|
||
for opt in $options; do
|
||
case "$opt" in
|
||
version) printf "${space}${version}" ;;
|
||
distributor_id) printf "${space}${distributor_id}" ;;
|
||
description) printf "${space}\"${description}\"" ;;
|
||
release) printf "${space}${release}" ;;
|
||
codename) printf "${space}${codename}" ;;
|
||
esac
|
||
space=" "
|
||
done
|
||
printf "\n"
|
||
else
|
||
for opt in $options; do
|
||
case "$opt" in
|
||
version) printf "LSB Version:\t${version}\n" ;;
|
||
distributor_id) printf "Distributor ID:\t${distributor_id}\n" ;;
|
||
description) printf "Description:\t${description}\n" ;;
|
||
release) printf "Release:\t${release}\n" ;;
|
||
codename) printf "Codename:\t${codename}\n" ;;
|
||
esac
|
||
done
|
||
fi
|
||
|
||
exit 0
|