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
7f16b59f
Commit
7f16b59f
authored
Oct 10, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distro_info: cosmetic improvements
parent
373a89ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
distro_info
bin/distro_info
+21
-10
No files found.
bin/distro_info
View file @
7f16b59f
#!/bin/sh
#!/bin/sh
# 2007-20
19
(c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-20
20
(c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-20
19
(c) Etersoft
# 2007-20
20
(c) Etersoft
# 2007-20
19
Public domain
# 2007-20
20
Public domain
# You can set ROOTDIR to root system dir
# You can set ROOTDIR to root system dir
#ROOTDIR=
#ROOTDIR=
PROGVERSION
=
"20201010"
# TODO: check /etc/system-release
# TODO: check /etc/system-release
# Check for DISTRO specific file in /etc
# Check for DISTRO specific file in /etc
...
@@ -287,7 +289,7 @@ elif distro os-release ; then
...
@@ -287,7 +289,7 @@ elif distro os-release ; then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
DISTRIB_ID
=
"FreeBSD"
DISTRIB_ID
=
"FreeBSD"
UNAME
=
$(
uname
-r
)
UNAME
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
echo
"
$UNAME
"
|
grep
RELEASE |
sed
-e
"s|
\(
[0-9]
\.
[0-9]
\)
-RELEASE|
\1
|g"
)
DISTRIB_RELEASE
=
$(
echo
"
$UNAME
"
|
grep
RELEASE |
sed
-e
"s|
\(
[0-9]
\.
[0-9]
\)
-RELEASE|
\1
|g"
)
#"
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
"
$(
uname
)
"
=
"SunOS"
]
;
then
elif
[
"
$(
uname
)
"
=
"SunOS"
]
;
then
...
@@ -430,8 +432,9 @@ echo "$DIST_BIT"
...
@@ -430,8 +432,9 @@ echo "$DIST_BIT"
}
}
# TODO: check before calc
# TODO: check before calc
get_memory_size
()
{
get_memory_size
()
local
detected
=
0
{
local
detected
=
""
local
DIST_OS
=
"
$(
get_base_os_name
)
"
local
DIST_OS
=
"
$(
get_base_os_name
)
"
case
"
$DIST_OS
"
in
case
"
$DIST_OS
"
in
macosx
)
macosx
)
...
@@ -443,9 +446,14 @@ get_memory_size() {
...
@@ -443,9 +446,14 @@ get_memory_size() {
linux
)
linux
)
[
-r
/proc/meminfo
]
&&
detected
=
$((
`
cat
/proc/meminfo |
grep
MemTotal |
awk
'{print $2}'
`
/
1024
))
[
-r
/proc/meminfo
]
&&
detected
=
$((
`
cat
/proc/meminfo |
grep
MemTotal |
awk
'{print $2}'
`
/
1024
))
;;
;;
solaris
)
detected
=
$(
prtconf |
grep
Memory |
sed
-e
"s|Memory size:
\(
[0-9][0-9]*
\)
Megabyte.*|
\1
|"
)
;;
# *)
# fatal "Unsupported OS $DIST_OS"
esac
esac
# Exit codes only support values between 0 and 255. So use stdout.
[
-n
"
$detected
"
]
||
detected
=
0
echo
$detected
echo
$detected
}
}
...
@@ -525,7 +533,8 @@ print_pretty_name()
...
@@ -525,7 +533,8 @@ print_pretty_name()
print_total_info
()
print_total_info
()
{
{
cat
<<
EOF
cat
<<
EOF
distro_info total information (run with -h to get help):
distro_info v
$PROGVERSION
: Copyright © 2007-2020 Etersoft
==== Total system information:
Pretty distro name (--pretty):
$(
print_pretty_name
)
Pretty distro name (--pretty):
$(
print_pretty_name
)
Distro name and version (-e):
$(
print_name_version
)
Distro name and version (-e):
$(
print_name_version
)
Packaging system (-p):
$(
pkgtype
)
Packaging system (-p):
$(
pkgtype
)
...
@@ -538,13 +547,15 @@ Pretty distro name (--pretty): $(print_pretty_name)
...
@@ -538,13 +547,15 @@ Pretty distro name (--pretty): $(print_pretty_name)
Base OS name (-o):
$(
get_base_os_name
)
Base OS name (-o):
$(
get_base_os_name
)
Build system distro name (-s):
$(
pkgvendor
)
Build system distro name (-s):
$(
pkgvendor
)
Build system vendor name (-n):
$(
rpmvendor
)
Build system vendor name (-n):
$(
rpmvendor
)
(run with -h to get help)
EOF
EOF
}
}
case
$1
in
case
$1
in
-h
)
-h
)
echo
"distro_info
- distro name and version detection
"
echo
"distro_info
v
$PROGVERSION
- distro information retriever
"
echo
"Usage: distro_info [options] [args]"
echo
"Usage: distro_info [options] [args]"
echo
"Options:"
echo
"Options:"
echo
" -a - print hardware architecture"
echo
" -a - print hardware architecture"
...
@@ -615,7 +626,7 @@ case $1 in
...
@@ -615,7 +626,7 @@ case $1 in
get_service_manager
get_service_manager
;;
;;
-V
)
-V
)
echo
"
20191121
"
echo
"
$PROGVERSION
"
exit
0
exit
0
;;
;;
-e
)
-e
)
...
...
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