mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
base-files: introduce a function to get kernel version number
A new function "get_linux_version()" to normalize and print the
kernel version as an integer. In some migration scripts, it is
useful for checking the Linux kernel version.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19172
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit a0fe3cfb62)
Link: https://github.com/openwrt/openwrt/pull/20739
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
ae51d0098e
commit
42ca1612a2
1 changed files with 7 additions and 0 deletions
|
|
@ -315,3 +315,10 @@ macaddr_canonicalize() {
|
|||
dt_is_enabled() {
|
||||
grep -q okay "/proc/device-tree/$1/status"
|
||||
}
|
||||
|
||||
get_linux_version() {
|
||||
local ver=$(uname -r)
|
||||
local minor=${ver%\.*}
|
||||
|
||||
printf "%d%02d%03d" ${ver%%\.*} ${minor#*\.} ${ver##*\.} 2>/dev/null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue