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
295a58bb
Commit
295a58bb
authored
Jan 06, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distro_info: use /etc/os-release firstly, drop obsoleted code
parent
7dddfcd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
32 deletions
+29
-32
distro_info
bin/distro_info
+29
-32
No files found.
bin/distro_info
View file @
295a58bb
#!/bin/sh
#!/bin/sh
# 2007-202
0
(c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-202
1
(c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-202
0
(c) Etersoft
# 2007-202
1
(c) Etersoft
# 2007-202
0
Public domain
# 2007-202
1
Public domain
# You can set ROOTDIR to root system dir
# You can set ROOTDIR to root system dir
#ROOTDIR=
#ROOTDIR=
PROGVERSION
=
"202
01010
"
PROGVERSION
=
"202
10106
"
# TODO: check /etc/system-release
# TODO: check /etc/system-release
...
@@ -83,7 +83,7 @@ pkgtype()
...
@@ -83,7 +83,7 @@ pkgtype()
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
echo
"rpm"
;;
echo
"rpm"
;;
fedora|redhat|scientific|centos|rhel|goslinux|amzn
)
fedora|redhat|
redos|
scientific|centos|rhel|goslinux|amzn
)
echo
"rpm"
;;
echo
"rpm"
;;
*
)
echo
"rpm"
;;
*
)
echo
"rpm"
;;
esac
esac
...
@@ -101,6 +101,13 @@ get_major_version()
...
@@ -101,6 +101,13 @@ get_major_version()
echo
"
$1
"
|
sed
-e
"s/
\.
.*//g"
echo
"
$1
"
|
sed
-e
"s/
\.
.*//g"
}
}
normalize_name
()
{
[
"
$1
"
=
"RED OS"
]
&&
echo
"RedOS"
&&
return
[
"
$1
"
=
"CentOS Linux"
]
&&
echo
"CentOS"
&&
return
echo
"
${
1
// /
}
"
}
# Default values
# Default values
PRETTY_NAME
=
""
PRETTY_NAME
=
""
DISTRIB_ID
=
"Generic"
DISTRIB_ID
=
"Generic"
...
@@ -115,6 +122,20 @@ if distro lsb-release ; then
...
@@ -115,6 +122,20 @@ if distro lsb-release ; then
PRETTY_NAME
=
$(
cat
$DISTROFILE
| get_var DISTRIB_DESCRIPTION
)
PRETTY_NAME
=
$(
cat
$DISTROFILE
| get_var DISTRIB_DESCRIPTION
)
fi
fi
# Next default by /etc/os-release
# https://www.freedesktop.org/software/systemd/man/os-release.html
if
distro os-release
;
then
# shellcheck disable=SC1090
.
$DISTROFILE
DISTRIB_ID
=
"
$(
normalize_name
"
$NAME
"
)
"
# DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
# set by os-release:
#PRETTY_NAME
VENDOR_ID
=
"
$ID
"
fi
# ALT Linux based
# ALT Linux based
if
distro altlinux-release
;
then
if
distro altlinux-release
;
then
# TODO: use os-release firsly
# TODO: use os-release firsly
...
@@ -240,11 +261,8 @@ elif distro MCBC-release ; then
...
@@ -240,11 +261,8 @@ elif distro MCBC-release ; then
elif
has 3.1
;
then
DISTRIB_RELEASE
=
"3.1"
elif
has 3.1
;
then
DISTRIB_RELEASE
=
"3.1"
fi
fi
elif
distro fedora-release
;
then
# TODO: drop in favour of /etc/os-release
DISTRIB_ID
=
"Fedora"
elif
distro redhat-release
&&
[
-z
"
$PRETTY_NAME
"
]
;
then
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
#"
elif
distro redhat-release
;
then
# FIXME if need
# FIXME if need
# actually in the original RHEL: Red Hat Enterprise Linux .. release N
# actually in the original RHEL: Red Hat Enterprise Linux .. release N
DISTRIB_ID
=
"RHEL"
DISTRIB_ID
=
"RHEL"
...
@@ -275,17 +293,6 @@ elif distro SuSe-release || distro SuSE-release ; then
...
@@ -275,17 +293,6 @@ 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"
if
[
"
$ID
"
=
"opensuse-leap"
]
;
then
DISTRIB_ID
=
"SUSE"
fi
# 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"
...
@@ -315,18 +322,8 @@ elif [ "$(uname)" = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
...
@@ -315,18 +322,8 @@ elif [ "$(uname)" = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
elif
[
"
$(
uname
-o
2>/dev/null
)
"
=
"Cygwin"
]
;
then
elif
[
"
$(
uname
-o
2>/dev/null
)
"
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
DISTRIB_RELEASE
=
"all"
fi
# try use standart LSB info by default
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB
# fix distro name
case
"
$DISTRIB_ID
"
in
"openSUSE Tumbleweed"
)
DISTRIB_ID
=
"SUSE"
DISTRIB_RELEASE
=
"Tumbleweed"
;;
esac
fi
fi
get_uname
()
get_uname
()
...
...
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