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
ad21f91d
Commit
ad21f91d
authored
Oct 17, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distr_info: add firstupper function, implement full /etc/os-release checking
parent
0422f2b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
distr_info
bin/distr_info
+17
-2
os-release
tests/etc/os-release
+8
-0
No files found.
bin/distr_info
View file @
ad21f91d
...
@@ -25,6 +25,11 @@ has()
...
@@ -25,6 +25,11 @@ has()
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
}
}
firstupper
()
{
echo
"
$*
"
|
sed
's/.*/\u&/'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor
()
rpmvendor
()
{
{
...
@@ -46,11 +51,12 @@ pkgvendor()
...
@@ -46,11 +51,12 @@ pkgvendor()
# Print pkgtype (need DISTRIB_ID var)
# Print pkgtype (need DISTRIB_ID var)
pkgtype
()
pkgtype
()
{
{
# TODO: try use generic names
case
$(
pkgvendor
)
in
case
$(
pkgvendor
)
in
freebsd
)
echo
"tbz"
;;
freebsd
)
echo
"tbz"
;;
sunos
)
echo
"pkg.gz"
;;
sunos
)
echo
"pkg.gz"
;;
slackware|mopslinux
)
echo
"tgz"
;;
slackware|mopslinux
)
echo
"tgz"
;;
archlinux
)
echo
"pkg.tar.xz"
;;
archlinux
|manjaro
)
echo
"pkg.tar.xz"
;;
gentoo
)
echo
"tbz2"
;;
gentoo
)
echo
"tbz2"
;;
windows
)
echo
"exe"
;;
windows
)
echo
"exe"
;;
android
)
echo
"apk"
;;
android
)
echo
"apk"
;;
...
@@ -140,7 +146,7 @@ elif distro slackware-version ; then
...
@@ -140,7 +146,7 @@ elif distro slackware-version ; then
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$
ID
"
DISTRIB_ID
=
"
$
(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
...
@@ -162,6 +168,7 @@ elif distro arch-release ; then
...
@@ -162,6 +168,7 @@ elif distro arch-release ; then
DISTRIB_RELEASE
=
"2011"
DISTRIB_RELEASE
=
"2011"
fi
fi
# Elbrus
elif
distro mcst_version
;
then
elif
distro mcst_version
;
then
DISTRIB_ID
=
"MCST"
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"
)
...
@@ -272,6 +279,14 @@ elif distro SuSe-release || distro SuSE-release ; then
...
@@ -272,6 +279,14 @@ elif distro SuSe-release || distro SuSE-release ; then
DISTRIB_ID
=
"SLES"
DISTRIB_ID
=
"SLES"
fi
fi
# https://www.freedesktop.org/software/systemd/man/os-release.html
elif
distro os-release
;
then
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
DISTRIB_ID
=
"FreeBSD"
DISTRIB_ID
=
"FreeBSD"
...
...
tests/etc/os-release
0 → 100644
View file @
ad21f91d
NAME="Manjaro Linux"
ID=manjaro
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.manjaro.org/"
SUPPORT_URL="https://www.manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
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