Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
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
etersoft
eepm
Commits
189f0b84
Commit
189f0b84
authored
Nov 21, 2019
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distr_info: sync with distro_info 1.1
parent
6c9c0761
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
26 deletions
+88
-26
distr_info
bin/distr_info
+88
-26
No files found.
bin/distr_info
View file @
189f0b84
#!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016, 2017, 2018 (c) Etersoft
# 2007-2018 Public domain
# Detect the distro and version
# Welcome to send updates!
# 2007-2019 (c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-2019 (c) Etersoft
# 2007-2019 Public domain
# You can set ROOTDIR to root system dir
#ROOTDIR=
...
...
@@ -408,6 +405,9 @@ case "$DIST_BIT" in
'aarch64'
)
DIST_BIT
=
"64"
;;
'e2k'
)
DIST_BIT
=
"64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# ;;
...
...
@@ -444,31 +444,85 @@ get_memory_size() {
echo
$detected
}
print_name_version
()
{
[
-n
"
$DISTRIB_RELEASE
"
]
&&
echo
$DISTRIB_ID
/
$DISTRIB_RELEASE
||
echo
$DISTRIB_ID
}
get_virt
()
{
local
VIRT
local
SDCMD
SDCMD
=
$(
which systemd-detect-virt 2>/dev/null
)
if
[
-n
"
$SDCMD
"
]
;
then
VIRT
=
"
$(
$SDCMD
)
"
[
"
$VIRT
"
=
"none"
]
&&
echo
"(host system)"
&&
return
[
-z
"
$VIRT
"
]
&&
echo
"(unknown)"
&&
return
echo
"
$VIRT
"
&&
return
fi
if
[
-r
/proc/user_beancounters
]
;
then
echo
"openvz"
&&
return
fi
echo
"(unknown)"
# TODO: check for openvz
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
get_service_manager
()
{
[
-d
/run/systemd/system
]
&&
echo
"systemd"
&&
return
[
-d
/usr/share/upstart
]
&&
echo
"upstart"
&&
return
[
-d
/etc/init.d
]
&&
echo
"sysvinit"
&&
return
echo
"(unknown)"
}
print_total_info
()
{
cat
<<
EOF
distro_info total information (run with -h to get help):
Distro name and version (-e):
$(
print_name_version
)
Packaging system (-p):
$(
pkgtype
)
Running service manager (-y):
$(
get_service_manager
)
Virtualization (-i):
$(
get_virt
)
CPU Architecture (-a):
$(
get_arch
)
CPU norm register size (-b):
$(
get_bit_size
)
System memory size (MB) (-m):
$(
get_memory_size
)
Base OS name (-o):
$(
get_base_os_name
)
Build system distro name (-s):
$(
pkgvendor
)
Build system vendor name (-n):
$(
rpmvendor
)
EOF
}
case
$1
in
-h
)
echo
"distro_info - distro name and version detection"
echo
"Usage: distro_info [options] [args]"
echo
"Options:"
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
" -i - print virtualization type"
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)"
ecgi
" -y - print running service manager"
echo
" -v - print version of distro"
echo
" -V - print the utility version"
echo
"Run without args to print all information."
exit
0
;;
-p
)
# override DISTRIB_ID
test
-n
"
$2
"
&&
DISTRIB_ID
=
"
$2
"
pkgtype
exit
0
;;
-h
)
echo
"distr_vendor - system name and version detection"
echo
"Usage: distr_vendor [options] [args]"
echo
"-p [SystemName] - print type of packaging system"
echo
"-d - print distro name"
echo
"-a - print hardware architecture"
echo
"-b - print size of arch bit (32/64)"
echo
"-m - print system memory size (in MB)"
echo
"-o - print base os name"
echo
"-v - print version of distro"
echo
"-e - print full name of distro with version (by default)"
echo
"-s [SystemName] - print name of distro for build system (like in the package release name)"
echo
"-n [SystemName] - print vendor name (as _vendor macros in rpm)"
echo
"-V - print the version of
$0
"
echo
"-h - this help"
exit
0
;;
-d
)
echo
$DISTRIB_ID
;;
...
...
@@ -478,6 +532,9 @@ case $1 in
-b
)
get_bit_size
;;
-i
)
get_virt
;;
-m
)
get_memory_size
;;
...
...
@@ -499,13 +556,18 @@ case $1 in
rpmvendor
exit
0
;;
-y
)
get_service_manager
;;
-V
)
echo
"201
71010
"
echo
"201
91121
"
exit
0
;;
-e
)
print_name_version
;;
*
)
# if run without args, just printout Name/Version of the current system
[
-n
"
$DISTRIB_RELEASE
"
]
&&
echo
$DISTRIB_ID
/
$DISTRIB_RELEASE
||
echo
$DISTRIB_ID
print_total_info
;;
esac
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