Commit 7cebd564 authored by Vitaly Lipatov's avatar Vitaly Lipatov

distr_info: improve override support

parent 0309402c
......@@ -6,7 +6,7 @@
# You can set ROOTDIR to root system dir
#ROOTDIR=
PROGVERSION="20220718"
PROGVERSION="20220719"
# TODO: check /etc/system-release
......@@ -48,8 +48,13 @@ override_distrib()
{
[ -n "$1" ] || return
VENDOR_ID=''
DISTRIB_ID="$(echo "$1" | sed -e 's|/.*||')"
DISTRIB_RELEASE="$(echo "$1" | sed -e 's|.*/||')"
PRETTY_NAME=''
local name="$(echo "$1" | sed -e 's|x86_64/||')"
[ "$name" = "$1" ] && DIST_ARCH="x86" || DIST_ARCH="x86_64"
DISTRIB_ID="$(echo "$name" | sed -e 's|/.*||')"
DISTRIB_RELEASE="$(echo "$name" | sed -e 's|.*/||')"
[ "$DISTRIB_ID" = "$DISTRIB_RELEASE" ] && DISTRIB_RELEASE=''
}
# Translate DISTRIB_ID to vendor name (like %_vendor does or package release name uses), uses VENDOR_ID by default
......@@ -455,10 +460,6 @@ fi
fill_distr_info
[ -n "$DISTRIB_ID" ] || DISTRIB_ID="Generic"
if [ -z "$PRETTY_NAME" ] ; then
PRETTY_NAME="$DISTRIB_ID $DISTRIB_RELEASE"
fi
get_uname()
{
tolower $(uname $1) | tr -d " \t\r\n"
......@@ -710,6 +711,10 @@ get_service_manager()
print_pretty_name()
{
if [ -z "$PRETTY_NAME" ] ; then
PRETTY_NAME="$DISTRIB_ID $DISTRIB_RELEASE"
fi
echo "$PRETTY_NAME"
}
......@@ -771,6 +776,7 @@ case $1 in
exit 0
;;
--pretty)
override_distrib "$2"
print_pretty_name
;;
--distro-arch)
......@@ -784,9 +790,12 @@ case $1 in
exit 0
;;
-d)
override_distrib "$2"
echo $DISTRIB_ID
;;
-a)
override_distrib "$2"
[ -n "$DIST_ARCH" ] && echo "$DIST_ARCH" && exit 0
get_arch
;;
-b)
......@@ -808,6 +817,7 @@ case $1 in
get_base_os_name
;;
-v)
override_distrib "$2"
echo $DISTRIB_RELEASE
;;
-s|-n)
......@@ -823,9 +833,11 @@ case $1 in
exit 0
;;
-e)
override_distrib "$2"
print_name_version
;;
*)
override_distrib "$1"
print_total_info
;;
esac
......
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