armbian-build/packages/bsp/common/usr/bin/lsb_release
Igor Pečovnik f416c35c16
Adding minimal image (#1504)
* Minimal build setup (#1463)
* Netplan folder check & armbian-tools dependency on expect (and tcl) solved (#1464)
* Prevent netplan configration if it is not installed
* Resolved expect dependecy of armbian-tools
* More packages added for armbian-tools
* Added python3-apt and rsyslog to minimal installation
* Debootstrap variant doesn't play nice. We loose networking and it affects standard builds as well. Removing.
* Python-to-Bash conversion (#1470)
* Remove python3-apt dependency from BSP package, fix netplan error also on Disco and putting back varint=minbase ... tested Disco, Bionic
* Distinguish package list: *-minimal.list and *-desktop.list
* Enable Wireguard back which was removed by mistake. https://github.com/armbian/build/issues/1471
* Having minbase debootstrap variant for all will require further adjustements with current package base - backward compatibility. Minimal image is now Python free but need further testings ...
* Add wireless-regdb and crda to the pakage base, fix Ubuntu keyring warning while debootstrap.
* Add figlet to sort out missing fonts
* Moving few packages here and there. Bugfix when creating a cache package list
* Manually compared base images - they are the same with small insignificant difference. Minimal image has to be futher tuned
* Adjustements for bash powered lsb_release, adding some needed packages
* Fixed (no) network problems on Bionic/Disco
* Add rsync to debootstrap_list and few minor fixes
* Adjust text in lsb_release
* Olimex Micro A20: fix wrong boot config
* Remove duplicate depenedency
* Odroid C1: adjust kernel config
2019-08-16 19:21:12 +02:00

144 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
#
# Simple alternative to /usr/bin/lsb_release which doesn't require python.
#
# Based on https://gist.github.com/skx/1f9e5240856c5976193a
#
# If /etc/os-release exists then we use that to output data
# in a compatible format to the original lsb_release utility.
show_help() {
cat << EOF
Usage: lsb_release [options]
Options:
-h, --help show this help message and exit
-i, --id show distributor ID
-d, --description show description of this distribution
-r, --release show release number of this distribution
-c, --codename show code name of this distribution
-a, --all show all of the above information
-s, --short show requested information in short format
EOF
exit 0
}
#
# Potential command-line options.
#
all=0
codename=0
description=0
id=0
release=0
short=0
version=0
#
# Process each argument, and set the appropriate flag
# if we recognize it.
#
while :; do
case $1 in
-a|--all)
all=1
;;
-c|--codename)
codename=1
;;
-d|--description)
description=1
;;
-h|--help)
show_help
break
;;
-i|--id)
id=1
;;
-r|--release)
release=1
;;
-s|--short)
short=1
;;
-v|--version)
version=1
;;
-cs|-sc)
short=1
codename=1
;;
-is|-si)
short=1
id=1
;;
-ds|-sd)
short=1
description=1
;;
-as|-sa)
short=1
all=1
;;
*)
break
esac
shift
done
#
# Read our variables.
#
if [ -e /etc/os-release ]; then
. /etc/os-release
else
echo "/etc/os-release is not present. Aborting" >&2
exit 1
fi
#
# Now output the data - The order of these was chosen to match
# what the original lsb_release used, and while I suspect it doesn't
# matter I kept it the same.
#
if [ "$all" = "1" ] || [ "$id" = "1" ]; then
if [ "$short" = "0" ]; then
printf "Distributor ID:\t"
fi
echo $ID | sed 's/./\U&/'
fi
if [ "$all" = "1" ] || [ "$description" = "1" ]; then
if [ "$short" = "0" ]; then
printf "Description:\t"
fi
echo $PRETTY_NAME
fi
if [ "$all" = "1" ] || [ "$release" = "1" ]; then
if [ "$short" = "0" ]; then
printf "Release:\t"
fi
echo $VERSION_ID
fi
if [ "$all" = "1" ] || [ "$codename" = "1" ]; then
if [ "$short" = "0" ]; then
printf "Codename:\t"
fi
#
# Codename comes from: VERSION="7 (wheezy)"
#
ver=$(echo $VERSION | awk '{print $2}' | tr -d \(\))
if [ $ID = "ubuntu" ]; then echo "$UBUNTU_CODENAME"; else echo "$ver"; fi
fi
exit 0