Commit 67995600 authored by Vitaly Lipatov's avatar Vitaly Lipatov

distr_info: add --codename support

parent 46464fbd
......@@ -6,7 +6,7 @@
# You can set ROOTDIR to root system dir
#ROOTDIR=
PROGVERSION="20220719"
PROGVERSION="20220812"
# TODO: check /etc/system-release
......@@ -211,6 +211,10 @@ pkgtype()
esac
}
print_codename()
{
echo "$DISTRIB_CODENAME"
}
get_var()
{
......@@ -280,6 +284,7 @@ if distro os-release ; then
VENDOR_ID="$ID"
DISTRIB_FULL_RELEASE=$DISTRIB_RELEASE
DISTRIB_RELEASE=$(echo "$DISTRIB_RELEASE" | sed -e "s/\.[0-9]$//g")
DISTRIB_CODENAME="$VERSION_CODENAME"
elif distro lsb-release ; then
DISTRIB_ID=$(cat $DISTROFILE | get_var DISTRIB_ID)
......@@ -744,6 +749,7 @@ Total system information:
System memory size (MB) (-m): $(get_memory_size)
Base OS name (-o): $(get_base_os_name)
Base distro (vendor) name (-s|-n): $(pkgvendor)
Version codename (--codename): $(print_codename)
(run with -h to get help)
EOF
......@@ -764,6 +770,7 @@ case "$1" in
echo " -a - print hardware architecture (--distro-arch for distro depended name)"
echo " -b - print size of arch bit (32/64)"
echo " -c - print number of CPU cores"
echo " --codename - print distro codename (focal for Ubuntu 20.04)"
echo " -z - print current CPU MHz"
echo " -d - print distro name"
echo " -e - print full name of distro with version"
......@@ -809,6 +816,10 @@ case "$1" in
override_distrib "$2"
echo $DISTRIB_ID
;;
--codename)
override_distrib "$2"
print_codename
;;
-a)
override_distrib "$2"
[ -n "$DIST_ARCH" ] && echo "$DIST_ARCH" && exit 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment