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
b31bcb1a
Commit
b31bcb1a
authored
Jul 24, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distr_info: use awk instead tr (broken in busybox on OpenWrt), cleanup code
parent
6c7bfd51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
distr_info
bin/distr_info
+16
-8
No files found.
bin/distr_info
View file @
b31bcb1a
...
...
@@ -36,6 +36,13 @@ firstupper()
echo
"
$*
"
|
sed
's/.*/\u&/'
}
tolower
()
{
# tr is broken in busybox (checked with OpenWrt)
#echo "$*" | tr "[:upper:]" "[:lower:]"
echo
"
$*
"
|
awk
'{print tolower($0)}'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor
()
{
...
...
@@ -44,7 +51,7 @@ rpmvendor()
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
return
[
"
$DISTRIB_ID
"
=
"VoidLinux"
]
&&
echo
"void"
&&
return
echo
"
$DISTRIB_ID
"
|
tr
"[:upper:]"
"[:lower:]
"
tolower
"
$DISTRIB_ID
"
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
...
...
@@ -311,11 +318,16 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
esac
fi
get_uname
()
{
tolower
$(
uname
$1
)
|
tr
-d
"
\t\r\n
"
}
get_base_os_name
()
{
local
DIST_OS
# Resolve the os
DIST_OS
=
`
uname
-s
|
tr
"[:upper:]"
"[:lower:]"
|
tr
-d
"
\t\r\n
"
`
DIST_OS
=
"
$(
get_uname
-s
)
"
case
"
$DIST_OS
"
in
'sunos'
)
DIST_OS
=
"solaris"
...
...
@@ -336,16 +348,12 @@ 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
=
"
$(
get_uname
_
m
)
"
DIST_ARCH
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_ARCH
"
in
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
DIST_ARCH
=
"x86"
...
...
@@ -386,7 +394,7 @@ get_bit_size()
{
local
DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT
=
"
$(
get_uname
_
m
)
"
DIST_BIT
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_BIT
"
in
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
DIST_BIT
=
"64"
...
...
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