Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
distro_info
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
distro_info
Commits
58ff7dc2
Commit
58ff7dc2
authored
Nov 22, 2019
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --pretty option to print pretty name of the distro
parent
c2bff0b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
distro_info
bin/distro_info
+14
-2
distro_info.1
man/distro_info.1
+4
-16
No files found.
bin/distro_info
View file @
58ff7dc2
...
...
@@ -100,6 +100,7 @@ get_major_version()
}
# Default values
PRETTY_NAME
=
""
DISTRIB_ID
=
"Generic"
DISTRIB_RELEASE
=
""
DISTRIB_CODENAME
=
""
...
...
@@ -109,6 +110,7 @@ if distro lsb-release ; then
DISTRIB_ID
=
$(
cat
$DISTROFILE
| get_var DISTRIB_ID
)
DISTRIB_RELEASE
=
$(
cat
$DISTROFILE
| get_var DISTRIB_RELEASE
)
DISTRIB_CODENAME
=
$(
cat
$DISTROFILE
| get_var DISTRIB_CODENAME
)
PRETTY_NAME
=
$(
cat
$DISTROFILE
| get_var DISTRIB_DESCRIPTION
)
fi
# ALT Linux based
...
...
@@ -138,6 +140,7 @@ if distro altlinux-release ; then
elif
has
"starter kit"
;
then
DISTRIB_RELEASE
=
"p8"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
fi
PRETTY_NAME
=
"
$(
cat
/etc/altlinux-release
)
"
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
...
...
@@ -177,7 +180,7 @@ elif distro arch-release ; then
# Elbrus
elif
distro mcst_version
;
then
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
#"
# OpenWrt
elif
distro openwrt_release
;
then
...
...
@@ -486,11 +489,16 @@ get_service_manager()
echo
"(unknown)"
}
print_pretty_name
()
{
echo
"
$PRETTY_NAME
"
}
print_total_info
()
{
cat
<<
EOF
distro_info total information (run with -h to get help):
Pretty distro name (--pretty):
$(
print_pretty_name
)
Distro name and version (-e):
$(
print_name_version
)
Packaging system (-p):
$(
pkgtype
)
Running service manager (-y):
$(
get_service_manager
)
...
...
@@ -521,7 +529,8 @@ case $1 in
echo
" -o - print base OS name"
echo
" -p [SystemName] - print type of the packaging system"
echo
" -s [SystemName] - print name of distro for build system (like in the package release name)"
ecgi
" -y - print running service manager"
echo
" -y - print running service manager"
echo
" --pretty - print pretty distro name"
echo
" -v - print version of distro"
echo
" -V - print the utility version"
echo
"Run without args to print all information."
...
...
@@ -533,6 +542,9 @@ case $1 in
pkgtype
exit
0
;;
--pretty
)
print_pretty_name
;;
-d
)
echo
$DISTRIB_ID
;;
...
...
man/distro_info.1
View file @
58ff7dc2
...
...
@@ -5,22 +5,7 @@
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH EEPM 1 "November 2019" "Version 0.1"
<------><------>echo " -a - print hardware architecture"
<------><------>echo " -b - print size of arch bit (32/64)"
<------><------>echo " -d - print distro name"
<------><------>echo " -e - print full name of distro with version"
<------><------>echo " -h - this help"
<------><------>echo " -m - print system memory size (in MB)"
<------><------>echo " -n [SystemName] - print vendor name (as _vendor macros in rpm)"
<------><------>echo " -o - print base os name"
<------><------>echo " -p [SystemName] - print type of the packaging system"
<------><------>echo " -s [SystemName] - print name of distro for build system (like in the package release name)"
<------><------>echo " -v - print version of distro"
<------><------>echo " -V - print the utility version"
<------><------>echo "Run without args to print all information."
<------><------>exit 0
.TH EEPM 1 "November 2019" "Version 1.1"
.SH NAME
distro_info \- get various info about a system and used distro
...
...
@@ -73,6 +58,9 @@ print type of the packaging system (deb, rpm)
.I -y
print running service manager (systemd, sysvinit)
.TP
.I --pretty
print name name of the distro
.TP
.I -v
print version of the distro (f.i. 20.04 or p9)
.TP
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment