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
d80949cb
Commit
d80949cb
authored
Feb 07, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distr_info: cleanup code, fix quotes
parent
bcb38d23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
distr_info
bin/distr_info
+22
-15
No files found.
bin/distr_info
View file @
d80949cb
...
...
@@ -354,11 +354,16 @@ esac
echo
"
$DIST_OS
"
}
get_uname_m
()
{
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
}
get_arch
()
{
local
DIST_ARCH
# Resolve the architecture
DIST_ARCH
=
`
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
DIST_ARCH
=
"
$(
get_uname_m
)
"
case
"
$DIST_ARCH
"
in
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
DIST_ARCH
=
"x86"
...
...
@@ -385,7 +390,7 @@ case "$DIST_ARCH" in
DIST_ARCH
=
"parisc"
;;
armv
*
)
if
[
-z
"
`
readelf
-A
/proc/self/exe |
grep
Tag_ABI_VFP_args
`
"
]
;
then
if
[
-z
"
$(
readelf
-A
/proc/self/exe |
grep
Tag_ABI_VFP_args
)
"
]
;
then
DIST_ARCH
=
"armel"
else
DIST_ARCH
=
"armhf"
...
...
@@ -399,7 +404,7 @@ get_bit_size()
{
local
DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT
=
`
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
DIST_BIT
=
"
$(
get_uname_m
)
"
case
"
$DIST_BIT
"
in
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
DIST_BIT
=
"64"
...
...
@@ -423,18 +428,20 @@ echo "$DIST_BIT"
# TODO: check before calc
get_memory_size
()
{
local
detected
=
0
local
DIST_OS
=
$(
get_base_os_name
)
if
[
$DIST_OS
=
"macosx"
]
then
detected
=
$((
`
sysctl hw.memsize |
sed
s/
"hw.memsize: "
//
`
/
1024
/
1024
))
elif
[
$DIST_OS
=
"freebsd"
]
then
detected
=
$((
`
sysctl hw.physmem |
sed
s/
"hw.physmem: "
//
`
/
1024
/
1024
))
elif
[
$DIST_OS
=
"linux"
]
then
[
-r
/proc/meminfo
]
&&
detected
=
$((
`
cat
/proc/meminfo |
grep
MemTotal |
awk
'{print $2}'
`
/
1024
))
fi
# Exit codes only support values between 0 and 255. So use stdout.
local
DIST_OS
=
"
$(
get_base_os_name
)
"
case
"
$DIST_OS
"
in
macosx
)
detected
=
$((
`
sysctl hw.memsize |
sed
s/
"hw.memsize: "
//
`
/
1024
/
1024
))
;;
freebsd
)
detected
=
$((
`
sysctl hw.physmem |
sed
s/
"hw.physmem: "
//
`
/
1024
/
1024
))
;;
linux
)
[
-r
/proc/meminfo
]
&&
detected
=
$((
`
cat
/proc/meminfo |
grep
MemTotal |
awk
'{print $2}'
`
/
1024
))
;;
esac
# Exit codes only support values between 0 and 255. So use stdout.
echo
$detected
}
...
...
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